Loading core/java/android/provider/Settings.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -2544,6 +2544,13 @@ public final class Settings { public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = "lock_screen_owner_info_enabled"; "lock_screen_owner_info_enabled"; /** * The saved value for WindowManagerService.setForcedDisplaySize(). * Two integers separated by a comma. If unset, then use the real display size. * @hide */ public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; /** /** * Whether assisted GPS should be enabled or not. * Whether assisted GPS should be enabled or not. * @hide * @hide Loading services/java/com/android/server/wm/WindowManagerService.java +31 −1 Original line number Original line Diff line number Diff line Loading @@ -5998,6 +5998,10 @@ public class WindowManagerService extends IWindowManager.Stub } } mPolicy.systemReady(); mPolicy.systemReady(); synchronized (mWindowMap) { readForcedDisplaySizeLocked(); } } } // This is an animation that does nothing: it just immediately finishes // This is an animation that does nothing: it just immediately finishes Loading Loading @@ -6513,6 +6517,8 @@ public class WindowManagerService extends IWindowManager.Stub ? shortDimen : mInitialDisplayHeight; ? shortDimen : mInitialDisplayHeight; } } setForcedDisplaySizeLocked(width, height); setForcedDisplaySizeLocked(width, height); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DISPLAY_SIZE_FORCED, width + "," + height); } } } } Loading Loading @@ -6559,7 +6565,29 @@ public class WindowManagerService extends IWindowManager.Stub } } } } private void readForcedDisplaySizeLocked() { final String str = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.DISPLAY_SIZE_FORCED); if (str == null || str.length() == 0) { return; } final int pos = str.indexOf(','); if (pos <= 0 || str.lastIndexOf(',') != pos) { return; } int width, height; try { width = Integer.parseInt(str.substring(0, pos)); height = Integer.parseInt(str.substring(pos+1)); } catch (NumberFormatException ex) { return; } setForcedDisplaySizeLocked(width, height); } private void setForcedDisplaySizeLocked(int width, int height) { private void setForcedDisplaySizeLocked(int width, int height) { Slog.i(TAG, "Using new display size: " + width + "x" + height); mBaseDisplayWidth = width; mBaseDisplayWidth = width; mBaseDisplayHeight = height; mBaseDisplayHeight = height; mPolicy.setInitialDisplaySize(mBaseDisplayWidth, mBaseDisplayHeight); mPolicy.setInitialDisplaySize(mBaseDisplayWidth, mBaseDisplayHeight); Loading Loading @@ -6589,6 +6617,8 @@ public class WindowManagerService extends IWindowManager.Stub public void clearForcedDisplaySize() { public void clearForcedDisplaySize() { synchronized(mWindowMap) { synchronized(mWindowMap) { setForcedDisplaySizeLocked(mInitialDisplayWidth, mInitialDisplayHeight); setForcedDisplaySizeLocked(mInitialDisplayWidth, mInitialDisplayHeight); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DISPLAY_SIZE_FORCED, ""); } } } } Loading Loading
core/java/android/provider/Settings.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -2544,6 +2544,13 @@ public final class Settings { public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = public static final String LOCK_SCREEN_OWNER_INFO_ENABLED = "lock_screen_owner_info_enabled"; "lock_screen_owner_info_enabled"; /** * The saved value for WindowManagerService.setForcedDisplaySize(). * Two integers separated by a comma. If unset, then use the real display size. * @hide */ public static final String DISPLAY_SIZE_FORCED = "display_size_forced"; /** /** * Whether assisted GPS should be enabled or not. * Whether assisted GPS should be enabled or not. * @hide * @hide Loading
services/java/com/android/server/wm/WindowManagerService.java +31 −1 Original line number Original line Diff line number Diff line Loading @@ -5998,6 +5998,10 @@ public class WindowManagerService extends IWindowManager.Stub } } mPolicy.systemReady(); mPolicy.systemReady(); synchronized (mWindowMap) { readForcedDisplaySizeLocked(); } } } // This is an animation that does nothing: it just immediately finishes // This is an animation that does nothing: it just immediately finishes Loading Loading @@ -6513,6 +6517,8 @@ public class WindowManagerService extends IWindowManager.Stub ? shortDimen : mInitialDisplayHeight; ? shortDimen : mInitialDisplayHeight; } } setForcedDisplaySizeLocked(width, height); setForcedDisplaySizeLocked(width, height); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DISPLAY_SIZE_FORCED, width + "," + height); } } } } Loading Loading @@ -6559,7 +6565,29 @@ public class WindowManagerService extends IWindowManager.Stub } } } } private void readForcedDisplaySizeLocked() { final String str = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.DISPLAY_SIZE_FORCED); if (str == null || str.length() == 0) { return; } final int pos = str.indexOf(','); if (pos <= 0 || str.lastIndexOf(',') != pos) { return; } int width, height; try { width = Integer.parseInt(str.substring(0, pos)); height = Integer.parseInt(str.substring(pos+1)); } catch (NumberFormatException ex) { return; } setForcedDisplaySizeLocked(width, height); } private void setForcedDisplaySizeLocked(int width, int height) { private void setForcedDisplaySizeLocked(int width, int height) { Slog.i(TAG, "Using new display size: " + width + "x" + height); mBaseDisplayWidth = width; mBaseDisplayWidth = width; mBaseDisplayHeight = height; mBaseDisplayHeight = height; mPolicy.setInitialDisplaySize(mBaseDisplayWidth, mBaseDisplayHeight); mPolicy.setInitialDisplaySize(mBaseDisplayWidth, mBaseDisplayHeight); Loading Loading @@ -6589,6 +6617,8 @@ public class WindowManagerService extends IWindowManager.Stub public void clearForcedDisplaySize() { public void clearForcedDisplaySize() { synchronized(mWindowMap) { synchronized(mWindowMap) { setForcedDisplaySizeLocked(mInitialDisplayWidth, mInitialDisplayHeight); setForcedDisplaySizeLocked(mInitialDisplayWidth, mInitialDisplayHeight); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DISPLAY_SIZE_FORCED, ""); } } } } Loading