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
This commit is contained in:
Jim Miller
2017-01-24 14:47:04 -08:00
parent 3416cc2800
commit a8eaeeb754

View File

@@ -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);
}
});
}