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

Commit fbec3c7d authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Fetch top task on background thread when handling rotation request" into main

parents 478ac046 92d5d4be
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -702,12 +702,17 @@ public class RotationButtonController {

        @Override
        public void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation) {
            // Only hide the icon if the top task changes its requestedOrientation
            // Launcher can alter its requestedOrientation while it's not on top, don't hide on this
            mBgExecutor.execute(() -> {
                // Only hide the icon if the top task changes its requestedOrientation Launcher can
                // alter its requestedOrientation while it's not on top, don't hide on this
                Optional.ofNullable(ActivityManagerWrapper.getInstance())
                        .map(ActivityManagerWrapper::getRunningTask)
                        .ifPresent(a -> {
                        if (a.id == taskId) setRotateSuggestionButtonState(false /* visible */);
                            if (a.id == taskId) {
                                mMainThreadHandler.post(() ->
                                        setRotateSuggestionButtonState(false /* visible */));
                            }
                        });
            });
        }
    }