Require password to FR in carrier demo mode
Bug: 34341567 Test: manual - password is not required for regular user factory resets and is required in carrier demo mode. Change-Id: Ic594ebafdac02fc467dc6b2e46dfbd520db3ce9f
This commit is contained in:
@@ -20,6 +20,7 @@ import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.accounts.AuthenticatorDescription;
|
||||
import android.app.Activity;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -46,6 +47,7 @@ import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.widget.CarrierDemoPasswordDialogFragment;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -62,7 +64,8 @@ import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
*
|
||||
* This is the initial screen.
|
||||
*/
|
||||
public class MasterClear extends OptionsMenuFragment {
|
||||
public class MasterClear extends OptionsMenuFragment
|
||||
implements CarrierDemoPasswordDialogFragment.Callback {
|
||||
private static final String TAG = "MasterClear";
|
||||
|
||||
private static final int KEYGUARD_REQUEST = 55;
|
||||
@@ -127,12 +130,23 @@ public class MasterClear extends OptionsMenuFragment {
|
||||
private final Button.OnClickListener mInitiateListener = new Button.OnClickListener() {
|
||||
|
||||
public void onClick(View v) {
|
||||
if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) {
|
||||
if ( Utils.isCarrierDemoUser(v.getContext())) {
|
||||
// Require the carrier password before displaying the final confirmation.
|
||||
final FragmentManager fm = getChildFragmentManager();
|
||||
if (fm != null && !fm.isDestroyed()) {
|
||||
new CarrierDemoPasswordDialogFragment().show(fm, null /* tag */);
|
||||
}
|
||||
} else if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) {
|
||||
showFinalConfirmation();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onPasswordVerified() {
|
||||
showFinalConfirmation();
|
||||
}
|
||||
|
||||
/**
|
||||
* In its initial state, the activity presents a button for the user to
|
||||
* click in order to initiate a confirmation sequence. This method is
|
||||
|
Reference in New Issue
Block a user