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

Commit 171d610c authored by Kevin Chyn's avatar Kevin Chyn Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13521369

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I648e4e387eb79f1651af53eba7707e8f20872442
parents 6333321e c402fe94
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -643,8 +643,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
                final Sensor sensor = mSensors.valueAt(i);
                final Sensor sensor = mSensors.valueAt(i);
                final int sensorId = mSensors.keyAt(i);
                final int sensorId = mSensors.keyAt(i);
                PerformanceTracker.getInstanceForSensorId(sensorId).incrementHALDeathCount();
                PerformanceTracker.getInstanceForSensorId(sensorId).incrementHALDeathCount();
                sensor.getScheduler().recordCrashState();
                sensor.onBinderDied();
                sensor.getScheduler().reset();
            }
            }
        });
        });
    }
    }
+16 −21
Original line number Original line Diff line number Diff line
@@ -33,7 +33,6 @@ import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.keymaster.HardwareAuthToken;
import android.hardware.keymaster.HardwareAuthToken;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.UserManager;
import android.os.UserManager;
import android.util.Slog;
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.
 * 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;
    private boolean mTestHalEnabled;


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


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


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


    @Override
    public void onBinderDied() {
    public void binderDied() {
        Slog.e(mTag, "Binder died");
        mHandler.post(() -> {
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        if (client instanceof Interruptable) {
        if (client instanceof Interruptable) {
            Slog.e(mTag, "Sending ERROR_HW_UNAVAILABLE for client: " + client);
            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,
            interruptable.onError(FaceManager.FACE_ERROR_HW_UNAVAILABLE,
                    0 /* vendorCode */);
                    0 /* vendorCode */);


                mScheduler.recordCrashState();

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

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


    private boolean mTestHalEnabled;
    private boolean mTestHalEnabled;


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


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


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


    @Override
    public void onBinderDied() {
    public void binderDied() {
        Slog.e(mTag, "Binder died");
        mHandler.post(() -> {
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        if (client instanceof Interruptable) {
        if (client instanceof Interruptable) {
            Slog.e(mTag, "Sending ERROR_HW_UNAVAILABLE for client: " + client);
            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,
            interruptable.onError(FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE,
                    0 /* vendorCode */);
                    0 /* vendorCode */);


                mScheduler.recordCrashState();

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

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