diff options
author | 2017-01-19 01:47:09 +0000 | |
---|---|---|
committer | 2017-01-19 01:47:10 +0000 | |
commit | 9311dbf9e43168707d9accaec352a66ff229df89 (patch) | |
tree | 30ec56db46625ea61105c49ab20d3882892ae5b9 | |
parent | cec2ebf676c6ba0f44f9d3c41ca63317f65c179d (diff) | |
parent | cc76991f37268eed1ef2c978720b32f0c103dc70 (diff) |
Merge "Revert "RecoverySystem: Fix the issue in installPackage().""
-rw-r--r-- | core/java/android/os/IRecoverySystem.aidl | 2 | ||||
-rw-r--r-- | core/java/android/os/RecoverySystem.java | 15 | ||||
-rw-r--r-- | services/core/java/com/android/server/RecoverySystemService.java | 7 |
3 files changed, 13 insertions, 11 deletions
diff --git a/core/java/android/os/IRecoverySystem.aidl b/core/java/android/os/IRecoverySystem.aidl index 1ee83ae2847d..c5ceecd7c8b9 100644 --- a/core/java/android/os/IRecoverySystem.aidl +++ b/core/java/android/os/IRecoverySystem.aidl @@ -25,5 +25,5 @@ interface IRecoverySystem { boolean uncrypt(in String packageFile, IRecoverySystemProgressListener listener); boolean setupBcb(in String command); boolean clearBcb(); - void rebootRecoveryWithCommand(in String command, in boolean update); + void rebootRecoveryWithCommand(in String command); } diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 7f9ea438cb95..d48431afe691 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -491,10 +491,15 @@ public class RecoverySystem { command += securityArg; } - // RECOVERY_SERVICE writes to BCB (bootloader control block) and triggers the reboot. RecoverySystem rs = (RecoverySystem) context.getSystemService( Context.RECOVERY_SERVICE); - rs.rebootRecoveryWithCommand(command, true /* update */); + if (!rs.setupBcb(command)) { + throw new IOException("Setup BCB failed"); + } + + // Having set up the BCB (bootloader control block), go ahead and reboot + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + pm.reboot(PowerManager.REBOOT_RECOVERY_UPDATE); throw new IOException("Reboot failed (no permissions?)"); } @@ -708,7 +713,7 @@ public class RecoverySystem { // Write the command into BCB (bootloader control block) and boot from // there. Will not return unless failed. RecoverySystem rs = (RecoverySystem) context.getSystemService(Context.RECOVERY_SERVICE); - rs.rebootRecoveryWithCommand(command.toString(), false); + rs.rebootRecoveryWithCommand(command.toString()); throw new IOException("Reboot failed (no permissions?)"); } @@ -908,9 +913,9 @@ public class RecoverySystem { * Talks to RecoverySystemService via Binder to set up the BCB command and * reboot into recovery accordingly. */ - private void rebootRecoveryWithCommand(String command, boolean update) { + private void rebootRecoveryWithCommand(String command) { try { - mService.rebootRecoveryWithCommand(command, update); + mService.rebootRecoveryWithCommand(command); } catch (RemoteException ignored) { } } diff --git a/services/core/java/com/android/server/RecoverySystemService.java b/services/core/java/com/android/server/RecoverySystemService.java index 2010e647e1ea..3c8c699a65bb 100644 --- a/services/core/java/com/android/server/RecoverySystemService.java +++ b/services/core/java/com/android/server/RecoverySystemService.java @@ -181,7 +181,7 @@ public final class RecoverySystemService extends SystemService { } @Override // Binder call - public void rebootRecoveryWithCommand(String command, boolean update) { + public void rebootRecoveryWithCommand(String command) { if (DEBUG) Slog.d(TAG, "rebootRecoveryWithCommand: [" + command + "]"); synchronized (sRequestLock) { if (!setupOrClearBcb(true, command)) { @@ -190,10 +190,7 @@ public final class RecoverySystemService extends SystemService { // Having set up the BCB, go ahead and reboot. PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); - // PowerManagerService may additionally request uncrypting the package when it's - // to install an update (REBOOT_RECOVERY_UPDATE). - pm.reboot(update ? PowerManager.REBOOT_RECOVERY_UPDATE : - PowerManager.REBOOT_RECOVERY); + pm.reboot(PowerManager.REBOOT_RECOVERY); } } |