diff options
Diffstat (limited to 'libs')
12 files changed, 57 insertions, 15 deletions
diff --git a/libs/WindowManager/Shell/res/color/split_divider_background.xml b/libs/WindowManager/Shell/res/color/split_divider_background.xml new file mode 100644 index 000000000000..84f4fdff4e1a --- /dev/null +++ b/libs/WindowManager/Shell/res/color/split_divider_background.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2021 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@android:color/system_neutral2_500" android:lStar="35" /> +</selector>
\ No newline at end of file diff --git a/libs/WindowManager/Shell/res/layout/docked_stack_divider.xml b/libs/WindowManager/Shell/res/layout/docked_stack_divider.xml index ed5d2e1b49f5..d732b01ce106 100644 --- a/libs/WindowManager/Shell/res/layout/docked_stack_divider.xml +++ b/libs/WindowManager/Shell/res/layout/docked_stack_divider.xml @@ -22,7 +22,7 @@ <View style="@style/DockedDividerBackground" android:id="@+id/docked_divider_background" - android:background="@color/docked_divider_background"/> + android:background="@color/split_divider_background"/> <com.android.wm.shell.legacysplitscreen.MinimizedDockShadow style="@style/DockedDividerMinimizedShadow" diff --git a/libs/WindowManager/Shell/res/layout/split_divider.xml b/libs/WindowManager/Shell/res/layout/split_divider.xml index 7f583f3e6bac..a1dba5169f1b 100644 --- a/libs/WindowManager/Shell/res/layout/split_divider.xml +++ b/libs/WindowManager/Shell/res/layout/split_divider.xml @@ -21,8 +21,7 @@ <View style="@style/DockedDividerBackground" - android:id="@+id/docked_divider_background" - android:background="@color/docked_divider_background"/> + android:id="@+id/docked_divider_background"/> <com.android.wm.shell.common.split.DividerHandleView style="@style/DockedDividerHandle" diff --git a/libs/WindowManager/Shell/res/values-land/dimens.xml b/libs/WindowManager/Shell/res/values-land/dimens.xml index aafba58cef59..a95323fd4801 100644 --- a/libs/WindowManager/Shell/res/values-land/dimens.xml +++ b/libs/WindowManager/Shell/res/values-land/dimens.xml @@ -16,8 +16,12 @@ */ --> <resources> + <!-- Divider handle size for legacy split screen --> <dimen name="docked_divider_handle_width">2dp</dimen> <dimen name="docked_divider_handle_height">16dp</dimen> + <!-- Divider handle size for split screen --> + <dimen name="split_divider_handle_width">3dp</dimen> + <dimen name="split_divider_handle_height">72dp</dimen> <!-- Padding between status bar and bubbles when displayed in expanded state, smaller value in landscape since we have limited vertical space--> diff --git a/libs/WindowManager/Shell/res/values-land/styles.xml b/libs/WindowManager/Shell/res/values-land/styles.xml index 863bb69d4034..9eddac48e6de 100644 --- a/libs/WindowManager/Shell/res/values-land/styles.xml +++ b/libs/WindowManager/Shell/res/values-land/styles.xml @@ -19,6 +19,7 @@ <item name="android:layout_width">10dp</item> <item name="android:layout_height">match_parent</item> <item name="android:layout_gravity">center_horizontal</item> + <item name="android:background">@color/split_divider_background</item> </style> <style name="DockedDividerHandle"> diff --git a/libs/WindowManager/Shell/res/values/colors.xml b/libs/WindowManager/Shell/res/values/colors.xml index 350beafae961..93c0352a2ad3 100644 --- a/libs/WindowManager/Shell/res/values/colors.xml +++ b/libs/WindowManager/Shell/res/values/colors.xml @@ -17,7 +17,6 @@ */ --> <resources> - <color name="docked_divider_background">#ff000000</color> <color name="docked_divider_handle">#ffffff</color> <drawable name="forced_resizable_background">#59000000</drawable> <color name="minimize_dock_shadow_start">#60000000</color> diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml index 130f741def86..26c619d92599 100644 --- a/libs/WindowManager/Shell/res/values/dimen.xml +++ b/libs/WindowManager/Shell/res/values/dimen.xml @@ -76,8 +76,12 @@ <!-- How high we lift the divider when touching --> <dimen name="docked_stack_divider_lift_elevation">4dp</dimen> + <!-- Divider handle size for legacy split screen --> <dimen name="docked_divider_handle_width">16dp</dimen> <dimen name="docked_divider_handle_height">2dp</dimen> + <!-- Divider handle size for split screen --> + <dimen name="split_divider_handle_width">72dp</dimen> + <dimen name="split_divider_handle_height">3dp</dimen> <!-- One-Handed Mode --> <!-- Threshold for dragging distance to enable one-handed mode --> diff --git a/libs/WindowManager/Shell/res/values/styles.xml b/libs/WindowManager/Shell/res/values/styles.xml index fffcd33f7992..3e4ca3ac6dce 100644 --- a/libs/WindowManager/Shell/res/values/styles.xml +++ b/libs/WindowManager/Shell/res/values/styles.xml @@ -34,6 +34,7 @@ <item name="android:layout_width">match_parent</item> <item name="android:layout_height">10dp</item> <item name="android:layout_gravity">center_vertical</item> + <item name="android:background">@color/split_divider_background</item> </style> <style name="DockedDividerMinimizedShadow"> diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerHandleView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerHandleView.java index 218bf47e24aa..c76937de6669 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerHandleView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerHandleView.java @@ -70,7 +70,8 @@ public class DividerHandleView extends View { private final Paint mPaint = new Paint(); private final int mWidth; private final int mHeight; - private final int mCircleDiameter; + private final int mTouchingWidth; + private final int mTouchingHeight; private int mCurrentWidth; private int mCurrentHeight; private AnimatorSet mAnimator; @@ -80,11 +81,12 @@ public class DividerHandleView extends View { super(context, attrs); mPaint.setColor(getResources().getColor(R.color.docked_divider_handle, null)); mPaint.setAntiAlias(true); - mWidth = getResources().getDimensionPixelSize(R.dimen.docked_divider_handle_width); - mHeight = getResources().getDimensionPixelSize(R.dimen.docked_divider_handle_height); + mWidth = getResources().getDimensionPixelSize(R.dimen.split_divider_handle_width); + mHeight = getResources().getDimensionPixelSize(R.dimen.split_divider_handle_height); mCurrentWidth = mWidth; mCurrentHeight = mHeight; - mCircleDiameter = (mWidth + mHeight) / 3; + mTouchingWidth = mWidth > mHeight ? mWidth / 2 : mWidth; + mTouchingHeight = mHeight > mWidth ? mHeight / 2 : mHeight; } /** Sets touching state for this handle view. */ @@ -98,16 +100,16 @@ public class DividerHandleView extends View { } if (!animate) { if (touching) { - mCurrentWidth = mCircleDiameter; - mCurrentHeight = mCircleDiameter; + mCurrentWidth = mTouchingWidth; + mCurrentHeight = mTouchingHeight; } else { mCurrentWidth = mWidth; mCurrentHeight = mHeight; } invalidate(); } else { - animateToTarget(touching ? mCircleDiameter : mWidth, - touching ? mCircleDiameter : mHeight, touching); + animateToTarget(touching ? mTouchingWidth : mWidth, + touching ? mTouchingHeight : mHeight, touching); } mTouching = touching; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java index e864ffe6f63a..f9c681c1ae4b 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java @@ -50,6 +50,7 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.policy.DividerSnapAlgorithm; +import com.android.internal.policy.DockedDividerUtils; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.animation.Interpolators; import com.android.wm.shell.common.DisplayImeController; @@ -239,6 +240,8 @@ public final class SplitLayout { mBounds1.bottom = position; mBounds2.top = mBounds1.bottom + mDividerSize; } + DockedDividerUtils.sanitizeStackBounds(mBounds1, true /** topLeft */); + DockedDividerUtils.sanitizeStackBounds(mBounds2, false /** topLeft */); mDismissingParallaxPolicy.applyDividerPosition(position, isLandscape); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 67223c3590a5..5bfecf2ef7ae 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -67,6 +67,8 @@ import com.android.wm.shell.transition.LegacyTransitions; import com.android.wm.shell.transition.Transitions; import java.io.PrintWriter; +import java.util.Arrays; +import java.util.Comparator; import java.util.concurrent.Executor; /** @@ -295,11 +297,15 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mRootTDAOrganizer.attachToDisplayArea(DEFAULT_DISPLAY, builder); SurfaceControl sc = builder.build(); SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); + + // Ensure that we order these in the parent in the right z-order as their previous order + Arrays.sort(apps, (a1, a2) -> a1.prefixOrderIndex - a2.prefixOrderIndex); + int layer = 1; for (RemoteAnimationTarget appTarget : apps) { - // TODO(b/195958376) set the correct layer/z-order in transaction for the new surface transaction.reparent(appTarget.leash, sc); transaction.setPosition(appTarget.leash, appTarget.screenSpaceBounds.left, appTarget.screenSpaceBounds.top); + transaction.setLayer(appTarget.leash, layer++); } transaction.apply(); transaction.close(); diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt index 050beb377978..086165289d2d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipLegacySplitScreenTest.kt @@ -27,13 +27,15 @@ import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.flicker.helpers.launchSplitScreen import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen -import com.android.wm.shell.flicker.helpers.ImeAppHelper -import com.android.wm.shell.flicker.helpers.FixedAppHelper import com.android.server.wm.flicker.repetitions import com.android.server.wm.flicker.rules.RemoveAllTasksButHomeRule.Companion.removeAllTasksButHome import com.android.wm.shell.flicker.helpers.BaseAppHelper.Companion.isShellTransitionsEnabled +import com.android.wm.shell.flicker.helpers.FixedAppHelper +import com.android.wm.shell.flicker.helpers.ImeAppHelper +import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.testapp.Components.PipActivity.EXTRA_ENTER_PIP import org.junit.Assume.assumeFalse +import org.junit.Assume.assumeTrue import org.junit.Before import org.junit.FixMethodOrder import org.junit.Test @@ -56,6 +58,8 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t @Before open fun setup() { + // Only run legacy split tests when the system is using legacy split screen. + assumeTrue(SplitScreenHelper.isUsingLegacySplit()) // Legacy split is having some issue with Shell transition, and will be deprecated soon. assumeFalse(isShellTransitionsEnabled()) } |