1/n: Make ChooseLockSettingsHelper into a builder
The multitude of slightly different launchConfirmationActivity(*) methods are a big unsustainable pyramid. It's too difficult to read, too difficult to track which clients are interested in which parameters, and too difficult to add new parameters, since we need to 1) Read through all of them and find one that's the closest 2) Try not to affect other callers, so potentially add yet another 3) Modify the internal paths, which all basically call each other until it reaches the biggest launchConfirmationActivity which has ALL of the parameters This change should have no behavioral change. Note: CredentialStorage doesn't need returnCredentials anymore as of ag/6073449 Test: make -j56 RunSettingsRoboTests Test: Manually traced code paths for each invocation. A few hidden dependencies (such as explicitly setting challenge=0 with hasChallenge=true) were found. Left them the way they were in case they were intended Test: Enroll face, fingerprint Test: Enable developer options Test: Change to PIN, Pattern, Password, then back to PIN (so each type requests confirmation) Test: adb shell am start -a android.app.action.CONFIRM_DEVICE_CREDENTIAL, authenticate Test: adb shell am start -a android.app.action.CONFIRM_FRP_CREDENTIAL (shows confirm credential screen) Fixes: 138453993 Change-Id: Ic82ef3c3ac2e14d624281921f2d816bcdacbd82b
This commit is contained in:
@@ -52,8 +52,8 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
private final OemLockManager mOemLockManager;
|
||||
private final UserManager mUserManager;
|
||||
private final TelephonyManager mTelephonyManager;
|
||||
private final Activity mActivity;
|
||||
private final DevelopmentSettingsDashboardFragment mFragment;
|
||||
private final ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
||||
private RestrictedSwitchPreference mPreference;
|
||||
|
||||
public OemUnlockPreferenceController(Context context, Activity activity,
|
||||
@@ -69,12 +69,8 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
}
|
||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
mActivity = activity;
|
||||
mFragment = fragment;
|
||||
if (activity != null || mFragment != null) {
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(activity, mFragment);
|
||||
} else {
|
||||
mChooseLockSettingsHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,8 +200,11 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
|
||||
@VisibleForTesting
|
||||
boolean showKeyguardConfirmation(Resources resources, int requestCode) {
|
||||
return mChooseLockSettingsHelper.launchConfirmationActivity(
|
||||
requestCode, resources.getString(R.string.oem_unlock_enable));
|
||||
final ChooseLockSettingsHelper.Builder builder =
|
||||
new ChooseLockSettingsHelper.Builder(mActivity, mFragment);
|
||||
return builder.setRequestCode(requestCode)
|
||||
.setTitle(resources.getString(R.string.oem_unlock_enable))
|
||||
.show();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
Reference in New Issue
Block a user