diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-10-23 17:35:57 -0700 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2012-10-23 20:37:40 -0700 |
| commit | f0681b34dffc1510cbd9c3da5c3a7e695553fa8d (patch) | |
| tree | 750cc9603cd0571c9a229117129b6c21ab61be24 /core/java/android/view/SurfaceView.java | |
| parent | 56e75631bd737e5362309330d4839cc1dddb501c (diff) | |
Secure windows, secure surface views and secure displays.
Add new API to determine whether a display is secure.
Add new API to make a SurfaceView secure.
Clarify documentation.
Bug: 7368436
Change-Id: I7068c34c910e43b4bc72e43fa0dded59a25f0fe2
Diffstat (limited to 'core/java/android/view/SurfaceView.java')
| -rw-r--r-- | core/java/android/view/SurfaceView.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 0d16dd31b0bc..9008521e3b1d 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -385,7 +385,27 @@ public class SurfaceView extends View { mLayout.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; } } - + + /** + * Control whether the surface view's content should be treated as secure, + * preventing it from appearing in screenshots or from being viewed on + * non-secure displays. + * + * <p>Note that this must be set before the surface view's containing + * window is attached to the window manager. + * + * <p>See {@link android.view.Display#FLAG_SECURE} for details. + * + * @param isSecure True if the surface view is secure. + */ + public void setSecure(boolean isSecure) { + if (isSecure) { + mLayout.flags |= WindowManager.LayoutParams.FLAG_SECURE; + } else { + mLayout.flags &= ~WindowManager.LayoutParams.FLAG_SECURE; + } + } + /** * Hack to allow special layering of windows. The type is one of the * types in WindowManager.LayoutParams. This is a hack so: |
