Route to active unlock component

Update onRetryPrefenceTreeClick to check for the active unlock
preference. If biometrics are not enrolled and we're using the
biometric failure model, launch the biometric setup flow. Otherwise,
launch the  component directly.

Test: manual flag flip, confirm activity launches
Bug: 266441818
Change-Id: I8f3ce8f8366b65aad622d33ff7f99f5c82aae3e8
This commit is contained in:
Derek Jedral
2023-01-26 15:03:43 -08:00
parent 06466b030b
commit 053a9f8947
6 changed files with 173 additions and 18 deletions

View File

@@ -15,9 +15,14 @@
*/
package com.android.settings.biometrics.combination;
import static com.android.settings.biometrics.activeunlock.ActiveUnlockStatusPreferenceController.KEY_ACTIVE_UNLOCK_SETTINGS;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
@@ -25,6 +30,7 @@ import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.biometrics.activeunlock.ActiveUnlockContentListener.OnContentChangedListener;
import com.android.settings.biometrics.activeunlock.ActiveUnlockDeviceNameListener;
import com.android.settings.biometrics.activeunlock.ActiveUnlockRequireBiometricSetup;
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
@@ -42,6 +48,7 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
private static final String KEY_INTRO_PREFERENCE = "biometric_intro";
private ActiveUnlockStatusUtils mActiveUnlockStatusUtils;
private CombinedBiometricStatusUtils mCombinedBiometricStatusUtils;
@Nullable private ActiveUnlockDeviceNameListener mActiveUnlockDeviceNameListener;
@Override
@@ -55,6 +62,7 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActiveUnlockStatusUtils = new ActiveUnlockStatusUtils(getActivity());
mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(getActivity(), mUserId);
if (mActiveUnlockStatusUtils.isAvailable()) {
updateUiForActiveUnlock();
}
@@ -121,6 +129,35 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
return SettingsEnums.COMBINED_BIOMETRIC;
}
@Override
protected boolean onRetryPreferenceTreeClick(Preference preference, final boolean retry) {
if (!mActiveUnlockStatusUtils.isAvailable()
|| !KEY_ACTIVE_UNLOCK_SETTINGS.equals(preference.getKey())) {
return super.onRetryPreferenceTreeClick(preference, retry);
}
mDoNotFinishActivity = true;
Intent intent;
if (mActiveUnlockStatusUtils.useBiometricFailureLayout()
&& mActiveUnlockDeviceNameListener != null
&& !mActiveUnlockDeviceNameListener.hasEnrolled()
&& !mCombinedBiometricStatusUtils.hasEnrolled()) {
intent = new Intent(getActivity(), ActiveUnlockRequireBiometricSetup.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
int userId = mUserId;
if (mUserId != UserHandle.USER_NULL) {
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
}
intent.putExtra(EXTRA_KEY_GK_PW_HANDLE, getGkPwHandle());
} else {
intent = mActiveUnlockStatusUtils.getIntent();
}
if (intent != null) {
startActivityForResult(intent, ACTIVE_UNLOCK_REQUEST);
}
return true;
}
@Override
protected String getUseAnyBiometricSummary() {
// either Active Unlock is not enabled or no device is enrolled.