From 91979844fefd134ca24ced2b4f8a318cd4a9b445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sim=C3=A3o=20Gomes=20Viana?= Date: Mon, 1 Mar 2021 20:28:22 +0100 Subject: [ArrowOS][11.0] AuthContainerView: Fix rare SystemUI crash This can happen if the fingerprint is validated twice in a row before the view has time to disappear. Make the method synchronized to avoid race conditions of any kind and add an additional try-catch as a safeguard. Change-Id: Ic2b76be1cc0f5217351e39ec24159ca23043ab4f --- .../src/com/android/systemui/biometrics/AuthContainerView.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index c1233fe6b9da..363fd7d9b16d 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -593,7 +593,7 @@ public class AuthContainerView extends LinearLayout } } - private void removeWindowIfAttached(boolean sendReason) { + private synchronized void removeWindowIfAttached(boolean sendReason) { if (sendReason) { sendPendingCallbackIfNotNull(); } @@ -604,7 +604,12 @@ public class AuthContainerView extends LinearLayout } Log.d(TAG, "Removing container, mSysUiSessionId: " + mConfig.mSysUiSessionId); mContainerState = STATE_GONE; - mWindowManager.removeView(this); + try { + mWindowManager.removeView(this); + } catch (IllegalArgumentException e) { + // Looks like the view is already gone?? + // Whatever, just ignore it then. + } } @VisibleForTesting -- cgit v1.2.3