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

Commit 52d3dfd2 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed an issue where the collapsing was called on the wrong thread

With work profiles, the collapsing of the panel would happen on the wrong
thread.

Change-Id: I617465d9b285d456162bb7d9ed6ee27659ab1134
Fixes: 73728329
Test: unlock work profile from work profile notification
parent 4e69759e
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -4985,7 +4985,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                                    notificationKey)) {
                                    notificationKey)) {
                                // Show work challenge, do not run PendingIntent and
                                // Show work challenge, do not run PendingIntent and
                                // remove notification
                                // remove notification
                                collapsePanel();
                                collapseOnMainThread();
                                return;
                                return;
                            }
                            }
                        }
                        }
@@ -5026,11 +5026,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                    }
                    }
                }
                }
                if (shouldCollapse()) {
                if (shouldCollapse()) {
                    if (Looper.getMainLooper().isCurrentThread()) {
                    collapseOnMainThread();
                        collapsePanel();
                    } else {
                        mStackScroller.post(this::collapsePanel);
                    }
                }
                }


                try {
                try {
@@ -5058,6 +5054,14 @@ public class StatusBar extends SystemUI implements DemoMode,
        }, afterKeyguardGone);
        }, afterKeyguardGone);
    }
    }


    private void collapseOnMainThread() {
        if (Looper.getMainLooper().isCurrentThread()) {
            collapsePanel();
        } else {
            mStackScroller.post(this::collapsePanel);
        }
    }

    private boolean shouldCollapse() {
    private boolean shouldCollapse() {
        return mState != StatusBarState.SHADE || !mActivityLaunchAnimator.isAnimationPending();
        return mState != StatusBarState.SHADE || !mActivityLaunchAnimator.isAnimationPending();
    }
    }