Merge "Make RescueParty call vold directly" into qt-dev
am: 2618371aa5
Change-Id: Id4b104e811a30722ea3c70add3750a9319245ff5
This commit is contained in:
@@ -30,7 +30,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.storage.IStorageManager;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
@@ -41,8 +40,6 @@ import android.util.Log;
|
|||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.android.internal.content.PackageHelper;
|
|
||||||
|
|
||||||
import libcore.io.Streams;
|
import libcore.io.Streams;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@@ -977,18 +974,31 @@ public class RecoverySystem {
|
|||||||
public static void rebootPromptAndWipeUserData(Context context, String reason)
|
public static void rebootPromptAndWipeUserData(Context context, String reason)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean checkpointing = false;
|
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.
|
// 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.
|
// Checkpointing may save us. If it doesn't, we will wind up here again.
|
||||||
try {
|
if (checkpointing) {
|
||||||
IStorageManager storageManager = PackageHelper.getStorageManager();
|
try {
|
||||||
if (storageManager.needsCheckpoint()) {
|
vold.abortChanges("rescueparty", false);
|
||||||
Log.i(TAG, "Rescue Party requested wipe. Aborting update instead.");
|
Log.i(TAG, "Rescue Party requested wipe. Aborting update");
|
||||||
storageManager.abortChanges("rescueparty", false);
|
} catch (Exception e) {
|
||||||
return;
|
Log.i(TAG, "Rescue Party requested wipe. Rebooting instead.");
|
||||||
|
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
|
pm.reboot("rescueparty");
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
return;
|
||||||
Log.i(TAG, "Failed to handle with checkpointing. Continuing with wipe.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String reasonArg = null;
|
String reasonArg = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user