Merge "Allow configuration of which package to handle FACTORY_RESET intent."
This commit is contained in:
@@ -4172,4 +4172,8 @@
|
||||
one bar higher than they actually are -->
|
||||
<bool name="config_inflateSignalStrength">false</bool>
|
||||
|
||||
<!-- The package name for the vendor implementation of ACTION_FACTORY_RESET. For some vendors,
|
||||
the default implementation of ACTION_FACTORY_RESET does not work, so it is needed to re-route
|
||||
this intent to this package. This is being used in MasterClearReceiver.java. -->
|
||||
<string name="config_factoryResetPackage" translatable="false"></string>
|
||||
</resources>
|
||||
|
||||
@@ -3813,4 +3813,5 @@
|
||||
|
||||
<java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" />
|
||||
<java-symbol type="bool" name="config_inflateSignalStrength" />
|
||||
<java-symbol type="string" name="config_factoryResetPackage" />
|
||||
</resources>
|
||||
|
||||
@@ -16,16 +16,15 @@
|
||||
|
||||
package com.android.server;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.RecoverySystem;
|
||||
import android.os.UserHandle;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.euicc.EuiccManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.view.WindowManager;
|
||||
@@ -33,8 +32,6 @@ import android.view.WindowManager;
|
||||
import com.android.internal.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MasterClearReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "MasterClear";
|
||||
@@ -58,6 +55,15 @@ public class MasterClearReceiver extends BroadcastReceiver {
|
||||
+ "Intent#EXTRA_FORCE_FACTORY_RESET should be used instead.");
|
||||
}
|
||||
|
||||
final String factoryResetPackage = context
|
||||
.getString(com.android.internal.R.string.config_factoryResetPackage);
|
||||
if (Intent.ACTION_FACTORY_RESET.equals(intent.getAction())
|
||||
&& !TextUtils.isEmpty(factoryResetPackage)) {
|
||||
intent.setPackage(factoryResetPackage).setComponent(null);
|
||||
context.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean shutdown = intent.getBooleanExtra("shutdown", false);
|
||||
final String reason = intent.getStringExtra(Intent.EXTRA_REASON);
|
||||
mWipeExternalStorage = intent.getBooleanExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, false);
|
||||
|
||||
Reference in New Issue
Block a user