diff options
author | Michael Kolb <kolby@google.com> | 2014-04-24 16:08:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-04-24 16:08:21 +0000 |
commit | e597d5f9310f760843272c728d6fb1917abf241a (patch) | |
tree | df649e52238952f394318afbaa036c8b9058bb25 | |
parent | aed314e8f3e53627518222777c2fe89666bfd643 (diff) | |
parent | 8b275ca9d34792ba525771e0c1865b3262e569c9 (diff) | |
download | frameworks_base-e597d5f9310f760843272c728d6fb1917abf241a.zip frameworks_base-e597d5f9310f760843272c728d6fb1917abf241a.tar.gz frameworks_base-e597d5f9310f760843272c728d6fb1917abf241a.tar.bz2 |
Merge "Use rotation to position circular display mask" into klp-modular-dev
-rw-r--r-- | services/core/java/com/android/server/wm/CircularDisplayMask.java | 26 | ||||
-rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 8 |
2 files changed, 27 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/CircularDisplayMask.java b/services/core/java/com/android/server/wm/CircularDisplayMask.java index fbfca93..35d19c1 100644 --- a/services/core/java/com/android/server/wm/CircularDisplayMask.java +++ b/services/core/java/com/android/server/wm/CircularDisplayMask.java @@ -22,7 +22,6 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.Rect; -import android.util.Log; import android.view.Display; import android.view.Surface; import android.view.Surface.OutOfResourcesException; @@ -40,6 +39,7 @@ class CircularDisplayMask { private int mLastDH; private boolean mDrawNeeded; private Paint mPaint; + private int mRotation; public CircularDisplayMask(Display display, SurfaceSession session, int zOrder) { SurfaceControl ctrl = null; @@ -78,7 +78,26 @@ class CircularDisplayMask { if (c == null) { return; } - c.drawCircle(160, 160, 160, mPaint); + int cx = 160; + int cy = 160; + switch (mRotation) { + case Surface.ROTATION_0: + case Surface.ROTATION_90: + // chin bottom or right + cx = 160; + cy = 160; + break; + case Surface.ROTATION_180: + // chin top + cx = 160; + cy = 145; + break; + case Surface.ROTATION_270: + cx = 145; + cy = 160; + break; + } + c.drawCircle(cx, cy, 160, mPaint); mSurface.unlockCanvasAndPost(c); } @@ -97,7 +116,7 @@ class CircularDisplayMask { } } - void positionSurface(int dw, int dh) { + void positionSurface(int dw, int dh, int rotation) { if (mLastDW == dw && mLastDH == dh) { return; } @@ -105,6 +124,7 @@ class CircularDisplayMask { mLastDH = dh; mSurfaceControl.setSize(dw, dh); mDrawNeeded = true; + mRotation = rotation; } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 0a0ffd6..081cffd 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -290,8 +290,6 @@ public class WindowManagerService extends IWindowManager.Stub private static final String DENSITY_OVERRIDE = "ro.config.density_override"; private static final String SIZE_OVERRIDE = "ro.config.size_override"; - private static final String SCREEN_CIRCULAR = "ro.display.circular"; - private static final int MAX_SCREENSHOT_RETRIES = 3; final private KeyguardDisableHandler mKeyguardDisableHandler; @@ -5552,7 +5550,9 @@ public class WindowManagerService extends IWindowManager.Stub } public void showCircularDisplayMaskIfNeeded() { - if (SystemProperties.getBoolean(SCREEN_CIRCULAR, false)) { + // we're fullscreen and not hosted in an ActivityView + if (mContext.getResources().getBoolean( + com.android.internal.R.bool.config_windowIsRound)) { mH.sendMessage(mH.obtainMessage(H.SHOW_DISPLAY_MASK)); } } @@ -9077,7 +9077,7 @@ public class WindowManagerService extends IWindowManager.Stub mStrictModeFlash.positionSurface(defaultDw, defaultDh); } if (mCircularDisplayMask != null) { - mCircularDisplayMask.positionSurface(defaultDw, defaultDh); + mCircularDisplayMask.positionSurface(defaultDw, defaultDh, mRotation); } boolean focusDisplayed = false; |