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

Commit 1d6f6bd2 authored by Massimo Carli's avatar Massimo Carli
Browse files

Fix education flows for thin letterbox

The education flow reached an inconsistent state when
the very first letterboxed app had thin letterboxing.

Now we ignore the reachability education in case of
thin letterboxed apps.

Flag: EXEMPT bugfix
Fix: 349117404
Test: atest WMShellUnitTests:CompatUIControllerTest
Test: Manual following steps on bug description

Change-Id: I7fb1ff2ee0540325218a379259c5277cff1367ad
Merged-In: I7fb1ff2ee0540325218a379259c5277cff1367ad
parent 6f0c5020
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -258,10 +258,16 @@ public class CompatUIController implements OnDisplaysChangedListener,
            return;
        }
        // We're showing the first reachability education so we ignore incoming TaskInfo
        // until the education flow has completed or we double tap.
        // until the education flow has completed or we double tap. The double-tap
        // basically cancel all the onboarding flow. We don't have to ignore events in case
        // the app is in size compat mode.
        if (mIsFirstReachabilityEducationRunning) {
            if (!taskInfo.appCompatTaskInfo.isFromLetterboxDoubleTap
                    && !taskInfo.appCompatTaskInfo.topActivityInSizeCompat) {
                return;
            }
            mIsFirstReachabilityEducationRunning = false;
        }
        if (taskInfo.appCompatTaskInfo.topActivityBoundsLetterboxed) {
            if (taskInfo.appCompatTaskInfo.isLetterboxEducationEnabled) {
                createOrUpdateLetterboxEduLayout(taskInfo, taskListener);
@@ -278,17 +284,24 @@ public class CompatUIController implements OnDisplaysChangedListener,
                final boolean isFirstTimeVerticalReachabilityEdu = !topActivityPillarboxed
                        && !mCompatUIConfiguration.hasSeenVerticalReachabilityEducation(taskInfo);
                if (isFirstTimeHorizontalReachabilityEdu || isFirstTimeVerticalReachabilityEdu) {
                    mIsFirstReachabilityEducationRunning = true;
                    mCompatUIConfiguration.setSeenLetterboxEducation(taskInfo.userId);
                    // We activate the first reachability education if the double-tap is enabled.
                    // If the double tap is not enabled (e.g. thin letterbox) we just set the value
                    // of the education being seen.
                    if (taskInfo.appCompatTaskInfo.isLetterboxDoubleTapEnabled) {
                        mIsFirstReachabilityEducationRunning = true;
                        createOrUpdateReachabilityEduLayout(taskInfo, taskListener);
                        return;
                    }
                }
            }
        }
        createOrUpdateCompatLayout(taskInfo, taskListener);
        createOrUpdateRestartDialogLayout(taskInfo, taskListener);
        if (mCompatUIConfiguration.getHasSeenLetterboxEducation(taskInfo.userId)) {
            if (taskInfo.appCompatTaskInfo.isLetterboxDoubleTapEnabled) {
                createOrUpdateReachabilityEduLayout(taskInfo, taskListener);
            }
            // The user aspect ratio button should not be handled when a new TaskInfo is
            // sent because of a double tap or when in multi-window mode.
            if (taskInfo.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) {