[Biometric Onboarding & Edu] Support ways to use section for Face & FP

Move "Ways to use" section from "Face & Fingerprint Unlock" page to
"Face unlock" & "Fingerprint unlock" pages which means Face &
Fingerprint settings now have their own "Unlock your phone" & "Verify
it's your in app" settings.

Bug: 370940762
Test: atest FaceSettingsAppsPreferenceControllerTest
            FaceSettingsKeyguardUnlockPreferenceControllerTest
	    FingerprintSettingsAppsPreferenceControllerTest
	    FingerprintSettingsKeyguardUnlockPreferenceControllerTest
	    FingerprintSettingsFragmentTest
Flag: com.android.settings.flags.biometrics_onboarding_education
Change-Id: I702da9bb9415b6deb741132ccde6b8be7ae38de0
This commit is contained in:
Shawn Lin
2025-01-12 06:12:52 +00:00
parent 73196499c3
commit 2b8a202028
15 changed files with 573 additions and 0 deletions

View File

@@ -901,6 +901,10 @@
<string name="security_settings_face_enroll_improve_face_alert_body_fingerprint">Delete your current face model to set up Face Unlock again.\n\nYour face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone or for authentication in apps.</string> <string name="security_settings_face_enroll_improve_face_alert_body_fingerprint">Delete your current face model to set up Face Unlock again.\n\nYour face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone or for authentication in apps.</string>
<!-- Title for a category shown for the face settings page. [CHAR LIMIT=20] --> <!-- Title for a category shown for the face settings page. [CHAR LIMIT=20] -->
<string name="security_settings_face_settings_use_face_category">Use Face Unlock for</string> <string name="security_settings_face_settings_use_face_category">Use Face Unlock for</string>
<!-- Title for a category shown for the face settings page. [CHAR LIMIT=20] -->
<string name="security_settings_face_settings_face_category">Face</string>
<!-- Title for a category shown for the face settings page. [CHAR LIMIT=20] -->
<string name="security_settings_face_settings_use_face_to_category">Use Face to</string>
<!-- Title for a category shown for the face settings page, followed by items that the user can toggle on/off to require/disable. [CHAR LIMIT=50] --> <!-- Title for a category shown for the face settings page, followed by items that the user can toggle on/off to require/disable. [CHAR LIMIT=50] -->
<string name="security_settings_face_settings_preferences_category">When using Face Unlock</string> <string name="security_settings_face_settings_preferences_category">When using Face Unlock</string>
<!-- Text shown on a toggle which disables/enables face unlock, depending if the user's eyes are open. [CHAR LIMIT=30] --> <!-- Text shown on a toggle which disables/enables face unlock, depending if the user's eyes are open. [CHAR LIMIT=30] -->
@@ -932,6 +936,10 @@
<!-- Note: Update FingerprintEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. --> <!-- Note: Update FingerprintEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
<!-- Title shown for choose lock options [CHAR LIMIT=22] --> <!-- Title shown for choose lock options [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint">Fingerprint</string> <string name="security_settings_fingerprint">Fingerprint</string>
<!-- Title shown for a category shown for fingerprint settings page. [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_title">Fingerprints</string>
<!-- Fingerprint category title - fingerprint options for unlocking the device. [CHAR LIMIT=60] -->
<string name="security_settings_category_use_fingerprint">Use fingerprint to</string>
<!-- Title shown for menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] --> <!-- Title shown for menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_preference_title">Fingerprint</string> <string name="security_settings_fingerprint_preference_title">Fingerprint</string>
<!-- Title for a category shown for the fingerprint settings page, followed by items that the user can toggle on/off to require/disable. [CHAR LIMIT=50] --> <!-- Title for a category shown for the fingerprint settings page, followed by items that the user can toggle on/off to require/disable. [CHAR LIMIT=50] -->

View File

@@ -19,6 +19,24 @@
xmlns:settings="http://schemas.android.com/apk/res-auto" xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/security_settings_face_preference_title"> android:title="@string/security_settings_face_preference_title">
<PreferenceCategory
android:key="biometric_settings_use_face_to"
android:title="@string/security_settings_face_settings_use_face_to_category"
settings:isPreferenceVisible="false">
<com.android.settingslib.RestrictedSwitchPreference
android:key="biometric_settings_face_keyguard"
android:title="@string/biometric_settings_use_biometric_unlock_phone"
settings:keywords="@string/keywords_biometric_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsKeyguardUnlockPreferenceController"/>
<SwitchPreferenceCompat
android:key="biometric_settings_face_app"
android:title="@string/biometric_settings_use_biometric_for_apps"
settings:keywords="@string/keywords_biometric_unlock"
settings:controller="com.android.settings.biometrics.face.FaceSettingsAppsPreferenceController"/>
</PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="security_settings_face_unlock_category" android:key="security_settings_face_unlock_category"
android:title="@string/security_settings_face_settings_use_face_category" android:title="@string/security_settings_face_settings_use_face_category"

View File

@@ -19,6 +19,24 @@
xmlns:settings="http://schemas.android.com/apk/res-auto" xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/security_settings_fingerprint_preference_title"> android:title="@string/security_settings_fingerprint_preference_title">
<PreferenceCategory
android:key="biometric_settings_use_fingerprint_to"
android:title="@string/security_settings_category_use_fingerprint"
settings:isPreferenceVisible="false">
<com.android.settingslib.RestrictedSwitchPreference
android:key="biometric_settings_fingerprint_keyguard"
android:title="@string/biometric_settings_use_biometric_unlock_phone"
settings:keywords="@string/keywords_biometric_unlock"
settings:controller="com.android.settings.biometrics.fingerprint.FingerprintSettingsKeyguardUnlockPreferenceController"/>
<SwitchPreferenceCompat
android:key="biometric_settings_fingerprint_app"
android:title="@string/biometric_settings_use_biometric_for_apps"
settings:keywords="@string/keywords_biometric_unlock"
settings:controller="com.android.settings.biometrics.fingerprint.FingerprintSettingsAppsPreferenceController"/>
</PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="security_settings_fingerprints_enrolled" android:key="security_settings_fingerprints_enrolled"
settings:controller="com.android.settings.biometrics.fingerprint.FingerprintsEnrolledCategoryPreferenceController"> settings:controller="com.android.settings.biometrics.fingerprint.FingerprintsEnrolledCategoryPreferenceController">

View File

@@ -29,6 +29,7 @@ import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts; import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.biometrics.BiometricEnrollBase; import com.android.settings.biometrics.BiometricEnrollBase;
@@ -76,6 +77,12 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
if (mActiveUnlockStatusUtils.isAvailable()) { if (mActiveUnlockStatusUtils.isAvailable()) {
updateUiForActiveUnlock(); updateUiForActiveUnlock();
} }
if (Flags.biometricsOnboardingEducation()) {
final PreferenceCategory category = findPreference(KEY_USE_BIOMETRIC_PREFERENCE);
if (category != null) {
category.setVisible(false);
}
}
} }
private void updateUiForActiveUnlock() { private void updateUiForActiveUnlock() {

View File

@@ -47,6 +47,7 @@ import com.android.settings.biometrics.BiometricEnrollBase;
import com.android.settings.biometrics.BiometricUtils; import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.biometrics.IdentityCheckBiometricErrorDialog; import com.android.settings.biometrics.IdentityCheckBiometricErrorDialog;
import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.flags.Flags;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settings.password.ChooseLockSettingsHelper; import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.password.ConfirmDeviceCredentialActivity; import com.android.settings.password.ConfirmDeviceCredentialActivity;
@@ -76,6 +77,8 @@ public class FaceSettings extends DashboardFragment {
"security_settings_face_delete_faces_container"; "security_settings_face_delete_faces_container";
private static final String PREF_KEY_ENROLL_FACE_UNLOCK = private static final String PREF_KEY_ENROLL_FACE_UNLOCK =
"security_settings_face_enroll_faces_container"; "security_settings_face_enroll_faces_container";
private static final String PREF_KEY_USE_FACE_TO_CATEGORY =
"biometric_settings_use_face_to";
public static final String SECURITY_SETTINGS_FACE_MANAGE_CATEGORY = public static final String SECURITY_SETTINGS_FACE_MANAGE_CATEGORY =
"security_settings_face_manage_category"; "security_settings_face_manage_category";
@@ -238,6 +241,12 @@ public class FaceSettings extends DashboardFragment {
if (savedInstanceState != null) { if (savedInstanceState != null) {
mToken = savedInstanceState.getByteArray(KEY_TOKEN); mToken = savedInstanceState.getByteArray(KEY_TOKEN);
} }
if (Flags.biometricsOnboardingEducation()) {
final PreferenceCategory category =
findPreference(PREF_KEY_USE_FACE_TO_CATEGORY);
category.setVisible(true);
}
} }
@Override @Override

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.face;
import static android.provider.Settings.Secure.FACE_APP_ENABLED;
import android.content.Context;
import android.hardware.face.FaceManager;
import android.provider.Settings;
import androidx.annotation.NonNull;
import com.android.settings.Utils;
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
public class FaceSettingsAppsPreferenceController extends
FaceSettingsPreferenceController {
private static final int ON = 1;
private static final int OFF = 0;
private static final int DEFAULT = ON;
private FaceManager mFaceManager;
public FaceSettingsAppsPreferenceController(@NonNull Context context, @NonNull String key) {
super(context, key);
mFaceManager = Utils.getFaceManagerOrNull(context);
}
@Override
public boolean isChecked() {
return Settings.Secure.getIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED,
DEFAULT, getUserId()) == ON;
}
@Override
public boolean setChecked(boolean isChecked) {
return Settings.Secure.putIntForUser(mContext.getContentResolver(), FACE_APP_ENABLED,
isChecked ? ON : OFF, getUserId());
}
@Override
public int getAvailabilityStatus() {
final ActiveUnlockStatusUtils activeUnlockStatusUtils =
new ActiveUnlockStatusUtils(mContext);
if (!Utils.hasFaceHardware(mContext)
&& !activeUnlockStatusUtils.isAvailable()) {
return UNSUPPORTED_ON_DEVICE;
}
if (mFaceManager == null) {
return AVAILABLE_UNSEARCHABLE;
}
// This preference will be available only if the user has registered face.
final boolean hasFaceEnrolledUser = mFaceManager.hasEnrolledTemplates(getUserId());
if (hasFaceEnrolledUser) {
return AVAILABLE;
} else {
return AVAILABLE_UNSEARCHABLE;
}
}
}

View File

@@ -0,0 +1,68 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.face;
import static android.provider.Settings.Secure.FACE_KEYGUARD_ENABLED;
import android.content.Context;
import android.provider.Settings;
import androidx.annotation.NonNull;
import com.android.settings.Utils;
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
public class FaceSettingsKeyguardUnlockPreferenceController extends
FaceSettingsPreferenceController {
private static final int ON = 1;
private static final int OFF = 0;
private static final int DEFAULT = ON;
public FaceSettingsKeyguardUnlockPreferenceController(
@NonNull Context context, @NonNull String key) {
super(context, key);
}
@Override
public boolean isChecked() {
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
FACE_KEYGUARD_ENABLED, DEFAULT, getUserId()) == ON;
}
@Override
public boolean setChecked(boolean isChecked) {
return Settings.Secure.putIntForUser(mContext.getContentResolver(),
FACE_KEYGUARD_ENABLED, isChecked ? ON : OFF, getUserId());
}
@Override
public int getAvailabilityStatus() {
final ActiveUnlockStatusUtils activeUnlockStatusUtils =
new ActiveUnlockStatusUtils(mContext);
if (activeUnlockStatusUtils.isAvailable()) {
return getAvailabilityFromRestrictingAdmin();
}
if (!Utils.hasFaceHardware(mContext)) {
return UNSUPPORTED_ON_DEVICE;
}
return getAvailabilityFromRestrictingAdmin();
}
private int getAvailabilityFromRestrictingAdmin() {
return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
}
}

View File

@@ -273,6 +273,8 @@ public class FingerprintSettings extends SubSettings {
"security_settings_fingerprint_footer"; "security_settings_fingerprint_footer";
private static final String KEY_BIOMETRICS_AUTHENTICATION_REQUESTED = private static final String KEY_BIOMETRICS_AUTHENTICATION_REQUESTED =
"biometrics_authentication_requested"; "biometrics_authentication_requested";
private static final String KEY_BIOMETRICS_USE_FINGERPRINT_TO_CATEGORY =
"biometric_settings_use_fingerprint_to";
private static final int MSG_REFRESH_FINGERPRINT_TEMPLATES = 1000; private static final int MSG_REFRESH_FINGERPRINT_TEMPLATES = 1000;
private static final int MSG_FINGER_AUTH_SUCCESS = 1001; private static final int MSG_FINGER_AUTH_SUCCESS = 1001;
@@ -656,6 +658,9 @@ public class FingerprintSettings extends SubSettings {
private PreferenceScreen createPreferenceHierarchy() { private PreferenceScreen createPreferenceHierarchy() {
PreferenceScreen root = getPreferenceScreen(); PreferenceScreen root = getPreferenceScreen();
addFingerprintPreferences(root); addFingerprintPreferences(root);
if (Flags.biometricsOnboardingEducation()) {
setupUseFingerprintToPreferences();
}
setPreferenceScreen(root); setPreferenceScreen(root);
return root; return root;
} }
@@ -685,6 +690,10 @@ public class FingerprintSettings extends SubSettings {
if (mFingerprintsEnrolledCategory != null) { if (mFingerprintsEnrolledCategory != null) {
mFingerprintsEnrolledCategory.removeAll(); mFingerprintsEnrolledCategory.removeAll();
} }
if (Flags.biometricsOnboardingEducation()) {
mFingerprintsEnrolledCategory.setTitle(root.getContext().getString(
R.string.security_settings_fingerprint_title));
}
String keyToReturn = mIsExpressiveThemeStyle String keyToReturn = mIsExpressiveThemeStyle
? KEY_FINGERPRINT_ADD_EXPRESSIVE : KEY_FINGERPRINT_ADD; ? KEY_FINGERPRINT_ADD_EXPRESSIVE : KEY_FINGERPRINT_ADD;
@@ -815,6 +824,26 @@ public class FingerprintSettings extends SubSettings {
}); });
} }
private void setupUseFingerprintToPreferences() {
final PreferenceCategory category =
findPreference(KEY_BIOMETRICS_USE_FINGERPRINT_TO_CATEGORY);
category.setVisible(true);
// Setup use fingerprint to unlock preference
final FingerprintSettingsKeyguardUnlockPreferenceController fpUnlockController =
use(FingerprintSettingsKeyguardUnlockPreferenceController.class);
fpUnlockController.setUserId(mUserId);
findPreference(fpUnlockController.getPreferenceKey())
.setOnPreferenceChangeListener(fpUnlockController);
// Setup use fingerprint to verify it's you in apps preference
final FingerprintSettingsAppsPreferenceController fingerprintAppController =
use(FingerprintSettingsAppsPreferenceController.class);
fingerprintAppController.setUserId(mUserId);
findPreference(fingerprintAppController.getPreferenceKey())
.setOnPreferenceChangeListener(fingerprintAppController);
}
private void updatePreferencesAfterFingerprintRemoved() { private void updatePreferencesAfterFingerprintRemoved() {
updateAddPreference(); updateAddPreference();
if (isSfps() || (screenOffUnlockUdfps() && isUltrasnoicUdfps())) { if (isSfps() || (screenOffUnlockUdfps() && isUltrasnoicUdfps())) {

View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.fingerprint;
import static android.provider.Settings.Secure.FINGERPRINT_APP_ENABLED;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.provider.Settings;
import androidx.annotation.NonNull;
import com.android.settings.Utils;
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
public class FingerprintSettingsAppsPreferenceController
extends FingerprintSettingsPreferenceController {
private static final int ON = 1;
private static final int OFF = 0;
private static final int DEFAULT = ON;
private FingerprintManager mFingerprintManager;
public FingerprintSettingsAppsPreferenceController(
@NonNull Context context, @NonNull String key) {
super(context, key);
mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
}
@Override
public boolean isChecked() {
return Settings.Secure.getIntForUser(mContext.getContentResolver(), FINGERPRINT_APP_ENABLED,
DEFAULT, getUserId()) == ON;
}
@Override
public boolean setChecked(boolean isChecked) {
return Settings.Secure.putIntForUser(mContext.getContentResolver(), FINGERPRINT_APP_ENABLED,
isChecked ? ON : OFF, getUserId());
}
@Override
public int getAvailabilityStatus() {
final ActiveUnlockStatusUtils activeUnlockStatusUtils =
new ActiveUnlockStatusUtils(mContext);
if (!Utils.hasFingerprintHardware(mContext)
&& !activeUnlockStatusUtils.isAvailable()) {
return UNSUPPORTED_ON_DEVICE;
}
if (mFingerprintManager == null) {
return AVAILABLE_UNSEARCHABLE;
}
// This preference will be available only if the user has registered fingerprint.
final boolean hasFingerprintEnrolledUser =
mFingerprintManager.hasEnrolledTemplates(getUserId());
if (hasFingerprintEnrolledUser) {
return AVAILABLE;
} else {
return AVAILABLE_UNSEARCHABLE;
}
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.fingerprint;
import static android.provider.Settings.Secure.FINGERPRINT_KEYGUARD_ENABLED;
import android.content.Context;
import android.provider.Settings;
import androidx.annotation.NonNull;
import com.android.settings.Utils;
import com.android.settings.biometrics.activeunlock.ActiveUnlockStatusUtils;
public class FingerprintSettingsKeyguardUnlockPreferenceController
extends FingerprintSettingsPreferenceController {
private static final int ON = 1;
private static final int OFF = 0;
private static final int DEFAULT = ON;
public FingerprintSettingsKeyguardUnlockPreferenceController(
@NonNull Context context, @NonNull String key) {
super(context, key);
}
@Override
public boolean isChecked() {
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
FINGERPRINT_KEYGUARD_ENABLED, DEFAULT, getUserId()) == ON;
}
@Override
public boolean setChecked(boolean isChecked) {
return Settings.Secure.putIntForUser(mContext.getContentResolver(),
FINGERPRINT_KEYGUARD_ENABLED, isChecked ? ON : OFF, getUserId());
}
@Override
public int getAvailabilityStatus() {
final ActiveUnlockStatusUtils activeUnlockStatusUtils =
new ActiveUnlockStatusUtils(mContext);
if (activeUnlockStatusUtils.isAvailable()) {
return getAvailabilityFromRestrictingAdmin();
}
if (!Utils.hasFingerprintHardware(mContext)) {
return UNSUPPORTED_ON_DEVICE;
}
return getAvailabilityFromRestrictingAdmin();
}
private int getAvailabilityFromRestrictingAdmin() {
return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
}
}

View File

@@ -383,6 +383,19 @@ public class FingerprintSettingsFragmentTest {
assertThat(checkEnrolledPerf).isNull(); assertThat(checkEnrolledPerf).isNull();
} }
@Test
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
public void testUseFingerprintToPreference_isShown() {
doReturn(List.of()).when(mFingerprintManager).getEnrolledFingerprints(anyInt());
setUpFragment(false, PRIMARY_USER_ID, TYPE_UDFPS_OPTICAL, 5);
shadowOf(Looper.getMainLooper()).idle();
final Preference preference =
mFragment.findPreference("biometric_settings_use_fingerprint_to");
assertThat(preference.isVisible()).isTrue();
}
@Test @Test
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION) @EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
public void testCheckEnrolledHide_nonUdfps() { public void testCheckEnrolledHide_nonUdfps() {

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.face;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class FaceSettingsAppsPreferenceControllerTest {
private Context mContext;
private FaceSettingsAppsPreferenceController mController;
@Before
public void setUp() {
mContext = ApplicationProvider.getApplicationContext();
mController = new FaceSettingsAppsPreferenceController(
mContext, "biometric_settings_face_app");
}
@Test
public void isSliceable_returnFalse() {
assertThat(mController.isSliceable()).isFalse();
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.face;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class FaceSettingsKeyguardUnlockPreferenceControllerTest {
private Context mContext;
private FaceSettingsKeyguardUnlockPreferenceController mController;
@Before
public void setUp() {
mContext = ApplicationProvider.getApplicationContext();
mController = new FaceSettingsKeyguardUnlockPreferenceController(
mContext, "biometric_settings_face_keyguard");
}
@Test
public void isSliceable_returnFalse() {
assertThat(mController.isSliceable()).isFalse();
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.fingerprint;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class FingerprintSettingsAppsPreferenceControllerTest {
private Context mContext;
private FingerprintSettingsAppsPreferenceController mController;
@Before
public void setUp() {
mContext = ApplicationProvider.getApplicationContext();
mController = new FingerprintSettingsAppsPreferenceController(
mContext, "biometric_settings_fingerprint_app");
}
@Test
public void isSliceable_returnFalse() {
assertThat(mController.isSliceable()).isFalse();
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.biometrics.fingerprint;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class FingerprintSettingsKeyguardUnlockPreferenceControllerTest {
private Context mContext;
private FingerprintSettingsKeyguardUnlockPreferenceController mController;
@Before
public void setUp() {
mContext = ApplicationProvider.getApplicationContext();
mController = new FingerprintSettingsKeyguardUnlockPreferenceController(
mContext, "biometric_settings_fingerprint_keyguard");
}
@Test
public void isSliceable_returnFalse() {
assertThat(mController.isSliceable()).isFalse();
}
}