diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-04-21 17:26:39 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-05-16 13:08:07 -0700 |
commit | 68066c2f38e47b56f0510c56eafd827731a0dc08 (patch) | |
tree | 0c48dab5571260fcc03c864efbd4c638ad4d423e /core/java | |
parent | 29735689cea7bf52998c1911542dcfdd1c1d9628 (diff) | |
download | frameworks_base-68066c2f38e47b56f0510c56eafd827731a0dc08.zip frameworks_base-68066c2f38e47b56f0510c56eafd827731a0dc08.tar.gz frameworks_base-68066c2f38e47b56f0510c56eafd827731a0dc08.tar.bz2 |
DO NOT MERGE. From main -- Start work on simulating landscape/portrait when orientation is locked.
Not yet working, so turned off.
Also fix a bug where the display size configuration became inconsistent
after a configuration change -- we now figure out everything about the
display size when computing a new configuration.
Change-Id: Id155f133c0bf108508a225ef64ed3ca398a90a58
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/view/Display.java | 23 | ||||
-rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 9 |
2 files changed, 29 insertions, 3 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index 0ea461b..1d60066 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -200,8 +200,27 @@ public class Display { * @param outMetrics */ public void getMetrics(DisplayMetrics outMetrics) { - outMetrics.widthPixels = getWidth(); - outMetrics.heightPixels = getHeight(); + synchronized (mTmpPoint) { + getSize(mTmpPoint); + outMetrics.widthPixels = mTmpPoint.x; + outMetrics.heightPixels = mTmpPoint.y; + } + getNonSizeMetrics(outMetrics); + } + + /** + * Initialize a DisplayMetrics object from this display's data. + * + * @param outMetrics + * @hide + */ + public void getRealMetrics(DisplayMetrics outMetrics) { + outMetrics.widthPixels = getRealWidth(); + outMetrics.heightPixels = getRealHeight(); + getNonSizeMetrics(outMetrics); + } + + private void getNonSizeMetrics(DisplayMetrics outMetrics) { outMetrics.density = mDensity; outMetrics.densityDpi = (int)((mDensity*DisplayMetrics.DENSITY_DEFAULT)+.5f); outMetrics.scaledDensity= outMetrics.density; diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 03b3553..c7cf459 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -398,7 +398,7 @@ public interface WindowManagerPolicy { * display dimensions. */ public void setInitialDisplaySize(int width, int height); - + /** * Check permissions when adding a window. * @@ -826,6 +826,13 @@ public interface WindowManagerPolicy { boolean displayEnabled); /** + * Return the currently locked screen rotation, if any. Return + * Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, or + * Surface.ROTATION_270 if locked; return -1 if not locked. + */ + public int getLockedRotationLw(); + + /** * Called when the system is mostly done booting to determine whether * the system should go into safe mode. */ |