summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
authorJulian Veit <claymore1298@gmail.com>2019-02-02 20:12:47 +0100
committerSpiritCroc <dev@spiritcroc.de>2019-03-24 15:48:07 +0100
commit82d83862fcf7ecea48bd63c8b9c22aa73095056f (patch)
treed0a074adbdc9cfd874c7bf1981f5978d3d09f3c1 /src/com
parenta0f7c212cef6f5618810a02224344181c9a46ffc (diff)
Updater: add possibility to write manualy openrecoveryscript fileHEADp9.0
For some devices - like HTC One M8 - it is needed to write the ORS-file /cache/recovery/openrecoveryscript manualy, so get OTA-updates working. To use this, the system.property ro.aicp.create.ors.file must set to true. Change-Id: Ib32944e726d43c0a821a88734922098d8f6355e1
Diffstat (limited to 'src/com')
-rwxr-xr-xsrc/com/aicp/updater/Service.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/aicp/updater/Service.java b/src/com/aicp/updater/Service.java
index eab1dd2..4f45fc1 100755
--- a/src/com/aicp/updater/Service.java
+++ b/src/com/aicp/updater/Service.java
@@ -25,12 +25,15 @@ import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
@@ -86,6 +89,8 @@ public class Service extends IntentService {
final String MOD_VERSION = SystemProperties.get("ro.aicp.version.update", "unknown");
+ final String AICP_CREATE_ORS_FILE = SystemProperties.get("ro.aicp.create.ors.file","false");
+
private static final int STATUS_NONE = 0;
private static final int STATUS_UPDATING = 1;
private static final int STATUS_ABORT_PENDING = 2;
@@ -441,7 +446,22 @@ public class Service extends IntentService {
Log.d(TAG, "download completed");
onDownloadFinished(targetBuildDate, channel);
- } catch (Exception e) {
+
+ if (AICP_CREATE_ORS_FILE.equals("true"))
+ {
+ Log.d(TAG, "Property: ro.aicp.create.ors.file: " + AICP_CREATE_ORS_FILE + " - writing openrecoveryscript file manually");
+ Writer writer = null;
+ try {
+ writer = new BufferedWriter(new OutputStreamWriter(
+ new FileOutputStream("/cache/recovery/openrecoveryscript"), "utf-8"));
+ writer.write("install @/cache/recovery/block.map");
+ } catch (IOException ex) {
+ Log.e(TAG, "failed to write openrecoveryscript", ex);
+ } finally {
+ try {writer.close();} catch (Exception ex) {/*ignore*/}
+ }
+ }
+ } catch (Exception e) {
Log.e(TAG, "failed to download and install update", e);
PeriodicJob.scheduleRetry(this);
mUpdateInfo = INFO_ERROR;