Loading services/core/java/com/android/server/wm/WindowManagerService.java +97 −94 Original line number Diff line number Diff line Loading @@ -3663,10 +3663,8 @@ public class WindowManagerService extends IWindowManager.Stub // TODO(multidisplay): Change to the correct display. final WindowList windows = getDefaultWindowListLocked(); int pos = windows.size() - 1; while (pos >= 0) { for (int pos = windows.size() - 1; pos >= 0; --pos) { WindowState win = windows.get(pos); pos--; if (win.mAppToken != null) { // We hit an application window. so the orientation will be determined by the // app window. No point in continuing further. Loading Loading @@ -3742,14 +3740,12 @@ public class WindowManagerService extends IWindowManager.Stub // to use the orientation behind it, then just take whatever // orientation it has and ignores whatever is under it. lastFullscreen = atoken.appFullscreen; if (lastFullscreen && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { if (lastFullscreen && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken + " -- full screen, return " + or); return or; } // If this application has requested an explicit orientation, // then use it. // If this application has requested an explicit orientation, then use it. if (or != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken Loading Loading @@ -6367,13 +6363,12 @@ public class WindowManagerService extends IWindowManager.Stub screenRotationAnimation = mAnimator.getScreenRotationAnimationLocked(Display.DEFAULT_DISPLAY); // We need to update our screen size information to match the new // rotation. Note that this is redundant with the later call to // sendNewConfiguration() that must be called after this function // returns... however we need to do the screen size part of that // before then so we have the correct size to use when initializing // the rotation animation for the new rotation. computeScreenConfigurationLocked(null); // We need to update our screen size information to match the new rotation. If the rotation // has actually changed then this method will return true and, according to the comment at // the top of the method, the caller is obligated to call computeNewConfigurationLocked(). // By updating the Display info here it will be available to // computeScreenConfigurationLocked later. updateDisplayAndOrientationLocked(); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); if (!inTransaction) { Loading Loading @@ -7045,9 +7040,9 @@ public class WindowManagerService extends IWindowManager.Stub return sw; } private boolean computeScreenConfigurationLocked(Configuration config) { DisplayInfo updateDisplayAndOrientationLocked() { if (!mDisplayReady) { return false; return null; } // TODO(multidisplay): For now, apply Configuration to main screen only. Loading Loading @@ -7079,11 +7074,6 @@ public class WindowManagerService extends IWindowManager.Stub } } if (config != null) { config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; } // Update application display metrics. final int appWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation); final int appHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation); Loading @@ -7106,21 +7096,35 @@ public class WindowManagerService extends IWindowManager.Stub Slog.i(TAG, "Set app display size: " + appWidth + " x " + appHeight); } final DisplayMetrics dm = mDisplayMetrics; mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm, mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(mDisplayMetrics, mCompatDisplayMetrics); return displayInfo; } if (config != null) { config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(dw, dh, mRotation) / dm.density); config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(dw, dh, mRotation) / dm.density); computeSizeRangesAndScreenLayout(displayInfo, rotated, dw, dh, dm.density, config); boolean computeScreenConfigurationLocked(Configuration config) { final DisplayInfo displayInfo = updateDisplayAndOrientationLocked(); if (displayInfo == null) { return false; } final int dw = displayInfo.logicalWidth; final int dh = displayInfo.logicalHeight; config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(dw, dh, mRotation) / mDisplayMetrics.density); config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(dw, dh, mRotation) / mDisplayMetrics.density); final boolean rotated = (mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270); computeSizeRangesAndScreenLayout(displayInfo, rotated, dw, dh, mDisplayMetrics.density, config); config.compatScreenWidthDp = (int)(config.screenWidthDp / mCompatibleScreenScale); config.compatScreenHeightDp = (int)(config.screenHeightDp / mCompatibleScreenScale); config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, dm, dw, dh); config.densityDpi = displayContent.mBaseDisplayDensity; config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, mDisplayMetrics, dw, dh); config.densityDpi = displayInfo.logicalDensityDpi; // Update the configuration based on available input devices, lid switch, // and platform configuration. Loading Loading @@ -7186,7 +7190,6 @@ public class WindowManagerService extends IWindowManager.Stub config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO; config.navigationHidden = Configuration.NAVIGATIONHIDDEN_NO; mPolicy.adjustConfigurationLw(config, keyboardPresence, navigationPresence); } return true; } Loading Loading
services/core/java/com/android/server/wm/WindowManagerService.java +97 −94 Original line number Diff line number Diff line Loading @@ -3663,10 +3663,8 @@ public class WindowManagerService extends IWindowManager.Stub // TODO(multidisplay): Change to the correct display. final WindowList windows = getDefaultWindowListLocked(); int pos = windows.size() - 1; while (pos >= 0) { for (int pos = windows.size() - 1; pos >= 0; --pos) { WindowState win = windows.get(pos); pos--; if (win.mAppToken != null) { // We hit an application window. so the orientation will be determined by the // app window. No point in continuing further. Loading Loading @@ -3742,14 +3740,12 @@ public class WindowManagerService extends IWindowManager.Stub // to use the orientation behind it, then just take whatever // orientation it has and ignores whatever is under it. lastFullscreen = atoken.appFullscreen; if (lastFullscreen && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { if (lastFullscreen && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken + " -- full screen, return " + or); return or; } // If this application has requested an explicit orientation, // then use it. // If this application has requested an explicit orientation, then use it. if (or != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { if (DEBUG_ORIENTATION) Slog.v(TAG, "Done at " + atoken Loading Loading @@ -6367,13 +6363,12 @@ public class WindowManagerService extends IWindowManager.Stub screenRotationAnimation = mAnimator.getScreenRotationAnimationLocked(Display.DEFAULT_DISPLAY); // We need to update our screen size information to match the new // rotation. Note that this is redundant with the later call to // sendNewConfiguration() that must be called after this function // returns... however we need to do the screen size part of that // before then so we have the correct size to use when initializing // the rotation animation for the new rotation. computeScreenConfigurationLocked(null); // We need to update our screen size information to match the new rotation. If the rotation // has actually changed then this method will return true and, according to the comment at // the top of the method, the caller is obligated to call computeNewConfigurationLocked(). // By updating the Display info here it will be available to // computeScreenConfigurationLocked later. updateDisplayAndOrientationLocked(); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); if (!inTransaction) { Loading Loading @@ -7045,9 +7040,9 @@ public class WindowManagerService extends IWindowManager.Stub return sw; } private boolean computeScreenConfigurationLocked(Configuration config) { DisplayInfo updateDisplayAndOrientationLocked() { if (!mDisplayReady) { return false; return null; } // TODO(multidisplay): For now, apply Configuration to main screen only. Loading Loading @@ -7079,11 +7074,6 @@ public class WindowManagerService extends IWindowManager.Stub } } if (config != null) { config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; } // Update application display metrics. final int appWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation); final int appHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation); Loading @@ -7106,21 +7096,35 @@ public class WindowManagerService extends IWindowManager.Stub Slog.i(TAG, "Set app display size: " + appWidth + " x " + appHeight); } final DisplayMetrics dm = mDisplayMetrics; mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm, mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(mDisplayMetrics, mCompatDisplayMetrics); return displayInfo; } if (config != null) { config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(dw, dh, mRotation) / dm.density); config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(dw, dh, mRotation) / dm.density); computeSizeRangesAndScreenLayout(displayInfo, rotated, dw, dh, dm.density, config); boolean computeScreenConfigurationLocked(Configuration config) { final DisplayInfo displayInfo = updateDisplayAndOrientationLocked(); if (displayInfo == null) { return false; } final int dw = displayInfo.logicalWidth; final int dh = displayInfo.logicalHeight; config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE; config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(dw, dh, mRotation) / mDisplayMetrics.density); config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(dw, dh, mRotation) / mDisplayMetrics.density); final boolean rotated = (mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270); computeSizeRangesAndScreenLayout(displayInfo, rotated, dw, dh, mDisplayMetrics.density, config); config.compatScreenWidthDp = (int)(config.screenWidthDp / mCompatibleScreenScale); config.compatScreenHeightDp = (int)(config.screenHeightDp / mCompatibleScreenScale); config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, dm, dw, dh); config.densityDpi = displayContent.mBaseDisplayDensity; config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, mDisplayMetrics, dw, dh); config.densityDpi = displayInfo.logicalDensityDpi; // Update the configuration based on available input devices, lid switch, // and platform configuration. Loading Loading @@ -7186,7 +7190,6 @@ public class WindowManagerService extends IWindowManager.Stub config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO; config.navigationHidden = Configuration.NAVIGATIONHIDDEN_NO; mPolicy.adjustConfigurationLw(config, keyboardPresence, navigationPresence); } return true; } Loading