[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

@@ -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;
}
}