Loading services/core/java/com/android/server/am/ActivityDisplay.java +23 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,23 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> setBounds(0, 0, mTmpDisplaySize.x, mTmpDisplaySize.y); } void onDisplayChanged() { // The window policy is responsible for stopping activities on the default display. final int displayId = mDisplay.getDisplayId(); if (displayId != DEFAULT_DISPLAY) { final int displayState = mDisplay.getState(); if (displayState == Display.STATE_OFF && mOffToken == null) { mOffToken = mSupervisor.mService.acquireSleepToken("Display-off", displayId); } else if (displayState == Display.STATE_ON && mOffToken != null) { mOffToken.release(); mOffToken = null; } } updateBounds(); mWindowContainerController.onDisplayChanged(); } void addChild(ActivityStack stack, int position) { if (position == POSITION_BOTTOM) { position = 0; Loading Loading @@ -1021,6 +1038,12 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> releaseSelfIfNeeded(); mSupervisor.getKeyguardController().onDisplayRemoved(mDisplayId); if (!mAllSleepTokens.isEmpty()) { mSupervisor.mSleepTokens.removeAll(mAllSleepTokens); mAllSleepTokens.clear(); mSupervisor.mService.updateSleepIfNeededLocked(); } } private void releaseSelfIfNeeded() { Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +21 −75 Original line number Diff line number Diff line Loading @@ -226,9 +226,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D static final int RESUME_TOP_ACTIVITY_MSG = FIRST_SUPERVISOR_STACK_MSG + 2; static final int SLEEP_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 3; static final int LAUNCH_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 4; static final int HANDLE_DISPLAY_ADDED = FIRST_SUPERVISOR_STACK_MSG + 5; static final int HANDLE_DISPLAY_CHANGED = FIRST_SUPERVISOR_STACK_MSG + 6; static final int HANDLE_DISPLAY_REMOVED = FIRST_SUPERVISOR_STACK_MSG + 7; static final int LAUNCH_TASK_BEHIND_COMPLETE = FIRST_SUPERVISOR_STACK_MSG + 12; static final int REPORT_MULTI_WINDOW_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 14; static final int REPORT_PIP_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 15; Loading Loading @@ -675,7 +672,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D setWindowContainerController(new RootWindowContainerController(this)); mDisplayManager = mService.mContext.getSystemService(DisplayManager.class); mDisplayManager.registerDisplayListener(this, null); mDisplayManager.registerDisplayListener(this, mHandler); mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); final Display[] displays = mDisplayManager.getDisplays(); Loading Loading @@ -4108,25 +4105,37 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D @Override public void onDisplayAdded(int displayId) { if (DEBUG_STACK) Slog.v(TAG, "Display added displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_ADDED, displayId, 0)); synchronized (mService.mGlobalLock) { getActivityDisplayOrCreateLocked(displayId); mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); } } @Override public void onDisplayRemoved(int displayId) { if (DEBUG_STACK) Slog.v(TAG, "Display removed displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_REMOVED, displayId, 0)); if (displayId == DEFAULT_DISPLAY) { throw new IllegalArgumentException("Can't remove the primary display."); } synchronized (mService.mGlobalLock) { final ActivityDisplay activityDisplay = getActivityDisplay(displayId); if (activityDisplay == null) { return; } activityDisplay.remove(); } } @Override public void onDisplayChanged(int displayId) { if (DEBUG_STACK) Slog.v(TAG, "Display changed displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_CHANGED, displayId, 0)); } private void handleDisplayAdded(int displayId) { synchronized (mService.mGlobalLock) { getActivityDisplayOrCreateLocked(displayId); mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); final ActivityDisplay activityDisplay = getActivityDisplay(displayId); if (activityDisplay != null) { activityDisplay.onDisplayChanged(); } } } Loading Loading @@ -4173,7 +4182,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // The display hasn't been added to ActivityManager yet, create a new record now. activityDisplay = new ActivityDisplay(this, display); addChild(activityDisplay, ActivityDisplay.POSITION_BOTTOM); mWindowManager.onDisplayAdded(displayId); return activityDisplay; } Loading @@ -4199,47 +4207,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mDefaultMinSizeOfResizeableTaskDp = (int) (minimalSize / dm.density); } private void handleDisplayRemoved(int displayId) { if (displayId == DEFAULT_DISPLAY) { throw new IllegalArgumentException("Can't remove the primary display."); } synchronized (mService.mGlobalLock) { final ActivityDisplay activityDisplay = getActivityDisplay(displayId); if (activityDisplay == null) { return; } activityDisplay.remove(); releaseSleepTokens(activityDisplay); } } private void handleDisplayChanged(int displayId) { synchronized (mService.mGlobalLock) { ActivityDisplay activityDisplay = getActivityDisplay(displayId); // TODO: The following code block should be moved into {@link ActivityDisplay}. if (activityDisplay != null) { // The window policy is responsible for stopping activities on the default display if (displayId != Display.DEFAULT_DISPLAY) { int displayState = activityDisplay.mDisplay.getState(); if (displayState == Display.STATE_OFF && activityDisplay.mOffToken == null) { activityDisplay.mOffToken = mService.acquireSleepToken("Display-off", displayId); } else if (displayState == Display.STATE_ON && activityDisplay.mOffToken != null) { activityDisplay.mOffToken.release(); activityDisplay.mOffToken = null; } } activityDisplay.updateBounds(); } mWindowManager.onDisplayChanged(displayId); } } SleepToken createSleepTokenLocked(String tag, int displayId) { final ActivityDisplay display = getActivityDisplay(displayId); if (display == null) { Loading @@ -4264,18 +4231,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } private void releaseSleepTokens(ActivityDisplay display) { if (display.mAllSleepTokens.isEmpty()) { return; } for (SleepToken token : display.mAllSleepTokens) { mSleepTokens.remove(token); } display.mAllSleepTokens.clear(); mService.updateSleepIfNeededLocked(); } private StackInfo getStackInfo(ActivityStack stack) { final int displayId = stack.mDisplayId; final ActivityDisplay display = getActivityDisplay(displayId); Loading Loading @@ -4597,15 +4552,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } } break; case HANDLE_DISPLAY_ADDED: { handleDisplayAdded(msg.arg1); } break; case HANDLE_DISPLAY_CHANGED: { handleDisplayChanged(msg.arg1); } break; case HANDLE_DISPLAY_REMOVED: { handleDisplayRemoved(msg.arg1); } break; case LAUNCH_TASK_BEHIND_COMPLETE: { synchronized (mService.mGlobalLock) { ActivityRecord r = ActivityRecord.forTokenLocked((IBinder) msg.obj); Loading services/core/java/com/android/server/wm/DisplayContent.java +86 −2 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.READY_TO_SHOW; import android.annotation.CallSuper; import android.annotation.IntDef; import android.annotation.NonNull; import android.content.pm.PackageManager; import android.content.res.CompatibilityInfo; Loading @@ -137,6 +138,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.Slog; Loading @@ -162,6 +164,8 @@ import com.android.server.wm.utils.RotationCache; import com.android.server.wm.utils.WmDisplayCutout; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; Loading @@ -183,6 +187,18 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo implements WindowManagerPolicy.DisplayContentInfo { private static final String TAG = TAG_WITH_CLASS_NAME ? "DisplayContent" : TAG_WM; /** The default scaling mode that scales content automatically. */ static final int FORCE_SCALING_MODE_AUTO = 0; /** For {@link #setForcedScalingMode} to apply flag {@link Display#FLAG_SCALING_DISABLED}. */ static final int FORCE_SCALING_MODE_DISABLED = 1; @IntDef(prefix = { "FORCE_SCALING_MODE_" }, value = { FORCE_SCALING_MODE_AUTO, FORCE_SCALING_MODE_DISABLED }) @Retention(RetentionPolicy.SOURCE) @interface ForceScalingMode {} /** Unique identifier of this stack. */ private final int mDisplayId; Loading Loading @@ -237,6 +253,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo * @see WindowManagerService#setForcedDisplayDensityForUser(int, int, int) */ int mBaseDisplayDensity = 0; /** * Whether to disable display scaling. This can be set via shell command "adb shell wm scaling". * @see WindowManagerService#setForcedDisplayScalingMode(int, int) */ boolean mDisplayScalingDisabled; private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Display mDisplay; Loading Loading @@ -836,6 +857,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // {@link DisplayContent} ready for use. mDisplayReady = true; mService.mAnimator.addDisplayLocked(mDisplayId); mInputMonitor = new InputMonitor(service, mDisplayId); if (mService.mInputManager != null) { Loading Loading @@ -1790,7 +1812,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // The display size information is heavily dependent on the resources in the current // configuration, so we need to reconfigure it every time the configuration changes. // See {@link PhoneWindowManager#setInitialDisplaySize}...sigh... // See {@link #configureDisplayPolicy}...sigh... mService.reconfigureDisplayLocked(this); final DockedStackDividerController dividerController = getDockedDividerController(); Loading Loading @@ -2027,6 +2049,68 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo updateBounds(); } /** * Forces this display to use the specified density. * * @param density The density in DPI to use. If the value equals to initial density, the setting * will be cleared. * @param userId The target user to apply. Only meaningful when this is default display. If the * user id is {@link UserHandle#USER_CURRENT}, it means to apply current settings * so only need to configure display. */ void setForcedDensity(int density, int userId) { final boolean clear = density == mInitialDisplayDensity; final boolean updateCurrent = userId == UserHandle.USER_CURRENT; if (mService.mCurrentUserId == userId || updateCurrent) { mBaseDisplayDensity = density; mService.reconfigureDisplayLocked(this); } if (updateCurrent) { // We are applying existing settings so no need to save it again. return; } if (density == mInitialDisplayDensity) { density = 0; } mService.mDisplaySettings.setForcedDensity(this, density, userId); } /** @param mode {@link #FORCE_SCALING_MODE_AUTO} or {@link #FORCE_SCALING_MODE_DISABLED}. */ void setForcedScalingMode(@ForceScalingMode int mode) { if (mode != FORCE_SCALING_MODE_DISABLED) { mode = FORCE_SCALING_MODE_AUTO; } mDisplayScalingDisabled = (mode != FORCE_SCALING_MODE_AUTO); Slog.i(TAG_WM, "Using display scaling mode: " + (mDisplayScalingDisabled ? "off" : "auto")); mService.reconfigureDisplayLocked(this); mService.mDisplaySettings.setForcedScalingMode(this, mode); } /** If the given width and height equal to initial size, the setting will be cleared. */ void setForcedSize(int width, int height) { final boolean clear = mInitialDisplayWidth == width && mInitialDisplayHeight == height; if (!clear) { // Set some sort of reasonable bounds on the size of the display that we will try // to emulate. final int minSize = 200; final int maxScale = 2; width = Math.min(Math.max(width, minSize), mInitialDisplayWidth * maxScale); height = Math.min(Math.max(height, minSize), mInitialDisplayHeight * maxScale); } Slog.i(TAG_WM, "Using new display size: " + width + "x" + height); updateBaseDisplayMetrics(width, height, mBaseDisplayDensity); mService.reconfigureDisplayLocked(this); if (clear) { width = height = 0; } mService.mDisplaySettings.setForcedSize(this, width, height); } void getStableRect(Rect out) { out.set(mDisplayFrames.mStable); } Loading Loading @@ -2225,7 +2309,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } mInputMonitor.onRemoved(); mService.onDisplayRemoved(mDisplayId); mService.mWindowPlacerLocked.requestTraversal(); } /** Returns true if a removal action is still being deferred. */ Loading services/core/java/com/android/server/wm/DisplayRotation.java +0 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,6 @@ public class DisplayRotation { if (changed) { mService.updateRotation(true /* alwaysSendConfiguration */, false /* forceRelayout */); mService.mDisplaySettings.writeSettingsLocked(); } } Loading services/core/java/com/android/server/wm/DisplaySettings.java +118 −79 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/core/java/com/android/server/am/ActivityDisplay.java +23 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,23 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> setBounds(0, 0, mTmpDisplaySize.x, mTmpDisplaySize.y); } void onDisplayChanged() { // The window policy is responsible for stopping activities on the default display. final int displayId = mDisplay.getDisplayId(); if (displayId != DEFAULT_DISPLAY) { final int displayState = mDisplay.getState(); if (displayState == Display.STATE_OFF && mOffToken == null) { mOffToken = mSupervisor.mService.acquireSleepToken("Display-off", displayId); } else if (displayState == Display.STATE_ON && mOffToken != null) { mOffToken.release(); mOffToken = null; } } updateBounds(); mWindowContainerController.onDisplayChanged(); } void addChild(ActivityStack stack, int position) { if (position == POSITION_BOTTOM) { position = 0; Loading Loading @@ -1021,6 +1038,12 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> releaseSelfIfNeeded(); mSupervisor.getKeyguardController().onDisplayRemoved(mDisplayId); if (!mAllSleepTokens.isEmpty()) { mSupervisor.mSleepTokens.removeAll(mAllSleepTokens); mAllSleepTokens.clear(); mSupervisor.mService.updateSleepIfNeededLocked(); } } private void releaseSelfIfNeeded() { Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +21 −75 Original line number Diff line number Diff line Loading @@ -226,9 +226,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D static final int RESUME_TOP_ACTIVITY_MSG = FIRST_SUPERVISOR_STACK_MSG + 2; static final int SLEEP_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 3; static final int LAUNCH_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG + 4; static final int HANDLE_DISPLAY_ADDED = FIRST_SUPERVISOR_STACK_MSG + 5; static final int HANDLE_DISPLAY_CHANGED = FIRST_SUPERVISOR_STACK_MSG + 6; static final int HANDLE_DISPLAY_REMOVED = FIRST_SUPERVISOR_STACK_MSG + 7; static final int LAUNCH_TASK_BEHIND_COMPLETE = FIRST_SUPERVISOR_STACK_MSG + 12; static final int REPORT_MULTI_WINDOW_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 14; static final int REPORT_PIP_MODE_CHANGED_MSG = FIRST_SUPERVISOR_STACK_MSG + 15; Loading Loading @@ -675,7 +672,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D setWindowContainerController(new RootWindowContainerController(this)); mDisplayManager = mService.mContext.getSystemService(DisplayManager.class); mDisplayManager.registerDisplayListener(this, null); mDisplayManager.registerDisplayListener(this, mHandler); mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); final Display[] displays = mDisplayManager.getDisplays(); Loading Loading @@ -4108,25 +4105,37 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D @Override public void onDisplayAdded(int displayId) { if (DEBUG_STACK) Slog.v(TAG, "Display added displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_ADDED, displayId, 0)); synchronized (mService.mGlobalLock) { getActivityDisplayOrCreateLocked(displayId); mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); } } @Override public void onDisplayRemoved(int displayId) { if (DEBUG_STACK) Slog.v(TAG, "Display removed displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_REMOVED, displayId, 0)); if (displayId == DEFAULT_DISPLAY) { throw new IllegalArgumentException("Can't remove the primary display."); } synchronized (mService.mGlobalLock) { final ActivityDisplay activityDisplay = getActivityDisplay(displayId); if (activityDisplay == null) { return; } activityDisplay.remove(); } } @Override public void onDisplayChanged(int displayId) { if (DEBUG_STACK) Slog.v(TAG, "Display changed displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_CHANGED, displayId, 0)); } private void handleDisplayAdded(int displayId) { synchronized (mService.mGlobalLock) { getActivityDisplayOrCreateLocked(displayId); mService.startHomeActivityLocked(mCurrentUser, "displayAdded", displayId); final ActivityDisplay activityDisplay = getActivityDisplay(displayId); if (activityDisplay != null) { activityDisplay.onDisplayChanged(); } } } Loading Loading @@ -4173,7 +4182,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D // The display hasn't been added to ActivityManager yet, create a new record now. activityDisplay = new ActivityDisplay(this, display); addChild(activityDisplay, ActivityDisplay.POSITION_BOTTOM); mWindowManager.onDisplayAdded(displayId); return activityDisplay; } Loading @@ -4199,47 +4207,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D mDefaultMinSizeOfResizeableTaskDp = (int) (minimalSize / dm.density); } private void handleDisplayRemoved(int displayId) { if (displayId == DEFAULT_DISPLAY) { throw new IllegalArgumentException("Can't remove the primary display."); } synchronized (mService.mGlobalLock) { final ActivityDisplay activityDisplay = getActivityDisplay(displayId); if (activityDisplay == null) { return; } activityDisplay.remove(); releaseSleepTokens(activityDisplay); } } private void handleDisplayChanged(int displayId) { synchronized (mService.mGlobalLock) { ActivityDisplay activityDisplay = getActivityDisplay(displayId); // TODO: The following code block should be moved into {@link ActivityDisplay}. if (activityDisplay != null) { // The window policy is responsible for stopping activities on the default display if (displayId != Display.DEFAULT_DISPLAY) { int displayState = activityDisplay.mDisplay.getState(); if (displayState == Display.STATE_OFF && activityDisplay.mOffToken == null) { activityDisplay.mOffToken = mService.acquireSleepToken("Display-off", displayId); } else if (displayState == Display.STATE_ON && activityDisplay.mOffToken != null) { activityDisplay.mOffToken.release(); activityDisplay.mOffToken = null; } } activityDisplay.updateBounds(); } mWindowManager.onDisplayChanged(displayId); } } SleepToken createSleepTokenLocked(String tag, int displayId) { final ActivityDisplay display = getActivityDisplay(displayId); if (display == null) { Loading @@ -4264,18 +4231,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } private void releaseSleepTokens(ActivityDisplay display) { if (display.mAllSleepTokens.isEmpty()) { return; } for (SleepToken token : display.mAllSleepTokens) { mSleepTokens.remove(token); } display.mAllSleepTokens.clear(); mService.updateSleepIfNeededLocked(); } private StackInfo getStackInfo(ActivityStack stack) { final int displayId = stack.mDisplayId; final ActivityDisplay display = getActivityDisplay(displayId); Loading Loading @@ -4597,15 +4552,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } } break; case HANDLE_DISPLAY_ADDED: { handleDisplayAdded(msg.arg1); } break; case HANDLE_DISPLAY_CHANGED: { handleDisplayChanged(msg.arg1); } break; case HANDLE_DISPLAY_REMOVED: { handleDisplayRemoved(msg.arg1); } break; case LAUNCH_TASK_BEHIND_COMPLETE: { synchronized (mService.mGlobalLock) { ActivityRecord r = ActivityRecord.forTokenLocked((IBinder) msg.obj); Loading
services/core/java/com/android/server/wm/DisplayContent.java +86 −2 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.READY_TO_SHOW; import android.annotation.CallSuper; import android.annotation.IntDef; import android.annotation.NonNull; import android.content.pm.PackageManager; import android.content.res.CompatibilityInfo; Loading @@ -137,6 +138,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.Slog; Loading @@ -162,6 +164,8 @@ import com.android.server.wm.utils.RotationCache; import com.android.server.wm.utils.WmDisplayCutout; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; Loading @@ -183,6 +187,18 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo implements WindowManagerPolicy.DisplayContentInfo { private static final String TAG = TAG_WITH_CLASS_NAME ? "DisplayContent" : TAG_WM; /** The default scaling mode that scales content automatically. */ static final int FORCE_SCALING_MODE_AUTO = 0; /** For {@link #setForcedScalingMode} to apply flag {@link Display#FLAG_SCALING_DISABLED}. */ static final int FORCE_SCALING_MODE_DISABLED = 1; @IntDef(prefix = { "FORCE_SCALING_MODE_" }, value = { FORCE_SCALING_MODE_AUTO, FORCE_SCALING_MODE_DISABLED }) @Retention(RetentionPolicy.SOURCE) @interface ForceScalingMode {} /** Unique identifier of this stack. */ private final int mDisplayId; Loading Loading @@ -237,6 +253,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo * @see WindowManagerService#setForcedDisplayDensityForUser(int, int, int) */ int mBaseDisplayDensity = 0; /** * Whether to disable display scaling. This can be set via shell command "adb shell wm scaling". * @see WindowManagerService#setForcedDisplayScalingMode(int, int) */ boolean mDisplayScalingDisabled; private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Display mDisplay; Loading Loading @@ -836,6 +857,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // {@link DisplayContent} ready for use. mDisplayReady = true; mService.mAnimator.addDisplayLocked(mDisplayId); mInputMonitor = new InputMonitor(service, mDisplayId); if (mService.mInputManager != null) { Loading Loading @@ -1790,7 +1812,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // The display size information is heavily dependent on the resources in the current // configuration, so we need to reconfigure it every time the configuration changes. // See {@link PhoneWindowManager#setInitialDisplaySize}...sigh... // See {@link #configureDisplayPolicy}...sigh... mService.reconfigureDisplayLocked(this); final DockedStackDividerController dividerController = getDockedDividerController(); Loading Loading @@ -2027,6 +2049,68 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo updateBounds(); } /** * Forces this display to use the specified density. * * @param density The density in DPI to use. If the value equals to initial density, the setting * will be cleared. * @param userId The target user to apply. Only meaningful when this is default display. If the * user id is {@link UserHandle#USER_CURRENT}, it means to apply current settings * so only need to configure display. */ void setForcedDensity(int density, int userId) { final boolean clear = density == mInitialDisplayDensity; final boolean updateCurrent = userId == UserHandle.USER_CURRENT; if (mService.mCurrentUserId == userId || updateCurrent) { mBaseDisplayDensity = density; mService.reconfigureDisplayLocked(this); } if (updateCurrent) { // We are applying existing settings so no need to save it again. return; } if (density == mInitialDisplayDensity) { density = 0; } mService.mDisplaySettings.setForcedDensity(this, density, userId); } /** @param mode {@link #FORCE_SCALING_MODE_AUTO} or {@link #FORCE_SCALING_MODE_DISABLED}. */ void setForcedScalingMode(@ForceScalingMode int mode) { if (mode != FORCE_SCALING_MODE_DISABLED) { mode = FORCE_SCALING_MODE_AUTO; } mDisplayScalingDisabled = (mode != FORCE_SCALING_MODE_AUTO); Slog.i(TAG_WM, "Using display scaling mode: " + (mDisplayScalingDisabled ? "off" : "auto")); mService.reconfigureDisplayLocked(this); mService.mDisplaySettings.setForcedScalingMode(this, mode); } /** If the given width and height equal to initial size, the setting will be cleared. */ void setForcedSize(int width, int height) { final boolean clear = mInitialDisplayWidth == width && mInitialDisplayHeight == height; if (!clear) { // Set some sort of reasonable bounds on the size of the display that we will try // to emulate. final int minSize = 200; final int maxScale = 2; width = Math.min(Math.max(width, minSize), mInitialDisplayWidth * maxScale); height = Math.min(Math.max(height, minSize), mInitialDisplayHeight * maxScale); } Slog.i(TAG_WM, "Using new display size: " + width + "x" + height); updateBaseDisplayMetrics(width, height, mBaseDisplayDensity); mService.reconfigureDisplayLocked(this); if (clear) { width = height = 0; } mService.mDisplaySettings.setForcedSize(this, width, height); } void getStableRect(Rect out) { out.set(mDisplayFrames.mStable); } Loading Loading @@ -2225,7 +2309,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } mInputMonitor.onRemoved(); mService.onDisplayRemoved(mDisplayId); mService.mWindowPlacerLocked.requestTraversal(); } /** Returns true if a removal action is still being deferred. */ Loading
services/core/java/com/android/server/wm/DisplayRotation.java +0 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,6 @@ public class DisplayRotation { if (changed) { mService.updateRotation(true /* alwaysSendConfiguration */, false /* forceRelayout */); mService.mDisplaySettings.writeSettingsLocked(); } } Loading
services/core/java/com/android/server/wm/DisplaySettings.java +118 −79 File changed.Preview size limit exceeded, changes collapsed. Show changes