diff options
| author | Daniel Rosenberg <drosen@google.com> | 2019-06-24 15:10:34 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-06-24 15:10:34 -0700 |
| commit | 58462dd8ca8026b8e527fba1ea73dc96d3ea8b0e (patch) | |
| tree | 07b6ae292db7b8db0cc63c576aae7322cedc8f68 /core/java | |
| parent | e0a23bf18a015c45fef8605c81ff8cc2cdeb53a3 (diff) | |
| parent | 2afc347abf3afc1405931fc3f94fba644407eef6 (diff) | |
Merge "Merge "Make RescueParty call vold directly" into qt-dev am: 2618371aa5 am: 810274ed2d" into qt-r1-dev-plus-aosp
am: 2afc347abf
Change-Id: I3db4dd79a91bc61d5c24b49a9c9295a61b0ccc00
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 8938dddeadfa..48fc2a6bf449 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -30,7 +30,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; -import android.os.storage.IStorageManager; import android.provider.Settings; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; @@ -41,8 +40,6 @@ import android.util.Log; import android.view.Display; import android.view.WindowManager; -import com.android.internal.content.PackageHelper; - import libcore.io.Streams; import java.io.ByteArrayInputStream; @@ -977,18 +974,31 @@ public class RecoverySystem { public static void rebootPromptAndWipeUserData(Context context, String reason) throws IOException { boolean checkpointing = false; + boolean needReboot = false; + IVold vold = null; + try { + vold = IVold.Stub.asInterface(ServiceManager.checkService("vold")); + if (vold != null) { + checkpointing = vold.needsCheckpoint(); + } else { + Log.w(TAG, "Failed to get vold"); + } + } catch (Exception e) { + Log.w(TAG, "Failed to check for checkpointing"); + } // If we are running in checkpointing mode, we should not prompt a wipe. // Checkpointing may save us. If it doesn't, we will wind up here again. - try { - IStorageManager storageManager = PackageHelper.getStorageManager(); - if (storageManager.needsCheckpoint()) { - Log.i(TAG, "Rescue Party requested wipe. Aborting update instead."); - storageManager.abortChanges("rescueparty", false); - return; + if (checkpointing) { + try { + vold.abortChanges("rescueparty", false); + Log.i(TAG, "Rescue Party requested wipe. Aborting update"); + } catch (Exception e) { + Log.i(TAG, "Rescue Party requested wipe. Rebooting instead."); + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + pm.reboot("rescueparty"); } - } catch (RemoteException e) { - Log.i(TAG, "Failed to handle with checkpointing. Continuing with wipe."); + return; } String reasonArg = null; |
