diff options
| author | 2014-03-24 14:31:38 +0000 | |
|---|---|---|
| committer | 2014-03-24 14:31:38 +0000 | |
| commit | 557a93e104f1fec69ed05b2d0ff26c78bca4c5d6 (patch) | |
| tree | d7c92eda1b9002001b6ae15a8d7d4f586e83da5f | |
| parent | 88517170cbb09b45324d5b457a0e5e840cc7d09b (diff) | |
| parent | 2b74a24a52a8f685ea8e81ff7b4f55e724733267 (diff) | |
Merge "Set ScreenshotSurface secure if any secure content is shown."
| -rw-r--r-- | services/java/com/android/server/wm/ScreenRotationAnimation.java | 12 | ||||
| -rw-r--r-- | services/java/com/android/server/wm/WindowManagerService.java | 14 |
2 files changed, 22 insertions, 4 deletions
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java index e630737b40b7..f79896b4c256 100644 --- a/services/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java @@ -199,7 +199,8 @@ class ScreenRotationAnimation { } public ScreenRotationAnimation(Context context, DisplayContent displayContent, - SurfaceSession session, boolean inTransaction, boolean forceDefaultOrientation) { + SurfaceSession session, boolean inTransaction, boolean forceDefaultOrientation, + boolean isSecure) { mContext = context; mDisplayContent = displayContent; displayContent.getLogicalDisplayRect(mOriginalDisplayRect); @@ -241,16 +242,21 @@ class ScreenRotationAnimation { try { try { + int flags = SurfaceControl.HIDDEN; + if (isSecure) { + flags |= SurfaceControl.SECURE; + } + if (WindowManagerService.DEBUG_SURFACE_TRACE) { mSurfaceControl = new SurfaceTrace(session, "ScreenshotSurface", mWidth, mHeight, - PixelFormat.OPAQUE, SurfaceControl.HIDDEN); + PixelFormat.OPAQUE, flags); Slog.w(TAG, "ScreenRotationAnimation ctor: displayOffset=" + mOriginalDisplayRect.toShortString()); } else { mSurfaceControl = new SurfaceControl(session, "ScreenshotSurface", mWidth, mHeight, - PixelFormat.OPAQUE, SurfaceControl.HIDDEN); + PixelFormat.OPAQUE, flags); } // capture a screenshot into the surface we just created Surface sur = new Surface(); diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 5da3e3e20073..2ab7e3641e87 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -9921,9 +9921,21 @@ public class WindowManagerService extends IWindowManager.Stub screenRotationAnimation.kill(); } + // Check whether the current screen contains any secure content. + boolean isSecure = false; + final WindowList windows = getDefaultWindowListLocked(); + final int N = windows.size(); + for (int i = 0; i < N; i++) { + WindowState ws = windows.get(i); + if (ws.isOnScreen() && (ws.mAttrs.flags & FLAG_SECURE) != 0) { + isSecure = true; + break; + } + } + // TODO(multidisplay): rotation on main screen only. screenRotationAnimation = new ScreenRotationAnimation(mContext, displayContent, - mFxSession, inTransaction, mPolicy.isDefaultOrientationForced()); + mFxSession, inTransaction, mPolicy.isDefaultOrientationForced(), isSecure); mAnimator.setScreenRotationAnimationLocked(displayId, screenRotationAnimation); } } |