Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: Commit

frameworks/base


Commit MetaInfo

Revisión23516d9257d9a55e37be5863282f7b32c2c612aa (tree)
Tiempo2019-09-20 15:24:14
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Fix forceDefaultOrientation

Ignore screen size when determines mForceDefaultOrientation.

Fix the bug in the calculation of left and top of DisplayContent
when default orientation is forced. (by Ladehunter)

Cambiar Resumen

Diferencia

--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -2418,7 +2418,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
24182418 // so if the orientation is forced, we need to respect that no matter what.
24192419 final boolean isTv = mContext.getPackageManager().hasSystemFeature(
24202420 PackageManager.FEATURE_LEANBACK);
2421- mForceDefaultOrientation = ((longSizeDp >= 960 && shortSizeDp >= 720) || isCar || isTv) &&
2421+ mForceDefaultOrientation = /* ((longSizeDp >= 960 && shortSizeDp >= 720) || isCar || isTv) && */
24222422 res.getBoolean(com.android.internal.R.bool.config_forceDefaultOrientation) &&
24232423 // For debug purposes the next line turns this feature off with:
24242424 // $ adb shell setprop config.override_forced_orient true
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2932,12 +2932,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
29322932 // Uses same calculation as in LogicalDisplay#configureDisplayInTransactionLocked.
29332933 final int orientation = mDisplayInfo.rotation;
29342934 boolean rotated = (orientation == ROTATION_90 || orientation == ROTATION_270);
2935+ boolean forcedOrientation = mService.mPolicy.isDefaultOrientationForced();
29352936 final int physWidth = rotated ? mBaseDisplayHeight : mBaseDisplayWidth;
29362937 final int physHeight = rotated ? mBaseDisplayWidth : mBaseDisplayHeight;
29372938 int width = mDisplayInfo.logicalWidth;
2938- int left = (physWidth - width) / 2;
2939+ int left = forcedOrientation ? 0 : (physWidth - width) / 2;
29392940 int height = mDisplayInfo.logicalHeight;
2940- int top = (physHeight - height) / 2;
2941+ int top = forcedOrientation ? 0 : (physHeight - height) / 2;
29412942 out.set(left, top, left + width, top + height);
29422943 }
29432944
Show on old repository browser