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

Commit 47bd15c5 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Add synchronized check around async inflation callback" into main

parents df02053b fae51908
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -111,7 +111,9 @@ public class KeyguardSecurityViewFlipperController

        // Prevent multiple inflations for the same security mode. Instead, add callback to a list
        // and then notify each in order when the view is inflated.
        synchronized (mOnViewInflatedListeners) {
            mOnViewInflatedListeners.add(onViewInflatedCallback);
        }
        if (!mSecurityModeInProgress.contains(securityMode)) {
            mSecurityModeInProgress.add(securityMode);
            asynchronouslyInflateView(securityMode, keyguardSecurityCallback);
@@ -145,10 +147,14 @@ public class KeyguardSecurityViewFlipperController
                        childController.init();
                        mChildren.add(childController);

                        for (OnViewInflatedCallback callback : mOnViewInflatedListeners) {
                        List<OnViewInflatedCallback> callbacks;
                        synchronized (mOnViewInflatedListeners) {
                            callbacks = new ArrayList<>(mOnViewInflatedListeners);
                            mOnViewInflatedListeners.clear();
                        }
                        for (OnViewInflatedCallback callback : callbacks) {
                            callback.onViewInflated(childController);
                        }
                        mOnViewInflatedListeners.clear();

                        // Single bouncer constrains are default
                        if (mFeatureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE)) {