Merge "Clearing the DPI information, when forced Size is cleared"
This commit is contained in:
@@ -269,6 +269,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
/** For {@link #setForcedScalingMode} to apply flag {@link Display#FLAG_SCALING_DISABLED}. */
|
||||
static final int FORCE_SCALING_MODE_DISABLED = 1;
|
||||
|
||||
static final float INVALID_DPI = 0.0f;
|
||||
|
||||
@IntDef(prefix = { "FORCE_SCALING_MODE_" }, value = {
|
||||
FORCE_SCALING_MODE_AUTO,
|
||||
FORCE_SCALING_MODE_DISABLED
|
||||
@@ -2935,7 +2937,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
|
||||
/** If the given width and height equal to initial size, the setting will be cleared. */
|
||||
void setForcedSize(int width, int height) {
|
||||
// Can't force size higher than the maximal allowed
|
||||
setForcedSize(width, height, INVALID_DPI, INVALID_DPI);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the given width and height equal to initial size, the setting will be cleared.
|
||||
* If xPpi or yDpi is equal to {@link #INVALID_DPI}, the values are ignored.
|
||||
*/
|
||||
void setForcedSize(int width, int height, float xDPI, float yDPI) {
|
||||
// Can't force size higher than the maximal allowed
|
||||
if (mMaxUiWidth > 0 && width > mMaxUiWidth) {
|
||||
final float ratio = mMaxUiWidth / (float) width;
|
||||
height = (int) (height * ratio);
|
||||
@@ -2954,8 +2964,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
|
||||
Slog.i(TAG_WM, "Using new display size: " + width + "x" + height);
|
||||
updateBaseDisplayMetrics(width, height, mBaseDisplayDensity, mBaseDisplayPhysicalXDpi,
|
||||
mBaseDisplayPhysicalYDpi);
|
||||
updateBaseDisplayMetrics(width, height, mBaseDisplayDensity,
|
||||
xDPI != INVALID_DPI ? xDPI : mBaseDisplayPhysicalXDpi,
|
||||
yDPI != INVALID_DPI ? yDPI : mBaseDisplayPhysicalYDpi);
|
||||
reconfigureDisplayLocked();
|
||||
|
||||
if (!mIsSizeForced) {
|
||||
|
||||
@@ -5780,7 +5780,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
final DisplayContent displayContent = mRoot.getDisplayContent(displayId);
|
||||
if (displayContent != null) {
|
||||
displayContent.setForcedSize(displayContent.mInitialDisplayWidth,
|
||||
displayContent.mInitialDisplayHeight);
|
||||
displayContent.mInitialDisplayHeight,
|
||||
displayContent.mInitialPhysicalXDpi,
|
||||
displayContent.mInitialPhysicalXDpi);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user