diff options
author | Tom Giordano <tomgiordano83@gmail.com> | 2012-01-24 22:51:01 +1100 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2015-11-07 13:45:03 -0800 |
commit | fde1085d3a90fc31c45e281c2824571a9c78bfbd (patch) | |
tree | 3950af4016a0c0b51db9174e63597cc1609ebc84 /packages/SystemUI | |
parent | 08cf74e62a3d477118670b58b687143ca55bbf78 (diff) | |
download | frameworks_base-fde1085d3a90fc31c45e281c2824571a9c78bfbd.zip frameworks_base-fde1085d3a90fc31c45e281c2824571a9c78bfbd.tar.gz frameworks_base-fde1085d3a90fc31c45e281c2824571a9c78bfbd.tar.bz2 |
framework: fix screenshot and rotation animation for devices with abnormal hw rotation
Change-Id: I42694931cb1a754aa6c7652c0a96304ef1f88492
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 9e3cf37..260f625 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -430,6 +430,7 @@ class GlobalScreenshot { private MediaActionSound mCameraSound; + private final int mSfHwRotation; /** * @param context everything needs a context :( @@ -496,6 +497,9 @@ class GlobalScreenshot { // Setup the Camera shutter sound mCameraSound = new MediaActionSound(); mCameraSound.load(MediaActionSound.SHUTTER_CLICK); + + // Load hardware rotation from prop + mSfHwRotation = android.os.SystemProperties.getInt("ro.sf.hwrotation",0) / 90; } /** @@ -539,7 +543,10 @@ class GlobalScreenshot { // only in the natural orientation of the device :!) mDisplay.getRealMetrics(mDisplayMetrics); float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels}; - float degrees = getDegreesForRotation(mDisplay.getRotation()); + int rot = mDisplay.getRotation(); + // Allow for abnormal hardware orientation + rot = (rot + mSfHwRotation) % 4; + float degrees = getDegreesForRotation(rot); boolean requiresRotation = (degrees > 0); if (requiresRotation) { // Get the dimensions of the device in its native orientation |