Add null check before invoking onChallengeInterruptFinished

It's possible that the previous client's owner has died (binderDied),
which results in ClientMonitor clearing the listener.

Fixes: 171189072
Test: Start enrollment, kill settings, enter device credential.
      No crash observed.
Change-Id: I09f5d206b1641e7c4bc1cb0b8ec22045e9c9d35f
This commit is contained in:
Kevin Chyn
2020-10-30 16:28:38 -07:00
parent 0583d29f13
commit 7105f65818

View File

@@ -582,13 +582,19 @@ class Face10 implements IHwBinder.DeathRecipient {
final FaceGenerateChallengeClient previousChallengeOwner =
mCurrentChallengeOwner.getInterruptedClient();
mCurrentChallengeOwner = null;
Slog.d(TAG, "Previous challenge owner: " + previousChallengeOwner);
if (previousChallengeOwner != null) {
try {
previousChallengeOwner.getListener()
.onChallengeInterruptFinished(mSensorId);
} catch (RemoteException e) {
Slog.e(TAG, "Unable to notify interrupt finished", e);
final ClientMonitorCallbackConverter listener =
previousChallengeOwner.getListener();
if (listener == null) {
Slog.w(TAG, "Listener is null");
} else {
try {
listener.onChallengeInterruptFinished(mSensorId);
} catch (RemoteException e) {
Slog.e(TAG, "Unable to notify interrupt finished", e);
}
}
}
}