diff options
| author | Tianjie Xu <xunchang@google.com> | 2016-04-28 16:44:42 -0700 |
|---|---|---|
| committer | Tianjie Xu <xunchang@google.com> | 2016-04-29 16:19:30 -0700 |
| commit | ac75f1effae79d4bccd3faf65f9a281824a2803e (patch) | |
| tree | f67da958bb9aed4599072367dac7f8e27643bb09 /core/java/android/os/RecoverySystem.java | |
| parent | c56ca11611376a86e0d5791523e7e0ed04f990b6 (diff) | |
Set security update label in framework
GmsCore will use different filenames to distinguish a security update
from a normal update. (update.zip for normal update and update_s.zip for
security update.) So, if framework observes the filename as
"update_s.zip", write command "--security" to BCB. This cmd ask the
recovery image to choose the right background string for update.
Bug: 27837319
Change-Id: I2ef12267a6be57d8a81f7f9f34c09aea54530c1f
Diffstat (limited to 'core/java/android/os/RecoverySystem.java')
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index b25b33d00aa8..403e06ca8553 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -434,6 +434,9 @@ public class RecoverySystem { String filename = packageFile.getCanonicalPath(); Log.w(TAG, "!!! REBOOTING TO INSTALL " + filename + " !!!"); + // If the package name ends with "_s.zip", it's a security update. + boolean securityUpdate = filename.endsWith("_s.zip"); + // If the package is on the /data partition, the package needs to // be processed (i.e. uncrypt'd). The caller specifies if that has // been done in 'processed' parameter. @@ -468,7 +471,12 @@ public class RecoverySystem { final String filenameArg = "--update_package=" + filename + "\n"; final String localeArg = "--locale=" + Locale.getDefault().toString() + "\n"; - final String command = filenameArg + localeArg; + final String securityArg = "--security\n"; + + String command = filenameArg + localeArg; + if (securityUpdate) { + command += securityArg; + } RecoverySystem rs = (RecoverySystem) context.getSystemService( Context.RECOVERY_SERVICE); @@ -501,6 +509,7 @@ public class RecoverySystem { public static void scheduleUpdateOnBoot(Context context, File packageFile) throws IOException { String filename = packageFile.getCanonicalPath(); + boolean securityUpdate = filename.endsWith("_s.zip"); // If the package is on the /data partition, use the block map file as // the package name instead. @@ -510,7 +519,12 @@ public class RecoverySystem { final String filenameArg = "--update_package=" + filename + "\n"; final String localeArg = "--locale=" + Locale.getDefault().toString() + "\n"; - final String command = filenameArg + localeArg; + final String securityArg = "--security\n"; + + String command = filenameArg + localeArg; + if (securityUpdate) { + command += securityArg; + } RecoverySystem rs = (RecoverySystem) context.getSystemService(Context.RECOVERY_SERVICE); if (!rs.setupBcb(command)) { |
