Merge "Fix split task position behavior when landscape" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b770ca4746
@@ -1042,7 +1042,8 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
dockedTaskRect = dockedTaskRect == null ? dockedRect : dockedTaskRect;
|
dockedTaskRect = dockedTaskRect == null ? dockedRect : dockedTaskRect;
|
||||||
otherTaskRect = otherTaskRect == null ? otherRect : otherTaskRect;
|
otherTaskRect = otherTaskRect == null ? otherRect : otherTaskRect;
|
||||||
|
|
||||||
mDividerPositionX = dockedRect.right;
|
mDividerPositionX = mSplitLayout.getPrimarySplitSide() == DOCKED_RIGHT
|
||||||
|
? otherRect.right : dockedRect.right;
|
||||||
mDividerPositionY = dockedRect.bottom;
|
mDividerPositionY = dockedRect.bottom;
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|||||||
@@ -101,7 +101,16 @@ public class SplitDisplayLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getPrimarySplitSide() {
|
int getPrimarySplitSide() {
|
||||||
|
switch (mDisplayLayout.getNavigationBarPosition(mContext.getResources())) {
|
||||||
|
case DisplayLayout.NAV_BAR_BOTTOM:
|
||||||
return mDisplayLayout.isLandscape() ? DOCKED_LEFT : DOCKED_TOP;
|
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() {
|
boolean isMinimized() {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import static android.view.Surface.ROTATION_0;
|
|||||||
import static android.view.Surface.ROTATION_270;
|
import static android.view.Surface.ROTATION_270;
|
||||||
import static android.view.Surface.ROTATION_90;
|
import static android.view.Surface.ROTATION_90;
|
||||||
|
|
||||||
|
import android.annotation.IntDef;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -46,16 +47,27 @@ import android.view.Surface;
|
|||||||
|
|
||||||
import com.android.internal.R;
|
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
|
* 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
|
* like insets/cutout/rotation. In general, this can be thought of as the System-UI analog to
|
||||||
* DisplayPolicy.
|
* DisplayPolicy.
|
||||||
*/
|
*/
|
||||||
public class DisplayLayout {
|
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
|
// Navigation bar position values
|
||||||
private static final int NAV_BAR_LEFT = 1 << 0;
|
public static final int NAV_BAR_LEFT = 1 << 0;
|
||||||
private static final int NAV_BAR_RIGHT = 1 << 1;
|
public static final int NAV_BAR_RIGHT = 1 << 1;
|
||||||
private static final int NAV_BAR_BOTTOM = 1 << 2;
|
public static final int NAV_BAR_BOTTOM = 1 << 2;
|
||||||
|
|
||||||
private int mUiMode;
|
private int mUiMode;
|
||||||
private int mWidth;
|
private int mWidth;
|
||||||
@@ -213,6 +225,14 @@ public class DisplayLayout {
|
|||||||
outBounds.inset(mStableInsets);
|
outBounds.inset(mStableInsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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`
|
* 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
|
* 90-degree counter-clockwise increments. This assumes that parentBounds is at 0,0 and
|
||||||
@@ -437,8 +457,8 @@ public class DisplayLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Retrieve navigation bar position from resources based on rotation and size. */
|
/** Retrieve navigation bar position from resources based on rotation and size. */
|
||||||
public static int navigationBarPosition(Resources res, int displayWidth, int displayHeight,
|
public static @NavBarPosition int navigationBarPosition(Resources res, int displayWidth,
|
||||||
int rotation) {
|
int displayHeight, int rotation) {
|
||||||
boolean navBarCanMove = displayWidth != displayHeight && res.getBoolean(
|
boolean navBarCanMove = displayWidth != displayHeight && res.getBoolean(
|
||||||
com.android.internal.R.bool.config_navBarCanMove);
|
com.android.internal.R.bool.config_navBarCanMove);
|
||||||
if (navBarCanMove && displayWidth > displayHeight) {
|
if (navBarCanMove && displayWidth > displayHeight) {
|
||||||
|
|||||||
Reference in New Issue
Block a user