diff --git a/res/values/strings.xml b/res/values/strings.xml index 65aafd06837..aba576f42e4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -911,6 +911,10 @@ 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. Use Face Unlock for + + Face + + Use Face to When using Face Unlock @@ -942,6 +946,10 @@ Fingerprint + + Fingerprints + + Use fingerprint to Fingerprint diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml index fd3498ea26a..e32148c458b 100644 --- a/res/xml/security_settings_face.xml +++ b/res/xml/security_settings_face.xml @@ -19,6 +19,24 @@ xmlns:settings="http://schemas.android.com/apk/res-auto" android:title="@string/security_settings_face_preference_title"> + + + + + + + + + + + + + + diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java b/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java index 7b3a72446f7..9fe47946fbd 100644 --- a/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java +++ b/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java @@ -29,6 +29,7 @@ import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.Nullable; import androidx.preference.Preference; +import androidx.preference.PreferenceCategory; import com.android.settings.R; import com.android.settings.biometrics.BiometricEnrollBase; @@ -76,6 +77,12 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase { if (mActiveUnlockStatusUtils.isAvailable()) { updateUiForActiveUnlock(); } + if (Flags.biometricsOnboardingEducation()) { + final PreferenceCategory category = findPreference(KEY_USE_BIOMETRIC_PREFERENCE); + if (category != null) { + category.setVisible(false); + } + } } private void updateUiForActiveUnlock() { diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java index 5a3949b8923..26b5c3735c5 100644 --- a/src/com/android/settings/biometrics/face/FaceSettings.java +++ b/src/com/android/settings/biometrics/face/FaceSettings.java @@ -47,6 +47,7 @@ import com.android.settings.biometrics.BiometricEnrollBase; import com.android.settings.biometrics.BiometricUtils; import com.android.settings.biometrics.IdentityCheckBiometricErrorDialog; import com.android.settings.dashboard.DashboardFragment; +import com.android.settings.flags.Flags; import com.android.settings.overlay.FeatureFactory; import com.android.settings.password.ChooseLockSettingsHelper; import com.android.settings.password.ConfirmDeviceCredentialActivity; @@ -76,6 +77,8 @@ public class FaceSettings extends DashboardFragment { "security_settings_face_delete_faces_container"; private static final String PREF_KEY_ENROLL_FACE_UNLOCK = "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 = "security_settings_face_manage_category"; @@ -238,6 +241,12 @@ public class FaceSettings extends DashboardFragment { if (savedInstanceState != null) { mToken = savedInstanceState.getByteArray(KEY_TOKEN); } + + if (Flags.biometricsOnboardingEducation()) { + final PreferenceCategory category = + findPreference(PREF_KEY_USE_FACE_TO_CATEGORY); + category.setVisible(true); + } } @Override diff --git a/src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceController.java new file mode 100644 index 00000000000..f859060f83a --- /dev/null +++ b/src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceController.java @@ -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; + } + } +} diff --git a/src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceController.java new file mode 100644 index 00000000000..e6298c09190 --- /dev/null +++ b/src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceController.java @@ -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; + } +} diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java index e50b0e515ac..e618ae358b3 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java @@ -273,6 +273,8 @@ public class FingerprintSettings extends SubSettings { "security_settings_fingerprint_footer"; private static final String KEY_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_FINGER_AUTH_SUCCESS = 1001; @@ -656,6 +658,9 @@ public class FingerprintSettings extends SubSettings { private PreferenceScreen createPreferenceHierarchy() { PreferenceScreen root = getPreferenceScreen(); addFingerprintPreferences(root); + if (Flags.biometricsOnboardingEducation()) { + setupUseFingerprintToPreferences(); + } setPreferenceScreen(root); return root; } @@ -685,6 +690,10 @@ public class FingerprintSettings extends SubSettings { if (mFingerprintsEnrolledCategory != null) { mFingerprintsEnrolledCategory.removeAll(); } + if (Flags.biometricsOnboardingEducation()) { + mFingerprintsEnrolledCategory.setTitle(root.getContext().getString( + R.string.security_settings_fingerprint_title)); + } String keyToReturn = mIsExpressiveThemeStyle ? 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() { updateAddPreference(); if (isSfps() || (screenOffUnlockUdfps() && isUltrasnoicUdfps())) { diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsAppsPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsAppsPreferenceController.java new file mode 100644 index 00000000000..2cd92fc03e4 --- /dev/null +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsAppsPreferenceController.java @@ -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; + } + } +} diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsKeyguardUnlockPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsKeyguardUnlockPreferenceController.java new file mode 100644 index 00000000000..55c75abbcae --- /dev/null +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsKeyguardUnlockPreferenceController.java @@ -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; + } +} diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java index a570baadd59..02825d2aa50 100644 --- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java +++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java @@ -383,6 +383,19 @@ public class FingerprintSettingsFragmentTest { 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 @EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION) public void testCheckEnrolledHide_nonUdfps() { diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceControllerTest.java new file mode 100644 index 00000000000..bf96cacbeef --- /dev/null +++ b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsAppsPreferenceControllerTest.java @@ -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(); + } +} diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceControllerTest.java new file mode 100644 index 00000000000..4eb7d3edcaa --- /dev/null +++ b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsKeyguardUnlockPreferenceControllerTest.java @@ -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(); + } +} diff --git a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsAppsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsAppsPreferenceControllerTest.java new file mode 100644 index 00000000000..4aa21b88f3c --- /dev/null +++ b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsAppsPreferenceControllerTest.java @@ -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(); + } +} diff --git a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsKeyguardUnlockPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsKeyguardUnlockPreferenceControllerTest.java new file mode 100644 index 00000000000..13a58b1ea63 --- /dev/null +++ b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsKeyguardUnlockPreferenceControllerTest.java @@ -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(); + } +}