Loading core/res/res/values/config.xml +6 −0 Original line number Diff line number Diff line Loading @@ -6084,6 +6084,12 @@ different from the home screen wallpaper. --> <bool name="config_independentLockscreenLiveWallpaper">false</bool> <!-- Whether the vendor power press code need to be mapped. --> <bool name="config_powerPressMapping">false</bool> <!-- Power press vendor code. --> <integer name="config_powerPressCode">-1</integer> <!-- Whether to show weather on the lock screen by default. --> <bool name="config_lockscreenWeatherEnabledByDefault">false</bool> </resources> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2655,6 +2655,8 @@ <java-symbol type="integer" name="config_sideFpsToastTimeout"/> <java-symbol type="integer" name="config_sidefpsSkipWaitForPowerAcquireMessage"/> <java-symbol type="integer" name="config_sidefpsSkipWaitForPowerVendorAcquireMessage"/> <java-symbol type="integer" name="config_powerPressCode"/> <java-symbol type="bool" name="config_powerPressMapping"/> <!-- Clickable toast used during sidefps enrollment --> <java-symbol type="layout" name="side_fps_toast" /> Loading services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java +10 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,16 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> @Override public void onError(int errorCode, int vendorCode) { if (getContext().getResources().getBoolean(R.bool.config_powerPressMapping) && errorCode == BiometricFingerprintConstants.FINGERPRINT_ERROR_VENDOR && vendorCode == getContext().getResources() .getInteger(R.integer.config_powerPressCode)) { // Translating vendor code to internal code super.onError(BiometricFingerprintConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0 /* vendorCode */); } else { super.onError(errorCode, vendorCode); } if (errorCode == BiometricFingerprintConstants.FINGERPRINT_ERROR_BAD_CALIBRATION) { BiometricNotificationUtils.showBadCalibrationNotification(getContext()); Loading services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java +13 −5 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.os.RemoteException; import android.util.Slog; import android.view.accessibility.AccessibilityManager; import com.android.internal.R; import com.android.server.biometrics.HardwareAuthTokenUtils; import com.android.server.biometrics.log.BiometricContext; import com.android.server.biometrics.log.BiometricLogger; Loading Loading @@ -143,8 +144,18 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps } }); mCallback.onBiometricAction(BiometricStateListener.ACTION_SENSOR_TOUCH); if (getContext().getResources().getBoolean(R.bool.config_powerPressMapping) && acquiredInfo == BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_VENDOR && vendorCode == getContext().getResources() .getInteger(R.integer.config_powerPressCode)) { // Translating vendor code to internal code super.onAcquired(BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_POWER_PRESSED, 0 /* vendorCode */); } else { super.onAcquired(acquiredInfo, vendorCode); } } @Override public void onError(int errorCode, int vendorCode) { Loading Loading @@ -270,8 +281,5 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps } @Override public void onPowerPressed() { onAcquired(BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_POWER_PRESSED, 0 /* vendorCode */); } public void onPowerPressed() {} } services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.biometrics.sensors.fingerprint.aidl; import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_VENDOR; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyBoolean; Loading @@ -35,6 +37,7 @@ import static org.mockito.Mockito.when; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.content.ComponentName; import android.hardware.biometrics.BiometricFingerprintConstants; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.common.ICancellationSignal; import android.hardware.biometrics.common.OperationContext; Loading @@ -54,6 +57,7 @@ import android.testing.TestableContext; import androidx.test.filters.SmallTest; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.R; import com.android.server.biometrics.log.BiometricContext; import com.android.server.biometrics.log.BiometricLogger; import com.android.server.biometrics.log.CallbackWithProbe; Loading Loading @@ -335,6 +339,21 @@ public class FingerprintAuthenticationClientTest { showHideOverlay(c -> c.onLockoutPermanent()); } @Test public void testPowerPressForwardsErrorMessage() throws RemoteException { final FingerprintAuthenticationClient client = createClient(); final int testVendorPowerPressCode = 1; when(mContext.getOrCreateTestableResources().getResources() .getBoolean(R.bool.config_powerPressMapping)).thenReturn(true); when(mContext.getOrCreateTestableResources().getResources() .getInteger(R.integer.config_powerPressCode)).thenReturn(testVendorPowerPressCode); client.onError(FINGERPRINT_ERROR_VENDOR, testVendorPowerPressCode); verify(mClientMonitorCallbackConverter).onError(anyInt(), anyInt(), eq(BiometricFingerprintConstants.BIOMETRIC_ERROR_POWER_PRESSED), anyInt()); } private void showHideOverlay(Consumer<FingerprintAuthenticationClient> block) throws RemoteException { final FingerprintAuthenticationClient client = createClient(); Loading Loading
core/res/res/values/config.xml +6 −0 Original line number Diff line number Diff line Loading @@ -6084,6 +6084,12 @@ different from the home screen wallpaper. --> <bool name="config_independentLockscreenLiveWallpaper">false</bool> <!-- Whether the vendor power press code need to be mapped. --> <bool name="config_powerPressMapping">false</bool> <!-- Power press vendor code. --> <integer name="config_powerPressCode">-1</integer> <!-- Whether to show weather on the lock screen by default. --> <bool name="config_lockscreenWeatherEnabledByDefault">false</bool> </resources>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2655,6 +2655,8 @@ <java-symbol type="integer" name="config_sideFpsToastTimeout"/> <java-symbol type="integer" name="config_sidefpsSkipWaitForPowerAcquireMessage"/> <java-symbol type="integer" name="config_sidefpsSkipWaitForPowerVendorAcquireMessage"/> <java-symbol type="integer" name="config_powerPressCode"/> <java-symbol type="bool" name="config_powerPressMapping"/> <!-- Clickable toast used during sidefps enrollment --> <java-symbol type="layout" name="side_fps_toast" /> Loading
services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java +10 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,16 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> @Override public void onError(int errorCode, int vendorCode) { if (getContext().getResources().getBoolean(R.bool.config_powerPressMapping) && errorCode == BiometricFingerprintConstants.FINGERPRINT_ERROR_VENDOR && vendorCode == getContext().getResources() .getInteger(R.integer.config_powerPressCode)) { // Translating vendor code to internal code super.onError(BiometricFingerprintConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0 /* vendorCode */); } else { super.onError(errorCode, vendorCode); } if (errorCode == BiometricFingerprintConstants.FINGERPRINT_ERROR_BAD_CALIBRATION) { BiometricNotificationUtils.showBadCalibrationNotification(getContext()); Loading
services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java +13 −5 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.os.RemoteException; import android.util.Slog; import android.view.accessibility.AccessibilityManager; import com.android.internal.R; import com.android.server.biometrics.HardwareAuthTokenUtils; import com.android.server.biometrics.log.BiometricContext; import com.android.server.biometrics.log.BiometricLogger; Loading Loading @@ -143,8 +144,18 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps } }); mCallback.onBiometricAction(BiometricStateListener.ACTION_SENSOR_TOUCH); if (getContext().getResources().getBoolean(R.bool.config_powerPressMapping) && acquiredInfo == BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_VENDOR && vendorCode == getContext().getResources() .getInteger(R.integer.config_powerPressCode)) { // Translating vendor code to internal code super.onAcquired(BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_POWER_PRESSED, 0 /* vendorCode */); } else { super.onAcquired(acquiredInfo, vendorCode); } } @Override public void onError(int errorCode, int vendorCode) { Loading Loading @@ -270,8 +281,5 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps } @Override public void onPowerPressed() { onAcquired(BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_POWER_PRESSED, 0 /* vendorCode */); } public void onPowerPressed() {} }
services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.biometrics.sensors.fingerprint.aidl; import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_VENDOR; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyBoolean; Loading @@ -35,6 +37,7 @@ import static org.mockito.Mockito.when; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.content.ComponentName; import android.hardware.biometrics.BiometricFingerprintConstants; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.common.ICancellationSignal; import android.hardware.biometrics.common.OperationContext; Loading @@ -54,6 +57,7 @@ import android.testing.TestableContext; import androidx.test.filters.SmallTest; import androidx.test.platform.app.InstrumentationRegistry; import com.android.internal.R; import com.android.server.biometrics.log.BiometricContext; import com.android.server.biometrics.log.BiometricLogger; import com.android.server.biometrics.log.CallbackWithProbe; Loading Loading @@ -335,6 +339,21 @@ public class FingerprintAuthenticationClientTest { showHideOverlay(c -> c.onLockoutPermanent()); } @Test public void testPowerPressForwardsErrorMessage() throws RemoteException { final FingerprintAuthenticationClient client = createClient(); final int testVendorPowerPressCode = 1; when(mContext.getOrCreateTestableResources().getResources() .getBoolean(R.bool.config_powerPressMapping)).thenReturn(true); when(mContext.getOrCreateTestableResources().getResources() .getInteger(R.integer.config_powerPressCode)).thenReturn(testVendorPowerPressCode); client.onError(FINGERPRINT_ERROR_VENDOR, testVendorPowerPressCode); verify(mClientMonitorCallbackConverter).onError(anyInt(), anyInt(), eq(BiometricFingerprintConstants.BIOMETRIC_ERROR_POWER_PRESSED), anyInt()); } private void showHideOverlay(Consumer<FingerprintAuthenticationClient> block) throws RemoteException { final FingerprintAuthenticationClient client = createClient(); Loading