Loading core/java/android/hardware/display/DisplayManagerInternal.java +9 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,15 @@ public abstract class DisplayManagerInternal { */ public abstract void setDisplayOffsets(int displayId, int x, int y); /** * Disables scaling for a display. * * @param displayId The logical display id to disable scaling for. * @param disableScaling {@code true} to disable scaling, * {@code false} to use the default scaling behavior of the logical display. */ public abstract void setDisplayScalingDisabled(int displayId, boolean disableScaling); /** * Provide a list of UIDs that are present on the display and are allowed to access it. * Loading services/core/java/com/android/server/display/DisplayManagerService.java +21 −0 Original line number Diff line number Diff line Loading @@ -1222,6 +1222,22 @@ public final class DisplayManagerService extends SystemService { } } private void setDisplayScalingDisabledInternal(int displayId, boolean disable) { synchronized (mSyncRoot) { final LogicalDisplay display = mLogicalDisplays.get(displayId); if (display == null) { return; } if (display.isDisplayScalingDisabled() != disable) { if (DEBUG) { Slog.d(TAG, "Display " + displayId + " content scaling disabled = " + disable); } display.setDisplayScalingDisabledLocked(disable); scheduleTraversalLocked(false); } } } // Updates the lists of UIDs that are present on displays. private void setDisplayAccessUIDsInternal(SparseArray<IntArray> newDisplayAccessUIDs) { synchronized (mSyncRoot) { Loading Loading @@ -2358,6 +2374,11 @@ public final class DisplayManagerService extends SystemService { setDisplayOffsetsInternal(displayId, x, y); } @Override public void setDisplayScalingDisabled(int displayId, boolean disableScaling) { setDisplayScalingDisabledInternal(displayId, disableScaling); } @Override public void setDisplayAccessUIDs(SparseArray<IntArray> newDisplayAccessUIDs) { setDisplayAccessUIDsInternal(newDisplayAccessUIDs); Loading services/core/java/com/android/server/display/LogicalDisplay.java +28 −1 Original line number Diff line number Diff line Loading @@ -94,6 +94,14 @@ final class LogicalDisplay { private int mDisplayOffsetX; private int mDisplayOffsetY; /** * {@code true} if display scaling is disabled, or {@code false} if the default scaling mode * is used. * @see #isDisplayScalingDisabled() * @see #setDisplayScalingDisabledLocked(boolean) */ private boolean mDisplayScalingDisabled; // Temporary rectangle used when needed. private final Rect mTempLayerStackRect = new Rect(); private final Rect mTempDisplayRect = new Rect(); Loading Loading @@ -397,7 +405,7 @@ final class LogicalDisplay { // multiplying the fractions by the product of their denominators before // comparing them. int displayRectWidth, displayRectHeight; if ((displayInfo.flags & Display.FLAG_SCALING_DISABLED) != 0) { if ((displayInfo.flags & Display.FLAG_SCALING_DISABLED) != 0 || mDisplayScalingDisabled) { displayRectWidth = displayInfo.logicalWidth; displayRectHeight = displayInfo.logicalHeight; } else if (physWidth * displayInfo.logicalHeight Loading Loading @@ -501,6 +509,24 @@ final class LogicalDisplay { mDisplayOffsetY = y; } /** * @return {@code true} if display scaling is disabled, or {@code false} if the default scaling * mode is used. */ public boolean isDisplayScalingDisabled() { return mDisplayScalingDisabled; } /** * Disables scaling for a display. * * @param disableScaling {@code true} to disable scaling, * {@code false} to use the default scaling behavior of the logical display. */ public void setDisplayScalingDisabledLocked(boolean disableScaling) { mDisplayScalingDisabled = disableScaling; } public void dumpLocked(PrintWriter pw) { pw.println("mDisplayId=" + mDisplayId); pw.println("mLayerStack=" + mLayerStack); Loading @@ -508,6 +534,7 @@ final class LogicalDisplay { pw.println("mRequestedMode=" + mRequestedModeId); pw.println("mRequestedColorMode=" + mRequestedColorMode); pw.println("mDisplayOffset=(" + mDisplayOffsetX + ", " + mDisplayOffsetY + ")"); pw.println("mDisplayScalingDisabled=" + mDisplayScalingDisabled); pw.println("mPrimaryDisplayDevice=" + (mPrimaryDisplayDevice != null ? mPrimaryDisplayDevice.getNameLocked() : "null")); pw.println("mBaseDisplayInfo=" + mBaseDisplayInfo); Loading services/core/java/com/android/server/policy/DisplayFoldController.java +3 −0 Original line number Diff line number Diff line Loading @@ -87,10 +87,13 @@ class DisplayFoldController { final int dy = (mNonOverrideDisplayInfo.logicalHeight - foldedArea.height()) / 2 - foldedArea.top; // Bypass scaling otherwise LogicalDisplay will scale contents by default. mDisplayManagerInternal.setDisplayScalingDisabled(mDisplayId, true); mWindowManagerInternal.setForcedDisplaySize(mDisplayId, foldedArea.width(), foldedArea.height()); mDisplayManagerInternal.setDisplayOffsets(mDisplayId, -dx, -dy); } else { mDisplayManagerInternal.setDisplayScalingDisabled(mDisplayId, false); mWindowManagerInternal.clearForcedDisplaySize(mDisplayId); mDisplayManagerInternal.setDisplayOffsets(mDisplayId, 0, 0); } Loading Loading
core/java/android/hardware/display/DisplayManagerInternal.java +9 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,15 @@ public abstract class DisplayManagerInternal { */ public abstract void setDisplayOffsets(int displayId, int x, int y); /** * Disables scaling for a display. * * @param displayId The logical display id to disable scaling for. * @param disableScaling {@code true} to disable scaling, * {@code false} to use the default scaling behavior of the logical display. */ public abstract void setDisplayScalingDisabled(int displayId, boolean disableScaling); /** * Provide a list of UIDs that are present on the display and are allowed to access it. * Loading
services/core/java/com/android/server/display/DisplayManagerService.java +21 −0 Original line number Diff line number Diff line Loading @@ -1222,6 +1222,22 @@ public final class DisplayManagerService extends SystemService { } } private void setDisplayScalingDisabledInternal(int displayId, boolean disable) { synchronized (mSyncRoot) { final LogicalDisplay display = mLogicalDisplays.get(displayId); if (display == null) { return; } if (display.isDisplayScalingDisabled() != disable) { if (DEBUG) { Slog.d(TAG, "Display " + displayId + " content scaling disabled = " + disable); } display.setDisplayScalingDisabledLocked(disable); scheduleTraversalLocked(false); } } } // Updates the lists of UIDs that are present on displays. private void setDisplayAccessUIDsInternal(SparseArray<IntArray> newDisplayAccessUIDs) { synchronized (mSyncRoot) { Loading Loading @@ -2358,6 +2374,11 @@ public final class DisplayManagerService extends SystemService { setDisplayOffsetsInternal(displayId, x, y); } @Override public void setDisplayScalingDisabled(int displayId, boolean disableScaling) { setDisplayScalingDisabledInternal(displayId, disableScaling); } @Override public void setDisplayAccessUIDs(SparseArray<IntArray> newDisplayAccessUIDs) { setDisplayAccessUIDsInternal(newDisplayAccessUIDs); Loading
services/core/java/com/android/server/display/LogicalDisplay.java +28 −1 Original line number Diff line number Diff line Loading @@ -94,6 +94,14 @@ final class LogicalDisplay { private int mDisplayOffsetX; private int mDisplayOffsetY; /** * {@code true} if display scaling is disabled, or {@code false} if the default scaling mode * is used. * @see #isDisplayScalingDisabled() * @see #setDisplayScalingDisabledLocked(boolean) */ private boolean mDisplayScalingDisabled; // Temporary rectangle used when needed. private final Rect mTempLayerStackRect = new Rect(); private final Rect mTempDisplayRect = new Rect(); Loading Loading @@ -397,7 +405,7 @@ final class LogicalDisplay { // multiplying the fractions by the product of their denominators before // comparing them. int displayRectWidth, displayRectHeight; if ((displayInfo.flags & Display.FLAG_SCALING_DISABLED) != 0) { if ((displayInfo.flags & Display.FLAG_SCALING_DISABLED) != 0 || mDisplayScalingDisabled) { displayRectWidth = displayInfo.logicalWidth; displayRectHeight = displayInfo.logicalHeight; } else if (physWidth * displayInfo.logicalHeight Loading Loading @@ -501,6 +509,24 @@ final class LogicalDisplay { mDisplayOffsetY = y; } /** * @return {@code true} if display scaling is disabled, or {@code false} if the default scaling * mode is used. */ public boolean isDisplayScalingDisabled() { return mDisplayScalingDisabled; } /** * Disables scaling for a display. * * @param disableScaling {@code true} to disable scaling, * {@code false} to use the default scaling behavior of the logical display. */ public void setDisplayScalingDisabledLocked(boolean disableScaling) { mDisplayScalingDisabled = disableScaling; } public void dumpLocked(PrintWriter pw) { pw.println("mDisplayId=" + mDisplayId); pw.println("mLayerStack=" + mLayerStack); Loading @@ -508,6 +534,7 @@ final class LogicalDisplay { pw.println("mRequestedMode=" + mRequestedModeId); pw.println("mRequestedColorMode=" + mRequestedColorMode); pw.println("mDisplayOffset=(" + mDisplayOffsetX + ", " + mDisplayOffsetY + ")"); pw.println("mDisplayScalingDisabled=" + mDisplayScalingDisabled); pw.println("mPrimaryDisplayDevice=" + (mPrimaryDisplayDevice != null ? mPrimaryDisplayDevice.getNameLocked() : "null")); pw.println("mBaseDisplayInfo=" + mBaseDisplayInfo); Loading
services/core/java/com/android/server/policy/DisplayFoldController.java +3 −0 Original line number Diff line number Diff line Loading @@ -87,10 +87,13 @@ class DisplayFoldController { final int dy = (mNonOverrideDisplayInfo.logicalHeight - foldedArea.height()) / 2 - foldedArea.top; // Bypass scaling otherwise LogicalDisplay will scale contents by default. mDisplayManagerInternal.setDisplayScalingDisabled(mDisplayId, true); mWindowManagerInternal.setForcedDisplaySize(mDisplayId, foldedArea.width(), foldedArea.height()); mDisplayManagerInternal.setDisplayOffsets(mDisplayId, -dx, -dy); } else { mDisplayManagerInternal.setDisplayScalingDisabled(mDisplayId, false); mWindowManagerInternal.clearForcedDisplaySize(mDisplayId); mDisplayManagerInternal.setDisplayOffsets(mDisplayId, 0, 0); } Loading