Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/ResizingEffectPolicy.java +4 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,10 @@ class ResizingEffectPolicy { } } /** * Called on every frame while the user is dragging the divider to dismiss an app or move it * offscreen. Sets alpha and visibility on the two provided dim layers. */ void adjustDimSurface(SurfaceControl.Transaction t, SurfaceControl dimLayer1, SurfaceControl dimLayer2) { SurfaceControl targetDimLayer; Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +24 −0 Original line number Diff line number Diff line Loading @@ -1086,6 +1086,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange final SurfaceControl leash = isApp ? stage.getRootLeash() : getDividerLeash(); final ActivityManager.RunningTaskInfo taskInfo = isApp ? stage.getRunningTaskInfo() : null; final SplitDecorManager decorManager = isApp ? stage.getDecorManager() : null; final SurfaceControl dimLayer = isApp ? stage.getDimLayer() : null; boolean goingOffscreen = Flags.enableFlexibleTwoAppSplit() ? !mSplitState.isOffscreen(start) && mSplitState.isOffscreen(end) : false; boolean comingOnscreen = Flags.enableFlexibleTwoAppSplit() ? mSplitState.isOffscreen(start) && !mSplitState.isOffscreen(end) : false; Rect tempStart = new Rect(start); Rect tempEnd = new Rect(end); Loading Loading @@ -1207,6 +1212,25 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange taskInfo, mTempRect, t, isGoingBehind, leash, diffOffsetX, diffOffsetY); } } // App surfaces are dimmed when offscreen. So if the app is moving from onscreen to // offscreen or vice versa, we set the dim layer's alpha on every frame for a smooth // transition. if (Flags.enableFlexibleTwoAppSplit() && mSplitState.currentStateSupportsOffscreenApps() && dimLayer != null) { float instantaneousAlpha = 0f; if (goingOffscreen) { instantaneousAlpha = moveProgress * ResizingEffectPolicy.DEFAULT_OFFSCREEN_DIM; } if (comingOnscreen) { instantaneousAlpha = (1f - moveProgress) * ResizingEffectPolicy.DEFAULT_OFFSCREEN_DIM; } t.setAlpha(dimLayer, instantaneousAlpha); t.setVisibility(dimLayer, instantaneousAlpha > 0.001f); } t.apply(); }); return animator; Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitSpec.java +8 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ public class SplitSpec { public static final float MIDDLE_RATIO = 0.5f; private final boolean mIsLeftRightSplit; /** The physical size of the display. */ private final Rect mDisplayBounds; /** The usable display area, considering insets that affect split bounds. */ private final RectF mUsableArea; /** Half the divider size. */ Loading @@ -65,6 +67,7 @@ public class SplitSpec { public SplitSpec(Rect displayBounds, int dividerSize, boolean isLeftRightSplit, Rect pinnedTaskbarInsets) { mIsLeftRightSplit = isLeftRightSplit; mDisplayBounds = new Rect(displayBounds); mUsableArea = new RectF(displayBounds); mUsableArea.left += pinnedTaskbarInsets.left; mUsableArea.top += pinnedTaskbarInsets.top; Loading Loading @@ -180,4 +183,9 @@ public class SplitSpec { List<RectF> getSpec(@SplitScreenState int state) { return mLayouts.get(state); } /** Returns whether a given Rect is partially offscreen on the current display. */ boolean isOffscreen(Rect rect) { return !mDisplayBounds.contains(rect); } } libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitState.java +5 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,11 @@ public class SplitState { return getLayout(mState); } /** Returns whether a given Rect is partially offscreen on the current display. */ boolean isOffscreen(Rect rect) { return mSplitSpec.isOffscreen(rect); } /** @return {@code true} if at least one app is partially offscreen in the current layout. */ public boolean currentStateSupportsOffscreenApps() { return mState == SNAP_TO_2_10_90 Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +8 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,14 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener { return mSplitDecorManager; } /** * Gets the leash for this task's dim layer. We manipulate this surface's alpha to dim the app * when it's moving offscreen or toward dismissal. */ public SurfaceControl getDimLayer() { return mDimLayer; } @Nullable private ActivityManager.RunningTaskInfo getChildTaskInfo( Predicate<ActivityManager.RunningTaskInfo> predicate) { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/ResizingEffectPolicy.java +4 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,10 @@ class ResizingEffectPolicy { } } /** * Called on every frame while the user is dragging the divider to dismiss an app or move it * offscreen. Sets alpha and visibility on the two provided dim layers. */ void adjustDimSurface(SurfaceControl.Transaction t, SurfaceControl dimLayer1, SurfaceControl dimLayer2) { SurfaceControl targetDimLayer; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +24 −0 Original line number Diff line number Diff line Loading @@ -1086,6 +1086,11 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange final SurfaceControl leash = isApp ? stage.getRootLeash() : getDividerLeash(); final ActivityManager.RunningTaskInfo taskInfo = isApp ? stage.getRunningTaskInfo() : null; final SplitDecorManager decorManager = isApp ? stage.getDecorManager() : null; final SurfaceControl dimLayer = isApp ? stage.getDimLayer() : null; boolean goingOffscreen = Flags.enableFlexibleTwoAppSplit() ? !mSplitState.isOffscreen(start) && mSplitState.isOffscreen(end) : false; boolean comingOnscreen = Flags.enableFlexibleTwoAppSplit() ? mSplitState.isOffscreen(start) && !mSplitState.isOffscreen(end) : false; Rect tempStart = new Rect(start); Rect tempEnd = new Rect(end); Loading Loading @@ -1207,6 +1212,25 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange taskInfo, mTempRect, t, isGoingBehind, leash, diffOffsetX, diffOffsetY); } } // App surfaces are dimmed when offscreen. So if the app is moving from onscreen to // offscreen or vice versa, we set the dim layer's alpha on every frame for a smooth // transition. if (Flags.enableFlexibleTwoAppSplit() && mSplitState.currentStateSupportsOffscreenApps() && dimLayer != null) { float instantaneousAlpha = 0f; if (goingOffscreen) { instantaneousAlpha = moveProgress * ResizingEffectPolicy.DEFAULT_OFFSCREEN_DIM; } if (comingOnscreen) { instantaneousAlpha = (1f - moveProgress) * ResizingEffectPolicy.DEFAULT_OFFSCREEN_DIM; } t.setAlpha(dimLayer, instantaneousAlpha); t.setVisibility(dimLayer, instantaneousAlpha > 0.001f); } t.apply(); }); return animator; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitSpec.java +8 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ public class SplitSpec { public static final float MIDDLE_RATIO = 0.5f; private final boolean mIsLeftRightSplit; /** The physical size of the display. */ private final Rect mDisplayBounds; /** The usable display area, considering insets that affect split bounds. */ private final RectF mUsableArea; /** Half the divider size. */ Loading @@ -65,6 +67,7 @@ public class SplitSpec { public SplitSpec(Rect displayBounds, int dividerSize, boolean isLeftRightSplit, Rect pinnedTaskbarInsets) { mIsLeftRightSplit = isLeftRightSplit; mDisplayBounds = new Rect(displayBounds); mUsableArea = new RectF(displayBounds); mUsableArea.left += pinnedTaskbarInsets.left; mUsableArea.top += pinnedTaskbarInsets.top; Loading Loading @@ -180,4 +183,9 @@ public class SplitSpec { List<RectF> getSpec(@SplitScreenState int state) { return mLayouts.get(state); } /** Returns whether a given Rect is partially offscreen on the current display. */ boolean isOffscreen(Rect rect) { return !mDisplayBounds.contains(rect); } }
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitState.java +5 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,11 @@ public class SplitState { return getLayout(mState); } /** Returns whether a given Rect is partially offscreen on the current display. */ boolean isOffscreen(Rect rect) { return mSplitSpec.isOffscreen(rect); } /** @return {@code true} if at least one app is partially offscreen in the current layout. */ public boolean currentStateSupportsOffscreenApps() { return mState == SNAP_TO_2_10_90 Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +8 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,14 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener { return mSplitDecorManager; } /** * Gets the leash for this task's dim layer. We manipulate this surface's alpha to dim the app * when it's moving offscreen or toward dismissal. */ public SurfaceControl getDimLayer() { return mDimLayer; } @Nullable private ActivityManager.RunningTaskInfo getChildTaskInfo( Predicate<ActivityManager.RunningTaskInfo> predicate) { Loading