Loading services/core/java/com/android/server/wm/Transition.java +7 −9 Original line number Diff line number Diff line Loading @@ -799,6 +799,8 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe if (reportIfNotTop(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()) { if (!p.isAttached() || !changes.get(p).hasChanged(p)) { // Again, we're skipping no-ops Loading @@ -807,7 +809,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe if (participants.contains(p)) { topParent = p; break; } else if (reportIfNotTop(p)) { } else if (isWallpaper(p)) { skipIntermediateReports = true; } else if (reportIfNotTop(p) && !skipIntermediateReports) { tmpList.add(p); } } Loading Loading @@ -893,17 +897,11 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe } // Find the top-most shared ancestor of app targets WindowContainer ancestor = null; for (int i = appTargets.size() - 1; i >= 0; --i) { final WindowContainer wc = appTargets.valueAt(i); ancestor = wc; break; } if (ancestor == null) { if (appTargets.isEmpty()) { out.setRootLeash(new SurfaceControl(), 0, 0); return out; } ancestor = ancestor.getParent(); WindowContainer ancestor = appTargets.valueAt(appTargets.size() - 1).getParent(); // Go up ancestor parent chain until all targets are descendants. ancestorLoop: Loading services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +38 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,44 @@ public class TransitionTests extends WindowTestsBase { 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 public void testIndependent() { final Transition transition = createTestTransition(TRANSIT_OPEN); Loading Loading
services/core/java/com/android/server/wm/Transition.java +7 −9 Original line number Diff line number Diff line Loading @@ -799,6 +799,8 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe if (reportIfNotTop(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()) { if (!p.isAttached() || !changes.get(p).hasChanged(p)) { // Again, we're skipping no-ops Loading @@ -807,7 +809,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe if (participants.contains(p)) { topParent = p; break; } else if (reportIfNotTop(p)) { } else if (isWallpaper(p)) { skipIntermediateReports = true; } else if (reportIfNotTop(p) && !skipIntermediateReports) { tmpList.add(p); } } Loading Loading @@ -893,17 +897,11 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe } // Find the top-most shared ancestor of app targets WindowContainer ancestor = null; for (int i = appTargets.size() - 1; i >= 0; --i) { final WindowContainer wc = appTargets.valueAt(i); ancestor = wc; break; } if (ancestor == null) { if (appTargets.isEmpty()) { out.setRootLeash(new SurfaceControl(), 0, 0); return out; } ancestor = ancestor.getParent(); WindowContainer ancestor = appTargets.valueAt(appTargets.size() - 1).getParent(); // Go up ancestor parent chain until all targets are descendants. ancestorLoop: Loading
services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +38 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,44 @@ public class TransitionTests extends WindowTestsBase { 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 public void testIndependent() { final Transition transition = createTestTransition(TRANSIT_OPEN); Loading