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

Commit 1dda7a62 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Properly check for orientation mismatch

Previous check tested against the display, which is wrong. Now
we properly check against the configuration.

Test: go/wm-smoke
Test: Enter split screen, go home, launch app, go home, relaunch
app, ensure no splash screen shown
Test: Enter split screen with 2 apps, lock phone, unlock phone

Change-Id: I62d45b6d3e5aa91dcb5edffed4233a5fed7ac9aa
Fixes: 63075521
parent 0d1b1a25
Loading
Loading
Loading
Loading
+3 −16
Original line number Original line Diff line number Diff line
@@ -614,7 +614,7 @@ public class AppWindowContainerController
            return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
            return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
        } else if (taskSwitch && allowTaskSnapshot) {
        } else if (taskSwitch && allowTaskSnapshot) {
            return snapshot == null ? STARTING_WINDOW_TYPE_NONE
            return snapshot == null ? STARTING_WINDOW_TYPE_NONE
                    : snapshotOrientationSameAsDisplay(snapshot) || fromRecents
                    : snapshotOrientationSameAsTask(snapshot) || fromRecents
                            ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN;
                            ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN;
        } else {
        } else {
            return STARTING_WINDOW_TYPE_NONE;
            return STARTING_WINDOW_TYPE_NONE;
@@ -640,24 +640,11 @@ public class AppWindowContainerController
        return true;
        return true;
    }
    }


    private boolean snapshotOrientationSameAsDisplay(TaskSnapshot snapshot) {
    private boolean snapshotOrientationSameAsTask(TaskSnapshot snapshot) {
        if (snapshot == null) {
        if (snapshot == null) {
            return false;
            return false;
        }
        }
        final Rect rect = new Rect(0, 0, snapshot.getSnapshot().getWidth(),
        return mContainer.getTask().getConfiguration().orientation == snapshot.getOrientation();
                snapshot.getSnapshot().getHeight());
        rect.inset(snapshot.getContentInsets());
        final Rect taskBoundsWithoutInsets = new Rect();
        mContainer.getTask().getBounds(taskBoundsWithoutInsets);
        final DisplayInfo di = mContainer.getDisplayContent().getDisplayInfo();
        final Rect displayBounds = new Rect(0, 0, di.logicalWidth, di.logicalHeight);
        final Rect stableInsets = new Rect();
        mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight,
                stableInsets);
        displayBounds.inset(stableInsets);
        final boolean snapshotInLandscape = rect.width() >= rect.height();
        final boolean displayInLandscape = displayBounds.width() >= displayBounds.height();
        return snapshotInLandscape == displayInLandscape;
    }
    }


    public void removeStartingWindow() {
    public void removeStartingWindow() {