Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa716488 authored by Carlo Savignano's avatar Carlo Savignano Committed by Paul Keith
Browse files

fingerprint: notify client when cancelling succeeded



* Some fingerprint hardware hals might not notify userspace in time
  in some scenarios when successful authentication cancel is performed.
* This is observed for example in some devices that have power and/or home
  buttons merged with fingerprint sensor, but not limited to such cases.
* Add a opt-in configuration to enable client authentication cancel from
  fingerprint service when successful.
* This addresses originally an issue where requesting fingerprint to be
  disabled and then enabled will wait till cancelling timeout before changing
  fingerprint sensor state and start authenticating again.

Change-Id: I6a6795fbb795f0c6a4ff8ad27ac807e2f744c2d9
Signed-off-by: default avatarCarlo Savignano <carlosavignano@aospa.co>
parent 9c1d747d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -37,4 +37,7 @@
    <!-- Button backlight -->
    <integer name="config_buttonBrightnessSettingDefault">255</integer>
    <bool name="config_deviceHasVariableButtonBrightness">false</bool>

    <!-- Whether notify fingerprint client of successful cancelled authentication -->
    <bool name="config_notifyClientOnFingerprintCancelSuccess">false</bool>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -57,4 +57,7 @@
    <java-symbol type="layout" name="permission_confirmation_dialog" />
    <java-symbol type="array" name="app_ops_labels" />
    <java-symbol type="string" name="status_bar_su" />

    <!-- Whether notify fingerprint client of successful cancelled authentication -->
    <java-symbol type="bool" name="config_notifyClientOnFingerprintCancelSuccess" />
</resources>
+8 −1
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
    private ClientMonitor mCurrentClient;
    private ClientMonitor mPendingClient;
    private PerformanceStats mPerformanceStats;
    private final boolean mNotifyClient;


    private IBinder mToken = new Binder(); // used for internal FingerprintService enumeration
@@ -221,6 +222,8 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
        mContext.registerReceiver(mLockoutReceiver, new IntentFilter(ACTION_LOCKOUT_RESET),
                RESET_FINGERPRINT_LOCKOUT, null /* handler */);
        mUserManager = UserManager.get(mContext);
        mNotifyClient = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_notifyClientOnFingerprintCancelSuccess);
    }

    @Override
@@ -1135,7 +1138,11 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
                    if (client instanceof AuthenticationClient) {
                        if (client.getToken() == token) {
                            if (DEBUG) Slog.v(TAG, "stop client " + client.getOwnerString());
                            client.stop(client.getToken() == token);
                            final int stopResult = client.stop(client.getToken() == token);
                            if (mNotifyClient && (stopResult == 0)) {
                                handleError(mHalDeviceId,
                                        FingerprintManager.FINGERPRINT_ERROR_CANCELED, 0);
                            }
                        } else {
                            if (DEBUG) Slog.v(TAG, "can't stop client "
                                    + client.getOwnerString() + " since tokens don't match");