summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Rosenberg <drosen@google.com> 2019-03-19 19:24:22 -0700
committer Daniel Rosenberg <drosen@google.com> 2019-03-25 21:16:13 +0000
commit8cbd24dda28c39ec6051a9015b81f6f03625a73f (patch)
tree30bc865e454b7731750a570bbfb7f0e54deaf800
parent600799b8b4a9faaa3e9ebbde7bce10c1f1167e80 (diff)
Make RescueParty not wipe if checkpointing
If we're checkpointing, we can roll back instead of wiping. If the update was the problem, we will succeed. Otherwise, RescueParty will catch the issue again and prompt the wipe later Test: setprop persist.sys.enable_rescue 1 Set device to not commit checkpoints vdc checkpoint StartCheckpoint 3 reboot adb shell setprop debug.crash_system 1 adb shell stop adb shell start Rescue Party causes reboot instead of wipe repeat without checkpointing to get wipe Change-Id: Iba0263214baa7a0c3d5565b4393d03f975d8000a
-rw-r--r--core/java/android/os/RecoverySystem.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 6a01e56cdf52..7cc7ccd2ad16 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -30,6 +30,7 @@ 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.euicc.EuiccManager;
import android.text.TextUtils;
@@ -38,6 +39,8 @@ 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;
@@ -854,6 +857,21 @@ public class RecoverySystem {
/** {@hide} */
public static void rebootPromptAndWipeUserData(Context context, String reason)
throws IOException {
+ boolean checkpointing = false;
+
+ // 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;
+ } catch (RemoteException e) {
+ Log.i(TAG, "Failed to handle with checkpointing. Continuing with wipe.");
+ }
+
String reasonArg = null;
if (!TextUtils.isEmpty(reason)) {
reasonArg = "--reason=" + sanitizeArg(reason);