diff options
| author | 2018-09-02 05:56:32 +0000 | |
|---|---|---|
| committer | 2018-09-02 05:56:32 +0000 | |
| commit | deb136b00abd5532a5151fde61c578d3f28f5da6 (patch) | |
| tree | 033b7c22c3ee9fc98027e2d61b9dec23952b152c | |
| parent | 6410e2c551133912689d711df5050a68cc27ce6e (diff) | |
| parent | 5a2ff5d7a2163aaacbe099a4d9a5cb73d35b7aa4 (diff) | |
Merge "Send authentication type from AuthenticationClient to BiometricDialog"
14 files changed, 108 insertions, 63 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricAuthenticator.java b/core/java/android/hardware/biometrics/BiometricAuthenticator.java index 59195dc903f7..dbb25276dd97 100644 --- a/core/java/android/hardware/biometrics/BiometricAuthenticator.java +++ b/core/java/android/hardware/biometrics/BiometricAuthenticator.java @@ -30,6 +30,21 @@ import java.util.concurrent.Executor; public interface BiometricAuthenticator { /** + * @hide + */ + int TYPE_FINGERPRINT = 1; + + /** + * @hide + */ + int TYPE_IRIS = 2; + + /** + * @hide + */ + int TYPE_FACE = 3; + + /** * Container for biometric data * @hide */ @@ -196,6 +211,22 @@ public interface BiometricAuthenticator { } /** + * @param acquireInfo + * @param vendorCode + * @return the help string associated with this code + */ + default String getAcquiredString(int acquireInfo, int vendorCode) { + throw new UnsupportedOperationException("Stub!"); + } + + /** + * @return one of {@link #TYPE_FINGERPRINT} {@link #TYPE_IRIS} or {@link #TYPE_FACE} + */ + default int getType() { + throw new UnsupportedOperationException("Stub!"); + } + + /** * This call warms up the hardware and starts scanning for valid biometrics. It terminates * when {@link AuthenticationCallback#onAuthenticationError(int, * CharSequence)} is called or when {@link AuthenticationCallback#onAuthenticationSucceeded( diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java index b3b962f0aca8..0f83c8bb5e67 100644 --- a/core/java/android/hardware/face/FaceManager.java +++ b/core/java/android/hardware/face/FaceManager.java @@ -552,6 +552,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan /** * @hide */ + @Override public String getAcquiredString(int acquireInfo, int vendorCode) { switch (acquireInfo) { case FACE_ACQUIRED_GOOD: @@ -591,6 +592,14 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } /** + * @hide + */ + @Override + public int getType() { + return TYPE_FACE; + } + + /** * Used so BiometricPrompt can map the face ones onto existing public constants. * @hide */ diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java index 44b8faf0509c..b380a2e08c8a 100644 --- a/core/java/android/hardware/fingerprint/FingerprintManager.java +++ b/core/java/android/hardware/fingerprint/FingerprintManager.java @@ -979,6 +979,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing /** * @hide */ + @Override public String getAcquiredString(int acquireInfo, int vendorCode) { switch (acquireInfo) { case FINGERPRINT_ACQUIRED_GOOD: @@ -1010,6 +1011,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing return null; } + /** + * @hide + */ + @Override + public int getType() { + return TYPE_FINGERPRINT; + } + private IFingerprintServiceReceiver mServiceReceiver = new IFingerprintServiceReceiver.Stub() { @Override // binder call diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 616520f4e2b1..c4214cf19fa9 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -141,7 +141,7 @@ oneway interface IStatusBar void showShutdownUi(boolean isReboot, String reason); // Used to show the dialog when BiometricService starts authentication - void showBiometricDialog(in Bundle bundle, IBiometricPromptReceiver receiver); + void showBiometricDialog(in Bundle bundle, IBiometricPromptReceiver receiver, int type); // Used to hide the dialog when a biometric is authenticated void onBiometricAuthenticated(); // Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index b3af147063d0..e48e73305191 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -91,7 +91,7 @@ interface IStatusBarService void showPinningEscapeToast(); // Used to show the dialog when BiometricService starts authentication - void showBiometricDialog(in Bundle bundle, IBiometricPromptReceiver receiver); + void showBiometricDialog(in Bundle bundle, IBiometricPromptReceiver receiver, int type); // Used to hide the dialog when a biometric is authenticated void onBiometricAuthenticated(); // Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index e3b9052654d0..d73320751e79 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1414,8 +1414,8 @@ <string-array name="fingerprint_acquired_vendor"> </string-array> - <!-- Message shown by the fingerprint dialog when fingerprint is not recognized --> - <string name="fingerprint_not_recognized">Not recognized</string> + <!-- Message shown by the biometric dialog when biometric is not recognized --> + <string name="biometric_not_recognized">Not recognized</string> <!-- Accessibility message announced when a fingerprint has been authenticated [CHAR LIMIT=NONE] --> <string name="fingerprint_authenticated">Fingerprint authenticated</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b82f9e5dd0de..e20998579b94 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2394,6 +2394,7 @@ <!-- Biometric messages --> <java-symbol type="string" name="biometric_error_hw_unavailable" /> + <java-symbol type="string" name="biometric_not_recognized" /> <!-- Fingerprint messages --> <java-symbol type="string" name="fingerprint_error_unable_to_process" /> @@ -2412,7 +2413,6 @@ <java-symbol type="string" name="fingerprint_error_lockout" /> <java-symbol type="string" name="fingerprint_error_lockout_permanent" /> <java-symbol type="string" name="fingerprint_name_template" /> - <java-symbol type="string" name="fingerprint_not_recognized" /> <java-symbol type="string" name="fingerprint_authenticated" /> <java-symbol type="string" name="fingerprint_error_no_fingerprints" /> <java-symbol type="string" name="fingerprint_error_hw_not_present" /> diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java index 6e62b0d575a2..8fe577a4cec0 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java @@ -36,7 +36,7 @@ import com.android.systemui.statusbar.CommandQueue; * FingerprintDialogView). */ public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callbacks { - private static final String TAG = "FingerprintDialogImpl"; + private static final String TAG = "BiometricDialogImpl"; private static final boolean DEBUG = true; private static final int MSG_SHOW_DIALOG = 1; @@ -120,8 +120,8 @@ public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callba } @Override - public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver) { - if (DEBUG) Log.d(TAG, "showBiometricDialog"); + public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver, int type) { + if (DEBUG) Log.d(TAG, "showBiometricDialog, type: " + type); // Remove these messages as they are part of the previous client mHandler.removeMessages(MSG_BIOMETRIC_ERROR); mHandler.removeMessages(MSG_BIOMETRIC_HELP); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 909cd794f3fe..e19c8441c44d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -160,7 +160,8 @@ public class CommandQueue extends IStatusBar.Stub { default void onRotationProposal(int rotation, boolean isValid) { } - default void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver) { } + default void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver, + int type) { } default void onBiometricAuthenticated() { } default void onBiometricHelp(String message) { } default void onBiometricError(String error) { } @@ -513,11 +514,12 @@ public class CommandQueue extends IStatusBar.Stub { } @Override - public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver) { + public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver, int type) { synchronized (mLock) { SomeArgs args = SomeArgs.obtain(); args.arg1 = bundle; args.arg2 = receiver; + args.argi1 = type; mHandler.obtainMessage(MSG_BIOMETRIC_SHOW, args) .sendToTarget(); } @@ -756,11 +758,14 @@ public class CommandQueue extends IStatusBar.Stub { mHandler.removeMessages(MSG_BIOMETRIC_ERROR); mHandler.removeMessages(MSG_BIOMETRIC_HELP); mHandler.removeMessages(MSG_BIOMETRIC_AUTHENTICATED); + SomeArgs someArgs = (SomeArgs) msg.obj; for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).showBiometricDialog( - (Bundle)((SomeArgs)msg.obj).arg1, - (IBiometricPromptReceiver)((SomeArgs)msg.obj).arg2); + (Bundle) someArgs.arg1, + (IBiometricPromptReceiver) someArgs.arg2, + someArgs.argi1); } + someArgs.recycle(); break; case MSG_BIOMETRIC_AUTHENTICATED: for (int i = 0; i < mCallbacks.size(); i++) { diff --git a/services/core/java/com/android/server/biometrics/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/AuthenticationClient.java index 06462a2dcd5a..36e7cba9c818 100644 --- a/services/core/java/com/android/server/biometrics/AuthenticationClient.java +++ b/services/core/java/com/android/server/biometrics/AuthenticationClient.java @@ -21,7 +21,6 @@ import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.biometrics.BiometricConstants; import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.IBiometricPromptReceiver; -import android.hardware.fingerprint.FingerprintManager; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -45,17 +44,16 @@ public abstract class AuthenticationClient extends ClientMonitor { public static final int LOCKOUT_TIMED = 1; public static final int LOCKOUT_PERMANENT = 2; + private final BiometricAuthenticator mAuthenticator; // Callback mechanism received from the client - // (BiometricPrompt -> FingerprintManager -> FingerprintService -> AuthenticationClient) + // (BiometricPrompt -> BiometricPromptService -> <Biometric>Service -> AuthenticationClient) private IBiometricPromptReceiver mDialogReceiverFromClient; private Bundle mBundle; private IStatusBarService mStatusBarService; private boolean mInLockout; - // TODO: BiometricManager, after other biometric modalities are introduced. - private final FingerprintManager mFingerprintManager; protected boolean mDialogDismissed; - // Receives events from SystemUI and handles them before forwarding them to FingerprintDialog + // Receives events from SystemUI and handles them before forwarding them to BiometricDialog protected IBiometricPromptReceiver mDialogReceiver = new IBiometricPromptReceiver.Stub() { @Override // binder call public void onDialogDismissed(int reason) { @@ -81,7 +79,7 @@ public abstract class AuthenticationClient extends ClientMonitor { public abstract void onStart(); /** - * This method is called when a fingerprint is authenticated or authentication is stopped + * This method is called when a biometric is authenticated or authentication is stopped * (cancelled by the user, or an error such as lockout has occurred). */ public abstract void onStop(); @@ -90,15 +88,15 @@ public abstract class AuthenticationClient extends ClientMonitor { BiometricService.DaemonWrapper daemon, long halDeviceId, IBinder token, BiometricService.ServiceListener listener, int targetUserId, int groupId, long opId, boolean restricted, String owner, Bundle bundle, - IBiometricPromptReceiver dialogReceiver, IStatusBarService statusBarService) { + IBiometricPromptReceiver dialogReceiver, IStatusBarService statusBarService, + BiometricAuthenticator authenticator) { super(context, metrics, daemon, halDeviceId, token, listener, targetUserId, groupId, restricted, owner); mOpId = opId; mBundle = bundle; mDialogReceiverFromClient = dialogReceiver; mStatusBarService = statusBarService; - mFingerprintManager = (FingerprintManager) getContext() - .getSystemService(Context.FINGERPRINT_SERVICE); + mAuthenticator = authenticator; mHandler = new Handler(Looper.getMainLooper()); } @@ -118,7 +116,7 @@ public abstract class AuthenticationClient extends ClientMonitor { try { if (acquiredInfo != BiometricConstants.BIOMETRIC_ACQUIRED_GOOD) { mStatusBarService.onBiometricHelp( - mFingerprintManager.getAcquiredString(acquiredInfo, vendorCode)); + mAuthenticator.getAcquiredString(acquiredInfo, vendorCode)); } return false; // acquisition continues } catch (RemoteException e) { @@ -139,15 +137,15 @@ public abstract class AuthenticationClient extends ClientMonitor { public boolean onError(long deviceId, int error, int vendorCode) { if (mDialogDismissed) { // If user cancels authentication, the application has already received the - // FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED message from onDialogDismissed() - // and stopped the fingerprint hardware, so there is no need to send a - // FingerprintManager.FINGERPRINT_ERROR_CANCELED message. + // ERROR_USER_CANCELED message from onDialogDismissed() + // and stopped the biometric hardware, so there is no need to send a + // ERROR_CANCELED message. return true; } if (mBundle != null) { try { mStatusBarService.onBiometricError( - mFingerprintManager.getErrorString(error, vendorCode)); + mAuthenticator.getErrorString(error, vendorCode)); } catch (RemoteException e) { Slog.e(getLogTag(), "Remote exception when sending error", e); } @@ -160,15 +158,14 @@ public abstract class AuthenticationClient extends ClientMonitor { boolean authenticated) { boolean result = false; - // If the fingerprint dialog is showing, notify authentication succeeded - // TODO: this goes to BiometricPrompt, split between biometric modalities + // If the biometric dialog is showing, notify authentication succeeded if (mBundle != null) { try { if (authenticated) { mStatusBarService.onBiometricAuthenticated(); } else { mStatusBarService.onBiometricHelp(getContext().getResources().getString( - com.android.internal.R.string.fingerprint_not_recognized)); + com.android.internal.R.string.biometric_not_recognized)); } } catch (RemoteException e) { Slog.e(getLogTag(), "Failed to notify Authenticated:", e); @@ -223,7 +220,7 @@ public abstract class AuthenticationClient extends ClientMonitor { // Send the lockout message to the system dialog if (mBundle != null) { mStatusBarService.onBiometricError( - mFingerprintManager.getErrorString(errorCode, 0 /* vendorCode */)); + mAuthenticator.getErrorString(errorCode, 0 /* vendorCode */)); mHandler.postDelayed(() -> { try { listener.onError(getHalDeviceId(), errorCode, 0 /* vendorCode */); @@ -243,7 +240,7 @@ public abstract class AuthenticationClient extends ClientMonitor { if (listener != null) { vibrateSuccess(); } - result |= true; // we have a valid fingerprint, done + result |= true; // we have a valid biometric, done resetFailedAttempts(); onStop(); } @@ -270,9 +267,10 @@ public abstract class AuthenticationClient extends ClientMonitor { // If authenticating with system dialog, show the dialog if (mBundle != null) { try { - mStatusBarService.showBiometricDialog(mBundle, mDialogReceiver); + mStatusBarService.showBiometricDialog(mBundle, mDialogReceiver, + mAuthenticator.getType()); } catch (RemoteException e) { - Slog.e(getLogTag(), "Unable to show fingerprint dialog", e); + Slog.e(getLogTag(), "Unable to show biometric dialog", e); } } } catch (RemoteException e) { @@ -297,7 +295,8 @@ public abstract class AuthenticationClient extends ClientMonitor { Slog.w(getLogTag(), "stopAuthentication failed, result=" + result); return result; } - if (DEBUG) Slog.w(getLogTag(), "client " + getOwnerString() + " is no longer authenticating"); + if (DEBUG) Slog.w(getLogTag(), "client " + getOwnerString() + + " is no longer authenticating"); } catch (RemoteException e) { Slog.e(getLogTag(), "stopAuthentication failed", e); return ERROR_ESRCH; @@ -310,7 +309,7 @@ public abstract class AuthenticationClient extends ClientMonitor { try { mStatusBarService.hideBiometricDialog(); } catch (RemoteException e) { - Slog.e(getLogTag(), "Unable to hide fingerprint dialog", e); + Slog.e(getLogTag(), "Unable to hide biometric dialog", e); } } } diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java index cc2e81ff4306..a181b6105471 100644 --- a/services/core/java/com/android/server/biometrics/BiometricService.java +++ b/services/core/java/com/android/server/biometrics/BiometricService.java @@ -47,6 +47,7 @@ import android.os.IHwBinder; import android.os.IRemoteCallback; import android.os.PowerManager; import android.os.RemoteException; +import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; @@ -96,6 +97,7 @@ public abstract class BiometricService extends SystemService implements IHwBinde private final LockoutReceiver mLockoutReceiver = new LockoutReceiver(); private final ArrayList<LockoutResetMonitor> mLockoutMonitors = new ArrayList<>(); + protected final IStatusBarService mStatusBarService; protected final Map<Integer, Long> mAuthenticatorIds = Collections.synchronizedMap(new HashMap<>()); protected final ResetFailedAttemptsForUserRunnable mResetFailedAttemptsForCurrentUserRunnable = @@ -221,10 +223,10 @@ public abstract class BiometricService extends SystemService implements IHwBinde IBinder token, ServiceListener listener, int targetUserId, int groupId, long opId, boolean restricted, String owner, Bundle bundle, IBiometricPromptReceiver dialogReceiver, - IStatusBarService statusBarService) { + IStatusBarService statusBarService, BiometricAuthenticator authenticator) { super(context, getMetrics(), daemon, halDeviceId, token, listener, targetUserId, groupId, opId, restricted, owner, bundle, dialogReceiver, - statusBarService); + statusBarService, authenticator); } @Override @@ -524,6 +526,8 @@ public abstract class BiometricService extends SystemService implements IHwBinde public BiometricService(Context context) { super(context); mContext = context; + mStatusBarService = IStatusBarService.Stub.asInterface( + ServiceManager.getService(Context.STATUS_BAR_SERVICE)); mKeyguardPackage = ComponentName.unflattenFromString(context.getResources().getString( com.android.internal.R.string.config_keyguardComponent)).getPackageName(); mAppOps = context.getSystemService(AppOpsManager.class); diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java index 2e76406489fe..f211e1716d13 100644 --- a/services/core/java/com/android/server/biometrics/face/FaceService.java +++ b/services/core/java/com/android/server/biometrics/face/FaceService.java @@ -42,7 +42,6 @@ import android.os.Environment; import android.os.IBinder; import android.os.RemoteException; import android.os.SELinux; -import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.util.Slog; @@ -50,7 +49,6 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.GuardedBy; import com.android.internal.logging.MetricsLogger; -import com.android.internal.statusbar.IStatusBarService; import com.android.internal.util.DumpUtils; import com.android.server.SystemServerInitThreadPool; import com.android.server.biometrics.BiometricService; @@ -133,7 +131,7 @@ public class FaceService extends BiometricService { final AuthenticationClientImpl client = new AuthenticationClientImpl(getContext(), mDaemonWrapper, mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId, 0 /* groupId */, opId, restricted, opPackageName, - null /* bundle */, null /* dialogReceiver */, mStatusBarService); + null /* bundle */, null /* dialogReceiver */, mStatusBarService, mFaceManager); authenticateInternal(client, opId, opPackageName); } @@ -149,7 +147,7 @@ public class FaceService extends BiometricService { mDaemonWrapper, mHalDeviceId, token, new BiometricPromptServiceListenerImpl(receiver), mCurrentUserId, 0 /* groupId */, opId, restricted, opPackageName, - bundle, dialogReceiver, mStatusBarService); + bundle, dialogReceiver, mStatusBarService, mFaceManager); authenticateInternal(client, opId, opPackageName, callingUid, callingPid, callingUserId); } @@ -326,13 +324,10 @@ public class FaceService extends BiometricService { */ private class BiometricPromptServiceListenerImpl implements ServiceListener { - // Use FaceManager to get strings, so BiometricPrompt interface is cleaner - private FaceManager mFaceManager; private IBiometricPromptServiceReceiver mBiometricPromptServiceReceiver; public BiometricPromptServiceListenerImpl(IBiometricPromptServiceReceiver receiver) { mBiometricPromptServiceReceiver = receiver; - mFaceManager = (FaceManager) getContext().getSystemService(Context.FACE_SERVICE); } @Override @@ -451,9 +446,9 @@ public class FaceService extends BiometricService { @GuardedBy("this") private IBiometricsFace mDaemon; - private long mHalDeviceId; - private IStatusBarService mStatusBarService; + // Use FaceManager to get strings, so BiometricPrompt interface is cleaner + private FaceManager mFaceManager; /** * Receives callbacks from the HAL. @@ -586,15 +581,14 @@ public class FaceService extends BiometricService { public FaceService(Context context) { super(context); - // TODO: can this be retrieved from AuthenticationClient, or BiometricService? - mStatusBarService = IStatusBarService.Stub.asInterface( - ServiceManager.getService(Context.STATUS_BAR_SERVICE)); } @Override public void onStart() { + super.onStart(); publishBinderService(Context.FACE_SERVICE, new FaceServiceWrapper()); SystemServerInitThreadPool.get().submit(this::getFaceDaemon, TAG + ".onStart"); + mFaceManager = (FaceManager) getContext().getSystemService(Context.FACE_SERVICE); } @Override diff --git a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java index a25b4b4bdf05..95fb9e33dded 100644 --- a/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/biometrics/fingerprint/FingerprintService.java @@ -47,7 +47,6 @@ import android.os.Environment; import android.os.IBinder; import android.os.RemoteException; import android.os.SELinux; -import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.util.Slog; @@ -55,7 +54,6 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.GuardedBy; import com.android.internal.logging.MetricsLogger; -import com.android.internal.statusbar.IStatusBarService; import com.android.internal.util.DumpUtils; import com.android.server.SystemServerInitThreadPool; import com.android.server.biometrics.BiometricService; @@ -154,7 +152,7 @@ public class FingerprintService extends BiometricService { final AuthenticationClientImpl client = new AuthenticationClientImpl(getContext(), mDaemonWrapper, mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId, groupId, opId, restricted, opPackageName, null /* bundle */, - null /* dialogReceiver */, mStatusBarService); + null /* dialogReceiver */, mStatusBarService, mFingerprintManager); authenticateInternal(client, opId, opPackageName); } @@ -170,7 +168,7 @@ public class FingerprintService extends BiometricService { mDaemonWrapper, mHalDeviceId, token, new BiometricPromptServiceListenerImpl(receiver), mCurrentUserId, groupId, opId, restricted, opPackageName, bundle, - dialogReceiver, mStatusBarService); + dialogReceiver, mStatusBarService, mFingerprintManager); authenticateInternal(client, opId, opPackageName, callingUid, callingPid, callingUserId); } @@ -362,14 +360,10 @@ public class FingerprintService extends BiometricService { */ private class BiometricPromptServiceListenerImpl implements ServiceListener { - // Use FingerprintManager to get strings, so BiometricPrompt interface is cleaner - private FingerprintManager mFingerprintManager; private IBiometricPromptServiceReceiver mBiometricPromptServiceReceiver; public BiometricPromptServiceListenerImpl(IBiometricPromptServiceReceiver receiver) { mBiometricPromptServiceReceiver = receiver; - mFingerprintManager = (FingerprintManager) - getContext().getSystemService(Context.FINGERPRINT_SERVICE); } @Override @@ -571,9 +565,10 @@ public class FingerprintService extends BiometricService { private IBiometricsFingerprint mDaemon; private long mHalDeviceId; - private IStatusBarService mStatusBarService; private IBinder mToken = new Binder(); // used for internal FingerprintService enumeration private ArrayList<UserFingerprint> mUnknownFingerprints = new ArrayList<>(); // hw fingerprints + // Use FingerprintManager to get strings, so BiometricPrompt interface is cleaner. + private FingerprintManager mFingerprintManager; /** * Receives callbacks from the HAL. @@ -715,9 +710,6 @@ public class FingerprintService extends BiometricService { public FingerprintService(Context context) { super(context); - // TODO: can this be retrieved from AuthenticationClient, or BiometricService? - mStatusBarService = IStatusBarService.Stub.asInterface( - ServiceManager.getService(Context.STATUS_BAR_SERVICE)); } @Override @@ -725,6 +717,8 @@ public class FingerprintService extends BiometricService { super.onStart(); publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper()); SystemServerInitThreadPool.get().submit(this::getFingerprintDaemon, TAG + ".onStart"); + mFingerprintManager = (FingerprintManager) + getContext().getSystemService(Context.FINGERPRINT_SERVICE); } @Override diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index b8c9be777fef..14294ec54ef1 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -565,10 +565,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub { } @Override - public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver) { + public void showBiometricDialog(Bundle bundle, IBiometricPromptReceiver receiver, int type) { if (mBar != null) { try { - mBar.showBiometricDialog(bundle, receiver); + mBar.showBiometricDialog(bundle, receiver, type); } catch (RemoteException ex) { } } |