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

Commit 432d960b authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Keep wallpaper as a special-case in transitions" into sc-v2-dev am:...

Merge "Keep wallpaper as a special-case in transitions" into sc-v2-dev am: ba34886c am: fc373c42

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15068561

Change-Id: Id2d5c5be38420fcb6c4c2ea69e73a7edf3712940
parents 636f7c19 fc373c42
Loading
Loading
Loading
Loading
+7 −9
Original line number Original line Diff line number Diff line
@@ -799,6 +799,8 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
            if (reportIfNotTop(wc)) {
            if (reportIfNotTop(wc)) {
                tmpList.add(wc);
                tmpList.add(wc);
            }
            }
            // Wallpaper must be the top (regardless of how nested it is in DisplayAreas).
            boolean skipIntermediateReports = isWallpaper(wc);
            for (WindowContainer p = wc.getParent(); p != null; p = p.getParent()) {
            for (WindowContainer p = wc.getParent(); p != null; p = p.getParent()) {
                if (!p.isAttached() || !changes.get(p).hasChanged(p)) {
                if (!p.isAttached() || !changes.get(p).hasChanged(p)) {
                    // Again, we're skipping no-ops
                    // Again, we're skipping no-ops
@@ -807,7 +809,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
                if (participants.contains(p)) {
                if (participants.contains(p)) {
                    topParent = p;
                    topParent = p;
                    break;
                    break;
                } else if (reportIfNotTop(p)) {
                } else if (isWallpaper(p)) {
                    skipIntermediateReports = true;
                } else if (reportIfNotTop(p) && !skipIntermediateReports) {
                    tmpList.add(p);
                    tmpList.add(p);
                }
                }
            }
            }
@@ -893,17 +897,11 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
        }
        }


        // Find the top-most shared ancestor of app targets
        // Find the top-most shared ancestor of app targets
        WindowContainer ancestor = null;
        if (appTargets.isEmpty()) {
        for (int i = appTargets.size() - 1; i >= 0; --i) {
            final WindowContainer wc = appTargets.valueAt(i);
            ancestor = wc;
            break;
        }
        if (ancestor == null) {
            out.setRootLeash(new SurfaceControl(), 0, 0);
            out.setRootLeash(new SurfaceControl(), 0, 0);
            return out;
            return out;
        }
        }
        ancestor = ancestor.getParent();
        WindowContainer ancestor = appTargets.valueAt(appTargets.size() - 1).getParent();


        // Go up ancestor parent chain until all targets are descendants.
        // Go up ancestor parent chain until all targets are descendants.
        ancestorLoop:
        ancestorLoop:
+38 −0
Original line number Original line Diff line number Diff line
@@ -338,6 +338,44 @@ public class TransitionTests extends WindowTestsBase {
                tasks[showWallpaperTask].mRemoteToken.toWindowContainerToken()).getFlags());
                tasks[showWallpaperTask].mRemoteToken.toWindowContainerToken()).getFlags());
    }
    }


    @Test
    public void testTargets_noIntermediatesToWallpaper() {
        final Transition transition = createTestTransition(TRANSIT_OLD_TASK_OPEN);

        final WallpaperWindowToken wallpaperWindowToken = new WallpaperWindowToken(mWm,
                mock(IBinder.class), true, mDisplayContent, true /* ownerCanManageAppTokens */);
        // Make DA organized so we can check that they don't get included.
        WindowContainer parent = wallpaperWindowToken.getParent();
        while (parent != null && parent != mDisplayContent) {
            if (parent.asDisplayArea() != null) {
                parent.asDisplayArea().setOrganizer(
                        mock(android.window.IDisplayAreaOrganizer.class), true /* skipAppear */);
            }
            parent = parent.getParent();
        }
        final WindowState wallpaperWindow = createWindow(null, TYPE_WALLPAPER, wallpaperWindowToken,
                "wallpaperWindow");
        wallpaperWindowToken.setVisibleRequested(false);
        transition.collect(wallpaperWindowToken);
        wallpaperWindowToken.setVisibleRequested(true);
        wallpaperWindow.mHasSurface = true;
        doReturn(true).when(mDisplayContent).isAttached();
        transition.collect(mDisplayContent);
        mDisplayContent.getWindowConfiguration().setRotation(
                (mDisplayContent.getWindowConfiguration().getRotation() + 1) % 4);

        ArraySet<WindowContainer> targets = Transition.calculateTargets(
                transition.mParticipants, transition.mChanges);
        TransitionInfo info = Transition.calculateTransitionInfo(
                0, 0, targets, transition.mChanges);
        // The wallpaper is not organized, so it won't have a token; however, it will be marked
        // as IS_WALLPAPER
        assertEquals(FLAG_IS_WALLPAPER, info.getChanges().get(0).getFlags());
        // Make sure no intermediate display areas were pulled in between wallpaper and display.
        assertEquals(mDisplayContent.mRemoteToken.toWindowContainerToken(),
                info.getChanges().get(0).getParent());
    }

    @Test
    @Test
    public void testIndependent() {
    public void testIndependent() {
        final Transition transition = createTestTransition(TRANSIT_OPEN);
        final Transition transition = createTestTransition(TRANSIT_OPEN);