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

Commit a8eaeeb7 authored by Jim Miller's avatar Jim Miller
Browse files

Remove binder call from fingerprint HIDL interface.

The code used to call Keystore.addAuthToken() directly from the HAL layer.
This change propagates the byte stream to the framework which then forwards
it to KeyStore.

Test: recovers from killing keystore, fingerprint unlocks device,
FingerprintDialog works with crypto objects.

Fixes bug 34264028

Change-Id: I378c183618e29681526958b5468e530bb603f688
parent 3416cc28
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.IHwBinder;
import android.os.IRemoteCallback;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.security.KeyStore;
import android.os.RemoteException;
import android.os.SELinux;
import android.os.SystemClock;
@@ -63,7 +64,6 @@ import org.json.JSONObject;

import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprintClientCallback;

import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.IFingerprintService;
@@ -276,8 +276,18 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
        }
    }

    protected void handleAuthenticated(long deviceId, int fingerId, int groupId) {
    protected void handleAuthenticated(long deviceId, int fingerId, int groupId,
            ArrayList<Byte> token) {
        ClientMonitor client = mCurrentClient;
        if (fingerId != 0) {
            // Ugh...
            final byte[] byteToken = new byte[token.size()];
            for (int i = 0; i < token.size(); i++) {
                byteToken[i] = token.get(i);
            }
            // Send to Keystore
            KeyStore.getInstance().addAuthToken(byteToken);
        }
        if (client != null && client.onAuthenticated(fingerId, groupId)) {
            removeClient(client);
        }
@@ -721,11 +731,12 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
        }

        @Override
        public void onAuthenticated(final long deviceId, final int fingerId, final int groupId) {
        public void onAuthenticated(final long deviceId, final int fingerId, final int groupId,
                ArrayList<Byte> token) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    handleAuthenticated(deviceId, fingerId, groupId);
                    handleAuthenticated(deviceId, fingerId, groupId, token);
                }
            });
        }