diff options
| author | Tao Bao <tbao@google.com> | 2015-10-21 18:05:18 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2015-10-21 18:05:18 +0000 |
| commit | db33bfc2a96c38eba5b67c82cb4fee69c52b80ad (patch) | |
| tree | b91386b35d311b71ea0806f481979d05cc587fce /core/java/android/os/RecoverySystem.java | |
| parent | a2c9a412f463da91bc3ae35c5ea60d8ba920a104 (diff) | |
| parent | ac140e7f7690979378897546e7934381f62922ab (diff) | |
Merge "Clean up the uncrypted OTA package on bootup." am: 5d562d4d2f
am: ac140e7f76
* commit 'ac140e7f7690979378897546e7934381f62922ab':
Clean up the uncrypted OTA package on bootup.
Diffstat (limited to 'core/java/android/os/RecoverySystem.java')
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 8c544f44f244..8e06fa7e4be8 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -341,6 +341,10 @@ public class RecoverySystem { } finally { uncryptFile.close(); } + // UNCRYPT_FILE needs to be readable by system server on bootup. + if (!UNCRYPT_FILE.setReadable(true, false)) { + Log.e(TAG, "Error setting readable for " + UNCRYPT_FILE.getCanonicalPath()); + } Log.w(TAG, "!!! REBOOTING TO INSTALL " + filename + " !!!"); // If the package is on the /data partition, write the block map file @@ -501,6 +505,25 @@ public class RecoverySystem { Log.e(TAG, "Error reading recovery log", e); } + if (UNCRYPT_FILE.exists()) { + String filename = null; + try { + filename = FileUtils.readTextFile(UNCRYPT_FILE, 0, null); + } catch (IOException e) { + Log.e(TAG, "Error reading uncrypt file", e); + } + + // Remove the OTA package on /data that has been (possibly + // partially) processed. (Bug: 24973532) + if (filename != null && filename.startsWith("/data")) { + if (UNCRYPT_FILE.delete()) { + Log.i(TAG, "Deleted: " + filename); + } else { + Log.e(TAG, "Can't delete: " + filename); + } + } + } + // Delete everything in RECOVERY_DIR except those beginning // with LAST_PREFIX String[] names = RECOVERY_DIR.list(); |
