Determine if devices support screen off unlock from config
Bug: 389002332 Flag: android.hardware.biometrics.screen_off_unlock_udfps Test: 1. Build pass 2. Check screen off unlcok is enabled on usudfps & udfps devices 3. Enable screen off unlock on usudfps devices by default 4. Disable screen off unlock on udfps devices by default Change-Id: I81c419f51a808a5e51d9bb92f19553cdf9e9c2f8
This commit is contained in:
@@ -623,15 +623,10 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUltrasnoicUdfps() {
|
private boolean isScreenOffUnlcokSupported() {
|
||||||
mFingerprintManager = Utils.getFingerprintManagerOrNull(getActivity());
|
if (isUdfps()) {
|
||||||
if (mFingerprintManager != null) {
|
return getContext().getResources().getBoolean(
|
||||||
mSensorProperties = mFingerprintManager.getSensorPropertiesInternal();
|
com.android.internal.R.bool.config_screen_off_udfps_enabled);
|
||||||
for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
|
|
||||||
if (prop.isUltrasonicUdfps()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -678,7 +673,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
// This needs to be after setting ids, otherwise
|
// This needs to be after setting ids, otherwise
|
||||||
// |mRequireScreenOnToAuthPreferenceController.isChecked| is always checking the primary
|
// |mRequireScreenOnToAuthPreferenceController.isChecked| is always checking the primary
|
||||||
// user instead of the user with |mUserId|.
|
// user instead of the user with |mUserId|.
|
||||||
if (isSfps() || (screenOffUnlockUdfps() && isUltrasnoicUdfps())) {
|
if (isSfps() || (screenOffUnlockUdfps() && isScreenOffUnlcokSupported())) {
|
||||||
scrollToPreference(fpPrefKey);
|
scrollToPreference(fpPrefKey);
|
||||||
addFingerprintUnlockCategory();
|
addFingerprintUnlockCategory();
|
||||||
}
|
}
|
||||||
@@ -778,7 +773,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
restToUnlockPreference.getOnPreferenceChangeListener());
|
restToUnlockPreference.getOnPreferenceChangeListener());
|
||||||
}
|
}
|
||||||
setupFingerprintUnlockCategoryPreferencesForScreenOnToAuth();
|
setupFingerprintUnlockCategoryPreferencesForScreenOnToAuth();
|
||||||
} else if (screenOffUnlockUdfps() && isUltrasnoicUdfps()) {
|
} else if (screenOffUnlockUdfps() && isScreenOffUnlcokSupported()) {
|
||||||
setupFingerprintUnlockCategoryPreferencesForScreenOffUnlock();
|
setupFingerprintUnlockCategoryPreferencesForScreenOffUnlock();
|
||||||
}
|
}
|
||||||
updateFingerprintUnlockCategoryVisibility();
|
updateFingerprintUnlockCategoryVisibility();
|
||||||
@@ -846,7 +841,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
|
|
||||||
private void updatePreferencesAfterFingerprintRemoved() {
|
private void updatePreferencesAfterFingerprintRemoved() {
|
||||||
updateAddPreference();
|
updateAddPreference();
|
||||||
if (isSfps() || (screenOffUnlockUdfps() && isUltrasnoicUdfps())) {
|
if (isSfps() || (screenOffUnlockUdfps() && isScreenOffUnlcokSupported())) {
|
||||||
updateFingerprintUnlockCategoryVisibility();
|
updateFingerprintUnlockCategoryVisibility();
|
||||||
}
|
}
|
||||||
updatePreferences();
|
updatePreferences();
|
||||||
@@ -1119,7 +1114,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (screenOffUnlockUdfps() && isUltrasnoicUdfps()) {
|
} else if (screenOffUnlockUdfps() && isScreenOffUnlcokSupported()) {
|
||||||
for (AbstractPreferenceController controller : controllers) {
|
for (AbstractPreferenceController controller : controllers) {
|
||||||
if (controller.getPreferenceKey() == KEY_FINGERPRINT_UNLOCK_CATEGORY) {
|
if (controller.getPreferenceKey() == KEY_FINGERPRINT_UNLOCK_CATEGORY) {
|
||||||
mFingerprintUnlockCategoryPreferenceController =
|
mFingerprintUnlockCategoryPreferenceController =
|
||||||
|
@@ -59,7 +59,7 @@ public class FingerprintSettingsScreenOffUnlockUdfpsPreferenceController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean defEnabled = mContext.getResources().getBoolean(
|
final boolean defEnabled = mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_screen_off_udfps_enabled);
|
com.android.internal.R.bool.config_screen_off_udfps_default_on);
|
||||||
final int value = Settings.Secure.getIntForUser(
|
final int value = Settings.Secure.getIntForUser(
|
||||||
mContext.getContentResolver(),
|
mContext.getContentResolver(),
|
||||||
Settings.Secure.SCREEN_OFF_UNLOCK_UDFPS_ENABLED,
|
Settings.Secure.SCREEN_OFF_UNLOCK_UDFPS_ENABLED,
|
||||||
|
Reference in New Issue
Block a user