Merge "Update display size before updating 'ignore orientation request'"
This commit is contained in:
committed by
Android (Google) Code Review
commit
8d7fb9d8a6
@@ -2007,23 +2007,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
|
||||
void configureDisplayPolicy() {
|
||||
final int width = mBaseDisplayWidth;
|
||||
final int height = mBaseDisplayHeight;
|
||||
final int shortSize;
|
||||
final int longSize;
|
||||
if (width > height) {
|
||||
shortSize = height;
|
||||
longSize = width;
|
||||
} else {
|
||||
shortSize = width;
|
||||
longSize = height;
|
||||
}
|
||||
|
||||
final int shortSizeDp = shortSize * DENSITY_DEFAULT / mBaseDisplayDensity;
|
||||
final int longSizeDp = longSize * DENSITY_DEFAULT / mBaseDisplayDensity;
|
||||
|
||||
mDisplayPolicy.updateConfigurationAndScreenSizeDependentBehaviors();
|
||||
mDisplayRotation.configure(width, height, shortSizeDp, longSizeDp);
|
||||
mDisplayRotation.configure(mBaseDisplayWidth, mBaseDisplayHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2806,6 +2791,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
mIsSizeForced ? mBaseDisplayHeight : newHeight,
|
||||
mIsDensityForced ? mBaseDisplayDensity : newDensity);
|
||||
|
||||
configureDisplayPolicy();
|
||||
|
||||
if (physicalDisplayChanged) {
|
||||
// Reapply the rotation window settings, we are doing this after updating
|
||||
// the screen size and configuring display policy as the rotation depends
|
||||
// on the display size
|
||||
mWmService.mDisplayWindowSettings.applyRotationSettingsToDisplayLocked(this);
|
||||
}
|
||||
|
||||
// Real display metrics changed, so we should also update initial values.
|
||||
mInitialDisplayWidth = newWidth;
|
||||
mInitialDisplayHeight = newHeight;
|
||||
|
||||
@@ -294,7 +294,7 @@ public class DisplayRotation {
|
||||
currentUserRes.getBoolean(R.bool.config_allowSeamlessRotationDespiteNavBarMoving);
|
||||
}
|
||||
|
||||
void configure(int width, int height, int shortSizeDp, int longSizeDp) {
|
||||
void configure(int width, int height) {
|
||||
final Resources res = mContext.getResources();
|
||||
if (width > height) {
|
||||
mLandscapeRotation = Surface.ROTATION_0;
|
||||
|
||||
@@ -265,10 +265,6 @@ class DisplayWindowSettings {
|
||||
dc.mIsDensityForced = hasDensityOverride;
|
||||
dc.mIsSizeForced = hasSizeOverride;
|
||||
|
||||
final boolean ignoreOrientationRequest = settings.mIgnoreOrientationRequest != null
|
||||
? settings.mIgnoreOrientationRequest : false;
|
||||
dc.setIgnoreOrientationRequest(ignoreOrientationRequest);
|
||||
|
||||
final boolean ignoreDisplayCutout = settings.mIgnoreDisplayCutout != null
|
||||
? settings.mIgnoreDisplayCutout : false;
|
||||
dc.mIgnoreDisplayCutout = ignoreDisplayCutout;
|
||||
@@ -288,6 +284,15 @@ class DisplayWindowSettings {
|
||||
dc.mDontMoveToTop = dontMoveToTop;
|
||||
}
|
||||
|
||||
void applyRotationSettingsToDisplayLocked(DisplayContent dc) {
|
||||
final DisplayInfo displayInfo = dc.getDisplayInfo();
|
||||
final SettingsProvider.SettingsEntry settings = mSettingsProvider.getSettings(displayInfo);
|
||||
|
||||
final boolean ignoreOrientationRequest = settings.mIgnoreOrientationRequest != null
|
||||
? settings.mIgnoreOrientationRequest : false;
|
||||
dc.setIgnoreOrientationRequest(ignoreOrientationRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates settings for the given display after system features are loaded into window manager
|
||||
* service, e.g. if this device is PC and if this device supports freeform.
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.util.DisplayMetrics.DENSITY_DEFAULT;
|
||||
import static android.view.DisplayCutout.BOUNDS_POSITION_BOTTOM;
|
||||
import static android.view.DisplayCutout.BOUNDS_POSITION_LEFT;
|
||||
import static android.view.DisplayCutout.BOUNDS_POSITION_RIGHT;
|
||||
@@ -56,7 +55,6 @@ public class DisplayPolicyTestsBase extends WindowTestsBase {
|
||||
|
||||
static final int DISPLAY_WIDTH = 500;
|
||||
static final int DISPLAY_HEIGHT = 1000;
|
||||
static final int DISPLAY_DENSITY = 320;
|
||||
|
||||
static final int DISPLAY_CUTOUT_HEIGHT = 8;
|
||||
static final int IME_HEIGHT = 415;
|
||||
@@ -85,12 +83,7 @@ public class DisplayPolicyTestsBase extends WindowTestsBase {
|
||||
doReturn(true).when(mDisplayPolicy).hasNavigationBar();
|
||||
doReturn(true).when(mDisplayPolicy).hasStatusBar();
|
||||
|
||||
final int shortSizeDp =
|
||||
Math.min(DISPLAY_WIDTH, DISPLAY_HEIGHT) * DENSITY_DEFAULT / DISPLAY_DENSITY;
|
||||
final int longSizeDp =
|
||||
Math.min(DISPLAY_WIDTH, DISPLAY_HEIGHT) * DENSITY_DEFAULT / DISPLAY_DENSITY;
|
||||
mDisplayContent.getDisplayRotation().configure(
|
||||
DISPLAY_WIDTH, DISPLAY_HEIGHT, shortSizeDp, longSizeDp);
|
||||
mDisplayContent.getDisplayRotation().configure(DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
||||
mDisplayPolicy.onConfigurationChanged();
|
||||
|
||||
addWindow(mStatusBarWindow);
|
||||
|
||||
@@ -681,7 +681,7 @@ public class DisplayRotationTests {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link DisplayRotation#configure(int, int, int, int)} to configure {@link #mTarget}
|
||||
* Call {@link DisplayRotation#configure(int, int)} to configure {@link #mTarget}
|
||||
* according to given parameters.
|
||||
*/
|
||||
private void configureDisplayRotation(int displayOrientation, boolean isCar, boolean isTv) {
|
||||
@@ -709,9 +709,7 @@ public class DisplayRotationTests {
|
||||
when(mockPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK))
|
||||
.thenReturn(isTv);
|
||||
|
||||
final int shortSizeDp = (isCar || isTv) ? 540 : 720;
|
||||
final int longSizeDp = 960;
|
||||
mTarget.configure(width, height, shortSizeDp, longSizeDp);
|
||||
mTarget.configure(width, height);
|
||||
}
|
||||
|
||||
private void freezeRotation(int rotation) {
|
||||
|
||||
Reference in New Issue
Block a user