Merge "Updated power press strings in enrollment." into tm-qpr-dev am: ce1e8cee95

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19889941

Change-Id: I72eb5f366a5277378eb7f5790a109cc4f02696e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Joshua Mccloskey
2022-09-13 23:35:23 +00:00
committed by Automerger Merge Worker
7 changed files with 39 additions and 5 deletions

View File

@@ -217,7 +217,8 @@ public interface BiometricFingerprintConstants {
FINGERPRINT_ACQUIRED_START,
FINGERPRINT_ACQUIRED_UNKNOWN,
FINGERPRINT_ACQUIRED_IMMOBILE,
FINGERPRINT_ACQUIRED_TOO_BRIGHT})
FINGERPRINT_ACQUIRED_TOO_BRIGHT,
FINGERPRINT_ACQUIRED_POWER_PRESSED})
@Retention(RetentionPolicy.SOURCE)
@interface FingerprintAcquired {}
@@ -301,6 +302,13 @@ public interface BiometricFingerprintConstants {
*/
int FINGERPRINT_ACQUIRED_TOO_BRIGHT = 10;
/**
* For sensors that have the power button co-located with their sensor, this event will
* be sent during enrollment.
* @hide
*/
int FINGERPRINT_ACQUIRED_POWER_PRESSED = 11;
/**
* @hide
*/

View File

@@ -1538,6 +1538,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
case FINGERPRINT_ACQUIRED_TOO_BRIGHT:
return context.getString(
com.android.internal.R.string.fingerprint_acquired_too_bright);
case FINGERPRINT_ACQUIRED_POWER_PRESSED:
return context.getString(
com.android.internal.R.string.fingerprint_acquired_power_press);
case FINGERPRINT_ACQUIRED_VENDOR: {
String[] msgArray = context.getResources().getStringArray(
com.android.internal.R.array.fingerprint_acquired_vendor);

View File

@@ -1696,6 +1696,8 @@
<string name="fingerprint_acquired_already_enrolled">Try another fingerprint</string>
<!-- Message shown during fingerprint acquisition when fingerprint sensor detected too much light.[CHAR LIMIT=50] -->
<string name="fingerprint_acquired_too_bright">Too bright</string>
<!-- Message shown during fingerprint acquisition when a Power press has been detected.[CHAR LIMIT=50] -->
<string name="fingerprint_acquired_power_press">Power press detected</string>
<!-- Message shown during fingerprint acquisition when a fingerprint must be adjusted.[CHAR LIMIT=50] -->
<string name="fingerprint_acquired_try_adjusting">Try adjusting</string>
<!-- Message shown during fingerprint acquisition when a fingeprint area has already been captured during enrollment [CHAR LIMIT=100] -->
@@ -3562,11 +3564,11 @@
<!-- [CHAR LIMIT=40] Title of dialog shown to confirm device going to sleep if the power button
is pressed during fingerprint enrollment. -->
<string name="fp_power_button_enrollment_title">Tap to turn off screen</string>
<string name="fp_power_button_enrollment_title">To end setup, turn off screen</string>
<!-- [CHAR LIMIT=20] Positive button of dialog shown to confirm device going to sleep if the
power button is pressed during fingerprint enrollment. -->
<string name="fp_power_button_enrollment_button_text">Turn off screen</string>
<string name="fp_power_button_enrollment_button_text">Turn off</string>
<!-- [CHAR LIMIT=40] Title of dialog shown to confirm device going to sleep if the power button
is pressed during biometric prompt when a side fingerprint sensor is present. -->

View File

@@ -2601,6 +2601,7 @@
<java-symbol type="string" name="fingerprint_acquired_imager_dirty" />
<java-symbol type="string" name="fingerprint_acquired_too_slow" />
<java-symbol type="string" name="fingerprint_acquired_too_fast" />
<java-symbol type="string" name="fingerprint_acquired_power_press" />
<java-symbol type="string" name="fingerprint_acquired_too_bright" />
<java-symbol type="array" name="fingerprint_acquired_vendor" />
<java-symbol type="string" name="fingerprint_error_canceled" />

View File

@@ -59,7 +59,7 @@ public class ClientMonitorCallbackConverter {
// The following apply to all clients
void onAcquired(int sensorId, int acquiredInfo, int vendorCode) throws RemoteException {
public void onAcquired(int sensorId, int acquiredInfo, int vendorCode) throws RemoteException {
if (mSensorReceiver != null) {
mSensorReceiver.onAcquired(sensorId, acquiredInfo, vendorCode);
} else if (mFaceServiceReceiver != null) {

View File

@@ -50,12 +50,14 @@ import com.android.server.biometrics.sensors.ClientMonitorCompositeCallback;
import com.android.server.biometrics.sensors.EnrollClient;
import com.android.server.biometrics.sensors.SensorOverlays;
import com.android.server.biometrics.sensors.fingerprint.FingerprintUtils;
import com.android.server.biometrics.sensors.fingerprint.PowerPressHandler;
import com.android.server.biometrics.sensors.fingerprint.Udfps;
import com.android.server.biometrics.sensors.fingerprint.UdfpsHelper;
import java.util.function.Supplier;
class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps {
class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps,
PowerPressHandler {
private static final String TAG = "FingerprintEnrollClient";
@@ -266,4 +268,10 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps
Slog.e(TAG, "Unable to send UI ready", e);
}
}
@Override
public void onPowerPressed() {
onAcquired(BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_POWER_PRESSED,
0 /* vendorCode */);
}
}

View File

@@ -16,6 +16,8 @@
package com.android.server.biometrics.sensors.fingerprint.aidl;
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_POWER_PRESSED;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -253,6 +255,16 @@ public class FingerprintEnrollClientTest {
showHideOverlay(c -> c.onEnrollResult(new Fingerprint("", 1, 1), 0));
}
@Test
public void testPowerPressForwardsAcquireMessage() throws RemoteException {
final FingerprintEnrollClient client = createClient();
client.start(mCallback);
client.onPowerPressed();
verify(mClientMonitorCallbackConverter).onAcquired(anyInt(),
eq(FINGERPRINT_ACQUIRED_POWER_PRESSED), anyInt());
}
private void showHideOverlay(Consumer<FingerprintEnrollClient> block)
throws RemoteException {
final FingerprintEnrollClient client = createClient();