diff options
| author | 2020-04-10 05:17:29 +0000 | |
|---|---|---|
| committer | 2020-04-10 05:17:29 +0000 | |
| commit | b770ca4746c6aecabe8ef0e892c22ff50601cf38 (patch) | |
| tree | 6895d3bc5803ad2162d6fbacee2291f315c87f7c | |
| parent | 2a7091d8968d3ba9b4b73a6e5dc8b6efdeebf6fe (diff) | |
| parent | 0bbb7efe263b4c741fcf09ecd0d8844e64930ca5 (diff) | |
Merge "Fix split task position behavior when landscape" into rvc-dev
3 files changed, 37 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 366ef931e1f5..2df450604d3b 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -1042,7 +1042,8 @@ public class DividerView extends FrameLayout implements OnTouchListener, dockedTaskRect = dockedTaskRect == null ? dockedRect : dockedTaskRect; otherTaskRect = otherTaskRect == null ? otherRect : otherTaskRect; - mDividerPositionX = dockedRect.right; + mDividerPositionX = mSplitLayout.getPrimarySplitSide() == DOCKED_RIGHT + ? otherRect.right : dockedRect.right; mDividerPositionY = dockedRect.bottom; if (DEBUG) { diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java index 3b8addb85d85..92f6b4a2d8c4 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/SplitDisplayLayout.java @@ -101,7 +101,16 @@ public class SplitDisplayLayout { } int getPrimarySplitSide() { - return mDisplayLayout.isLandscape() ? DOCKED_LEFT : DOCKED_TOP; + switch (mDisplayLayout.getNavigationBarPosition(mContext.getResources())) { + case DisplayLayout.NAV_BAR_BOTTOM: + return mDisplayLayout.isLandscape() ? DOCKED_LEFT : DOCKED_TOP; + case DisplayLayout.NAV_BAR_LEFT: + return DOCKED_RIGHT; + case DisplayLayout.NAV_BAR_RIGHT: + return DOCKED_LEFT; + default: + return DOCKED_INVALID; + } } boolean isMinimized() { diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java index 4652abfa0721..cfec1c07ff1d 100644 --- a/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java +++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayLayout.java @@ -27,6 +27,7 @@ import static android.view.Surface.ROTATION_0; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; +import android.annotation.IntDef; import android.annotation.NonNull; import android.content.ContentResolver; import android.content.Context; @@ -46,16 +47,27 @@ import android.view.Surface; import com.android.internal.R; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** * Contains information about the layout-properties of a display. This refers to internal layout * like insets/cutout/rotation. In general, this can be thought of as the System-UI analog to * DisplayPolicy. */ public class DisplayLayout { + @IntDef(prefix = { "NAV_BAR_" }, value = { + NAV_BAR_LEFT, + NAV_BAR_RIGHT, + NAV_BAR_BOTTOM, + }) + @Retention(RetentionPolicy.SOURCE) + public @interface NavBarPosition {} + // Navigation bar position values - private static final int NAV_BAR_LEFT = 1 << 0; - private static final int NAV_BAR_RIGHT = 1 << 1; - private static final int NAV_BAR_BOTTOM = 1 << 2; + public static final int NAV_BAR_LEFT = 1 << 0; + public static final int NAV_BAR_RIGHT = 1 << 1; + public static final int NAV_BAR_BOTTOM = 1 << 2; private int mUiMode; private int mWidth; @@ -214,6 +226,14 @@ public class DisplayLayout { } /** + * Gets navigation bar position for this layout + * @return Navigation bar position for this layout. + */ + public @NavBarPosition int getNavigationBarPosition(Resources res) { + return navigationBarPosition(res, mWidth, mHeight, mRotation); + } + + /** * Rotates bounds as if parentBounds and bounds are a group. The group is rotated by `delta` * 90-degree counter-clockwise increments. This assumes that parentBounds is at 0,0 and * remains at 0,0 after rotation. @@ -437,8 +457,8 @@ public class DisplayLayout { } /** Retrieve navigation bar position from resources based on rotation and size. */ - public static int navigationBarPosition(Resources res, int displayWidth, int displayHeight, - int rotation) { + public static @NavBarPosition int navigationBarPosition(Resources res, int displayWidth, + int displayHeight, int rotation) { boolean navBarCanMove = displayWidth != displayHeight && res.getBoolean( com.android.internal.R.bool.config_navBarCanMove); if (navBarCanMove && displayWidth > displayHeight) { |