Loading services/core/java/com/android/server/wm/ActivityRecord.java +5 −6 Original line number Diff line number Diff line Loading @@ -158,7 +158,6 @@ import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANG import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__LETTERBOXED_FOR_SIZE_COMPAT_MODE; import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_LETTERBOXED; import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_VISIBLE; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.ActivityRecord.State.DESTROYED; Loading Loading @@ -1908,7 +1907,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) { mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t); mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t, getPendingTransaction()); } void updateLetterboxSurfaceIfNeeded(WindowState winHint) { Loading Loading @@ -8681,7 +8680,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } @Nullable Rect getParentAppBoundsOverride() { return Rect.copyOrNull(mResolveConfigHint.mTmpParentAppBoundsOverride); return Rect.copyOrNull(mResolveConfigHint.mParentAppBoundsOverride); } /** Loading Loading @@ -8866,7 +8865,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } final Rect screenResolvedBounds = mSizeCompatBounds != null ? mSizeCompatBounds : resolvedBounds; final Rect parentAppBounds = mResolveConfigHint.mTmpParentAppBoundsOverride; final Rect parentAppBounds = mResolveConfigHint.mParentAppBoundsOverride; final Rect parentBounds = newParentConfiguration.windowConfiguration.getBounds(); final float screenResolvedBoundsWidth = screenResolvedBounds.width(); final float parentAppBoundsWidth = parentAppBounds.width(); Loading Loading @@ -9275,7 +9274,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ private void resolveAspectRatioRestriction(Configuration newParentConfiguration) { final Configuration resolvedConfig = getResolvedOverrideConfiguration(); final Rect parentAppBounds = mResolveConfigHint.mTmpParentAppBoundsOverride; final Rect parentAppBounds = mResolveConfigHint.mParentAppBoundsOverride; final Rect parentBounds = newParentConfiguration.windowConfiguration.getBounds(); final Rect resolvedBounds = resolvedConfig.windowConfiguration.getBounds(); // Use tmp bounds to calculate aspect ratio so we can know whether the activity should use Loading Loading @@ -9316,7 +9315,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A : newParentConfiguration.windowConfiguration.getBounds(); final Rect containerAppBounds = useResolvedBounds ? new Rect(resolvedConfig.windowConfiguration.getAppBounds()) : mResolveConfigHint.mTmpParentAppBoundsOverride; : mResolveConfigHint.mParentAppBoundsOverride; final int requestedOrientation = getRequestedConfigurationOrientation(); final boolean orientationRequested = requestedOrientation != ORIENTATION_UNDEFINED; Loading services/core/java/com/android/server/wm/Letterbox.java +9 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS; import static android.view.SurfaceControl.HIDDEN; import static android.window.TaskConstants.TASK_CHILD_LAYER_LETTERBOX_BACKGROUND; import android.annotation.NonNull; import android.graphics.Color; import android.graphics.Point; import android.graphics.Rect; Loading Loading @@ -209,16 +210,18 @@ public class Letterbox { return false; } public void applySurfaceChanges(SurfaceControl.Transaction t) { /** Applies surface changes such as colour, window crop, position and input info. */ public void applySurfaceChanges(@NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction inputT) { if (useFullWindowSurface()) { mFullWindowSurface.applySurfaceChanges(t); mFullWindowSurface.applySurfaceChanges(t, inputT); for (LetterboxSurface surface : mSurfaces) { surface.remove(); } } else { for (LetterboxSurface surface : mSurfaces) { surface.applySurfaceChanges(t); surface.applySurfaceChanges(t, inputT); } mFullWindowSurface.remove(); Loading Loading @@ -418,7 +421,8 @@ public class Letterbox { return Math.max(0, mLayoutFrameGlobal.height()); } public void applySurfaceChanges(SurfaceControl.Transaction t) { public void applySurfaceChanges(@NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction inputT) { if (!needsApplySurfaceChanges()) { // Nothing changed. return; Loading Loading @@ -446,7 +450,7 @@ public class Letterbox { } if (mSurface != null && mInputInterceptor != null) { mInputInterceptor.updateTouchableRegion(mSurfaceFrameRelative); t.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); inputT.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); } } Loading services/core/java/com/android/server/wm/LetterboxUiController.java +5 −3 Original line number Diff line number Diff line Loading @@ -785,16 +785,18 @@ final class LetterboxUiController { } void updateLetterboxSurfaceIfNeeded(WindowState winHint) { updateLetterboxSurfaceIfNeeded(winHint, mActivityRecord.getSyncTransaction()); updateLetterboxSurfaceIfNeeded(winHint, mActivityRecord.getSyncTransaction(), mActivityRecord.getPendingTransaction()); } void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) { void updateLetterboxSurfaceIfNeeded(WindowState winHint, @NonNull Transaction t, @NonNull Transaction inputT) { if (shouldNotLayoutLetterbox(winHint)) { return; } layoutLetterboxIfNeeded(winHint); if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) { mLetterbox.applySurfaceChanges(t); mLetterbox.applySurfaceChanges(t, inputT); } } Loading services/core/java/com/android/server/wm/TaskFragment.java +4 −5 Original line number Diff line number Diff line Loading @@ -2241,13 +2241,13 @@ class TaskFragment extends WindowContainer<WindowContainer> { static class ConfigOverrideHint { @Nullable DisplayInfo mTmpOverrideDisplayInfo; @Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets; @Nullable Rect mTmpParentAppBoundsOverride; @Nullable Rect mParentAppBoundsOverride; int mTmpOverrideConfigOrientation; boolean mUseOverrideInsetsForConfig; void resolveTmpOverrides(DisplayContent dc, Configuration parentConfig, boolean isFixedRotationTransforming) { mTmpParentAppBoundsOverride = new Rect(parentConfig.windowConfiguration.getAppBounds()); mParentAppBoundsOverride = new Rect(parentConfig.windowConfiguration.getAppBounds()); final Insets insets; if (mUseOverrideInsetsForConfig && dc != null) { // Insets are decoupled from configuration by default from V+, use legacy Loading @@ -2269,13 +2269,12 @@ class TaskFragment extends WindowContainer<WindowContainer> { } else { insets = Insets.NONE; } mTmpParentAppBoundsOverride.inset(insets); mParentAppBoundsOverride.inset(insets); } void resetTmpOverrides() { mTmpOverrideDisplayInfo = null; mTmpCompatInsets = null; mTmpParentAppBoundsOverride = null; mTmpOverrideConfigOrientation = ORIENTATION_UNDEFINED; } } Loading Loading @@ -2364,7 +2363,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { final Rect containingAppBounds; if (insideParentBounds) { containingAppBounds = useOverrideInsetsForConfig ? overrideHint.mTmpParentAppBoundsOverride ? overrideHint.mParentAppBoundsOverride : parentConfig.windowConfiguration.getAppBounds(); } else { // Restrict appBounds to display non-decor rather than parent because the Loading services/tests/wmtests/src/com/android/server/wm/LetterboxTest.java +18 −13 Original line number Diff line number Diff line Loading @@ -172,14 +172,14 @@ public class LetterboxTest { @Test public void testSurfaceOrigin_applied() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setPosition(mSurfaces.top, -1000, -2000); } @Test public void testApplySurfaceChanges_setColor() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setColor(mSurfaces.top, new float[]{0, 0, 0}); Loading @@ -187,7 +187,7 @@ public class LetterboxTest { assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setColor(mSurfaces.top, new float[]{0, 1, 0}); } Loading @@ -195,7 +195,7 @@ public class LetterboxTest { @Test public void testNeedsApplySurfaceChanges_wallpaperBackgroundRequested() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setAlpha(mSurfaces.top, 1.0f); assertFalse(mLetterbox.needsApplySurfaceChanges()); Loading @@ -204,14 +204,14 @@ public class LetterboxTest { assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setAlpha(mSurfaces.fullWindowSurface, mDarkScrimAlpha); } @Test public void testNeedsApplySurfaceChanges_setParentSurface() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).reparent(mSurfaces.top, mParentSurface); assertFalse(mLetterbox.needsApplySurfaceChanges()); Loading @@ -220,14 +220,14 @@ public class LetterboxTest { assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).reparent(mSurfaces.top, mParentSurface); } @Test public void testApplySurfaceChanges_cornersNotRounded_surfaceFullWindowSurfaceNotCreated() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertNull(mSurfaces.fullWindowSurface); } Loading @@ -236,7 +236,7 @@ public class LetterboxTest { public void testApplySurfaceChanges_cornersRounded_surfaceFullWindowSurfaceCreated() { mAreCornersRounded = true; mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertNotNull(mSurfaces.fullWindowSurface); } Loading @@ -245,7 +245,7 @@ public class LetterboxTest { public void testApplySurfaceChanges_wallpaperBackground_surfaceFullWindowSurfaceCreated() { mHasWallpaperBackground = true; mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertNotNull(mSurfaces.fullWindowSurface); } Loading @@ -254,7 +254,7 @@ public class LetterboxTest { public void testNotIntersectsOrFullyContains_cornersRounded() { mAreCornersRounded = true; mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(0, 0)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertTrue(mLetterbox.notIntersectsOrFullyContains(new Rect(1, 2, 9, 9))); } Loading @@ -262,14 +262,19 @@ public class LetterboxTest { @Test public void testSurfaceOrigin_changeCausesReapply() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); clearInvocations(mTransaction); mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(0, 0)); assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setPosition(mSurfaces.top, 0, 0); } private void applySurfaceChanges() { mLetterbox.applySurfaceChanges(/* syncTransaction */ mTransaction, /* pendingTransaction */ mTransaction); } class SurfaceControlMocker implements Supplier<SurfaceControl.Builder> { private SurfaceControl.Builder mLeftBuilder; public SurfaceControl left; Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +5 −6 Original line number Diff line number Diff line Loading @@ -158,7 +158,6 @@ import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANG import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__LETTERBOXED_FOR_SIZE_COMPAT_MODE; import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_LETTERBOXED; import static com.android.internal.util.FrameworkStatsLog.APP_COMPAT_STATE_CHANGED__STATE__NOT_VISIBLE; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.ActivityRecord.State.DESTROYED; Loading Loading @@ -1908,7 +1907,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) { mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t); mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t, getPendingTransaction()); } void updateLetterboxSurfaceIfNeeded(WindowState winHint) { Loading Loading @@ -8681,7 +8680,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } @Nullable Rect getParentAppBoundsOverride() { return Rect.copyOrNull(mResolveConfigHint.mTmpParentAppBoundsOverride); return Rect.copyOrNull(mResolveConfigHint.mParentAppBoundsOverride); } /** Loading Loading @@ -8866,7 +8865,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } final Rect screenResolvedBounds = mSizeCompatBounds != null ? mSizeCompatBounds : resolvedBounds; final Rect parentAppBounds = mResolveConfigHint.mTmpParentAppBoundsOverride; final Rect parentAppBounds = mResolveConfigHint.mParentAppBoundsOverride; final Rect parentBounds = newParentConfiguration.windowConfiguration.getBounds(); final float screenResolvedBoundsWidth = screenResolvedBounds.width(); final float parentAppBoundsWidth = parentAppBounds.width(); Loading Loading @@ -9275,7 +9274,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ private void resolveAspectRatioRestriction(Configuration newParentConfiguration) { final Configuration resolvedConfig = getResolvedOverrideConfiguration(); final Rect parentAppBounds = mResolveConfigHint.mTmpParentAppBoundsOverride; final Rect parentAppBounds = mResolveConfigHint.mParentAppBoundsOverride; final Rect parentBounds = newParentConfiguration.windowConfiguration.getBounds(); final Rect resolvedBounds = resolvedConfig.windowConfiguration.getBounds(); // Use tmp bounds to calculate aspect ratio so we can know whether the activity should use Loading Loading @@ -9316,7 +9315,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A : newParentConfiguration.windowConfiguration.getBounds(); final Rect containerAppBounds = useResolvedBounds ? new Rect(resolvedConfig.windowConfiguration.getAppBounds()) : mResolveConfigHint.mTmpParentAppBoundsOverride; : mResolveConfigHint.mParentAppBoundsOverride; final int requestedOrientation = getRequestedConfigurationOrientation(); final boolean orientationRequested = requestedOrientation != ORIENTATION_UNDEFINED; Loading
services/core/java/com/android/server/wm/Letterbox.java +9 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS; import static android.view.SurfaceControl.HIDDEN; import static android.window.TaskConstants.TASK_CHILD_LAYER_LETTERBOX_BACKGROUND; import android.annotation.NonNull; import android.graphics.Color; import android.graphics.Point; import android.graphics.Rect; Loading Loading @@ -209,16 +210,18 @@ public class Letterbox { return false; } public void applySurfaceChanges(SurfaceControl.Transaction t) { /** Applies surface changes such as colour, window crop, position and input info. */ public void applySurfaceChanges(@NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction inputT) { if (useFullWindowSurface()) { mFullWindowSurface.applySurfaceChanges(t); mFullWindowSurface.applySurfaceChanges(t, inputT); for (LetterboxSurface surface : mSurfaces) { surface.remove(); } } else { for (LetterboxSurface surface : mSurfaces) { surface.applySurfaceChanges(t); surface.applySurfaceChanges(t, inputT); } mFullWindowSurface.remove(); Loading Loading @@ -418,7 +421,8 @@ public class Letterbox { return Math.max(0, mLayoutFrameGlobal.height()); } public void applySurfaceChanges(SurfaceControl.Transaction t) { public void applySurfaceChanges(@NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction inputT) { if (!needsApplySurfaceChanges()) { // Nothing changed. return; Loading Loading @@ -446,7 +450,7 @@ public class Letterbox { } if (mSurface != null && mInputInterceptor != null) { mInputInterceptor.updateTouchableRegion(mSurfaceFrameRelative); t.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); inputT.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); } } Loading
services/core/java/com/android/server/wm/LetterboxUiController.java +5 −3 Original line number Diff line number Diff line Loading @@ -785,16 +785,18 @@ final class LetterboxUiController { } void updateLetterboxSurfaceIfNeeded(WindowState winHint) { updateLetterboxSurfaceIfNeeded(winHint, mActivityRecord.getSyncTransaction()); updateLetterboxSurfaceIfNeeded(winHint, mActivityRecord.getSyncTransaction(), mActivityRecord.getPendingTransaction()); } void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) { void updateLetterboxSurfaceIfNeeded(WindowState winHint, @NonNull Transaction t, @NonNull Transaction inputT) { if (shouldNotLayoutLetterbox(winHint)) { return; } layoutLetterboxIfNeeded(winHint); if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) { mLetterbox.applySurfaceChanges(t); mLetterbox.applySurfaceChanges(t, inputT); } } Loading
services/core/java/com/android/server/wm/TaskFragment.java +4 −5 Original line number Diff line number Diff line Loading @@ -2241,13 +2241,13 @@ class TaskFragment extends WindowContainer<WindowContainer> { static class ConfigOverrideHint { @Nullable DisplayInfo mTmpOverrideDisplayInfo; @Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets; @Nullable Rect mTmpParentAppBoundsOverride; @Nullable Rect mParentAppBoundsOverride; int mTmpOverrideConfigOrientation; boolean mUseOverrideInsetsForConfig; void resolveTmpOverrides(DisplayContent dc, Configuration parentConfig, boolean isFixedRotationTransforming) { mTmpParentAppBoundsOverride = new Rect(parentConfig.windowConfiguration.getAppBounds()); mParentAppBoundsOverride = new Rect(parentConfig.windowConfiguration.getAppBounds()); final Insets insets; if (mUseOverrideInsetsForConfig && dc != null) { // Insets are decoupled from configuration by default from V+, use legacy Loading @@ -2269,13 +2269,12 @@ class TaskFragment extends WindowContainer<WindowContainer> { } else { insets = Insets.NONE; } mTmpParentAppBoundsOverride.inset(insets); mParentAppBoundsOverride.inset(insets); } void resetTmpOverrides() { mTmpOverrideDisplayInfo = null; mTmpCompatInsets = null; mTmpParentAppBoundsOverride = null; mTmpOverrideConfigOrientation = ORIENTATION_UNDEFINED; } } Loading Loading @@ -2364,7 +2363,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { final Rect containingAppBounds; if (insideParentBounds) { containingAppBounds = useOverrideInsetsForConfig ? overrideHint.mTmpParentAppBoundsOverride ? overrideHint.mParentAppBoundsOverride : parentConfig.windowConfiguration.getAppBounds(); } else { // Restrict appBounds to display non-decor rather than parent because the Loading
services/tests/wmtests/src/com/android/server/wm/LetterboxTest.java +18 −13 Original line number Diff line number Diff line Loading @@ -172,14 +172,14 @@ public class LetterboxTest { @Test public void testSurfaceOrigin_applied() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setPosition(mSurfaces.top, -1000, -2000); } @Test public void testApplySurfaceChanges_setColor() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setColor(mSurfaces.top, new float[]{0, 0, 0}); Loading @@ -187,7 +187,7 @@ public class LetterboxTest { assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setColor(mSurfaces.top, new float[]{0, 1, 0}); } Loading @@ -195,7 +195,7 @@ public class LetterboxTest { @Test public void testNeedsApplySurfaceChanges_wallpaperBackgroundRequested() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setAlpha(mSurfaces.top, 1.0f); assertFalse(mLetterbox.needsApplySurfaceChanges()); Loading @@ -204,14 +204,14 @@ public class LetterboxTest { assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setAlpha(mSurfaces.fullWindowSurface, mDarkScrimAlpha); } @Test public void testNeedsApplySurfaceChanges_setParentSurface() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).reparent(mSurfaces.top, mParentSurface); assertFalse(mLetterbox.needsApplySurfaceChanges()); Loading @@ -220,14 +220,14 @@ public class LetterboxTest { assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).reparent(mSurfaces.top, mParentSurface); } @Test public void testApplySurfaceChanges_cornersNotRounded_surfaceFullWindowSurfaceNotCreated() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertNull(mSurfaces.fullWindowSurface); } Loading @@ -236,7 +236,7 @@ public class LetterboxTest { public void testApplySurfaceChanges_cornersRounded_surfaceFullWindowSurfaceCreated() { mAreCornersRounded = true; mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertNotNull(mSurfaces.fullWindowSurface); } Loading @@ -245,7 +245,7 @@ public class LetterboxTest { public void testApplySurfaceChanges_wallpaperBackground_surfaceFullWindowSurfaceCreated() { mHasWallpaperBackground = true; mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertNotNull(mSurfaces.fullWindowSurface); } Loading @@ -254,7 +254,7 @@ public class LetterboxTest { public void testNotIntersectsOrFullyContains_cornersRounded() { mAreCornersRounded = true; mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(0, 0)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); assertTrue(mLetterbox.notIntersectsOrFullyContains(new Rect(1, 2, 9, 9))); } Loading @@ -262,14 +262,19 @@ public class LetterboxTest { @Test public void testSurfaceOrigin_changeCausesReapply() { mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(1000, 2000)); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); clearInvocations(mTransaction); mLetterbox.layout(new Rect(0, 0, 10, 10), new Rect(0, 1, 10, 10), new Point(0, 0)); assertTrue(mLetterbox.needsApplySurfaceChanges()); mLetterbox.applySurfaceChanges(mTransaction); applySurfaceChanges(); verify(mTransaction).setPosition(mSurfaces.top, 0, 0); } private void applySurfaceChanges() { mLetterbox.applySurfaceChanges(/* syncTransaction */ mTransaction, /* pendingTransaction */ mTransaction); } class SurfaceControlMocker implements Supplier<SurfaceControl.Builder> { private SurfaceControl.Builder mLeftBuilder; public SurfaceControl left; Loading