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

Commit c402fe94 authored by Kevin Chyn's avatar Kevin Chyn Committed by Android (Google) Code Review
Browse files

Merge "Clean up biometric AIDL binderDied handling" into sc-dev

parents 4f5f93cb 77df3dff
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -643,8 +643,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
                final Sensor sensor = mSensors.valueAt(i);
                final int sensorId = mSensors.keyAt(i);
                PerformanceTracker.getInstanceForSensorId(sensorId).incrementHALDeathCount();
                sensor.getScheduler().recordCrashState();
                sensor.getScheduler().reset();
                sensor.onBinderDied();
            }
        });
    }
+16 −21
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.keymaster.HardwareAuthToken;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserManager;
import android.util.Slog;
@@ -63,7 +62,7 @@ import java.util.Map;
/**
 * Maintains the state of a single sensor within an instance of the {@link IFace} HAL.
 */
public class Sensor implements IBinder.DeathRecipient {
public class Sensor {

    private boolean mTestHalEnabled;

@@ -481,7 +480,6 @@ public class Sensor implements IBinder.DeathRecipient {
                mTag, mScheduler, sensorId, userId, callback);

        final ISession newSession = daemon.createSession(sensorId, userId, resultController);
        newSession.asBinder().linkToDeath(this, 0 /* flags */);
        mCurrentSession = new Session(mTag, newSession, userId, resultController);
    }

@@ -523,10 +521,7 @@ public class Sensor implements IBinder.DeathRecipient {
        proto.end(sensorToken);
    }

    @Override
    public void binderDied() {
        Slog.e(mTag, "Binder died");
        mHandler.post(() -> {
    public void onBinderDied() {
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        if (client instanceof Interruptable) {
            Slog.e(mTag, "Sending ERROR_HW_UNAVAILABLE for client: " + client);
@@ -534,13 +529,13 @@ public class Sensor implements IBinder.DeathRecipient {
            interruptable.onError(FaceManager.FACE_ERROR_HW_UNAVAILABLE,
                    0 /* vendorCode */);

                mScheduler.recordCrashState();

            FrameworkStatsLog.write(FrameworkStatsLog.BIOMETRIC_SYSTEM_HEALTH_ISSUE_DETECTED,
                    BiometricsProtoEnums.MODALITY_FACE,
                    BiometricsProtoEnums.ISSUE_HAL_DEATH);
                mCurrentSession = null;
        }
        });

        mScheduler.recordCrashState();
        mScheduler.reset();
        mCurrentSession = null;
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -697,8 +697,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
                final Sensor sensor = mSensors.valueAt(i);
                final int sensorId = mSensors.keyAt(i);
                PerformanceTracker.getInstanceForSensorId(sensorId).incrementHALDeathCount();
                sensor.getScheduler().recordCrashState();
                sensor.getScheduler().reset();
                sensor.onBinderDied();
            }
        });
    }
+16 −21
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.keymaster.HardwareAuthToken;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserManager;
import android.util.Slog;
@@ -65,7 +64,7 @@ import java.util.Map;
 * {@link android.hardware.biometrics.fingerprint.IFingerprint} HAL.
 */
@SuppressWarnings("deprecation")
class Sensor implements IBinder.DeathRecipient {
class Sensor {

    private boolean mTestHalEnabled;

@@ -461,7 +460,6 @@ class Sensor implements IBinder.DeathRecipient {
                mTag, mScheduler, sensorId, userId, callback);

        final ISession newSession = daemon.createSession(sensorId, userId, resultController);
        newSession.asBinder().linkToDeath(this, 0 /* flags */);
        mCurrentSession = new Session(mTag, newSession, userId, resultController);
    }

@@ -503,10 +501,7 @@ class Sensor implements IBinder.DeathRecipient {
        proto.end(sensorToken);
    }

    @Override
    public void binderDied() {
        Slog.e(mTag, "Binder died");
        mHandler.post(() -> {
    public void onBinderDied() {
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        if (client instanceof Interruptable) {
            Slog.e(mTag, "Sending ERROR_HW_UNAVAILABLE for client: " + client);
@@ -514,13 +509,13 @@ class Sensor implements IBinder.DeathRecipient {
            interruptable.onError(FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE,
                    0 /* vendorCode */);

                mScheduler.recordCrashState();

            FrameworkStatsLog.write(FrameworkStatsLog.BIOMETRIC_SYSTEM_HEALTH_ISSUE_DETECTED,
                    BiometricsProtoEnums.MODALITY_FINGERPRINT,
                    BiometricsProtoEnums.ISSUE_HAL_DEATH);
                mCurrentSession = null;
        }
        });

        mScheduler.recordCrashState();
        mScheduler.reset();
        mCurrentSession = null;
    }
}