Add SKIP_SCREENSHOT flag instead of using the window type.
The way WM tell SurfaceFlinger not to screenshot certain layers is by setting the window type WINDOW_TYPE_DONT_SCREENSHOT. This is a bit confusing since window type represents the type of window. Instead, use a new flag called SKIP_SCREENSHOT that is explicitly used to tell SF not to screenshot this layer. Test: Rounded corners aren't in screenshot Test: SurfaceViewSyncTest with blast enabled Fixes: 168943350 Change-Id: Iaafad35e7ce3d15ade25be18dde4862e2d126703
This commit is contained in:
@@ -316,11 +316,19 @@ public final class SurfaceControl implements Parcelable {
|
||||
public static final int HIDDEN = 0x00000004;
|
||||
|
||||
/**
|
||||
* Surface creation flag: The surface contains secure content, special
|
||||
* measures will be taken to disallow the surface's content to be copied
|
||||
* from another process. In particular, screenshots and VNC servers will
|
||||
* be disabled, but other measures can take place, for instance the
|
||||
* surface might not be hardware accelerated.
|
||||
* Surface creation flag: Skip this layer and its children when taking a screenshot. This
|
||||
* also includes mirroring and screen recording, so the layers with flag SKIP_SCREENSHOT
|
||||
* will not be included on non primary displays.
|
||||
* @hide
|
||||
*/
|
||||
public static final int SKIP_SCREENSHOT = 0x00000040;
|
||||
|
||||
/**
|
||||
* Surface creation flag: Special measures will be taken to disallow the surface's content to
|
||||
* be copied. In particular, screenshots and secondary, non-secure displays will render black
|
||||
* content instead of the surface content.
|
||||
*
|
||||
* @see #createDisplay(String, boolean)
|
||||
* @hide
|
||||
*/
|
||||
public static final int SECURE = 0x00000080;
|
||||
@@ -481,15 +489,6 @@ public final class SurfaceControl implements Parcelable {
|
||||
*/
|
||||
public static final int POWER_MODE_ON_SUSPEND = 4;
|
||||
|
||||
/**
|
||||
* A value for windowType used to indicate that the window should be omitted from screenshots
|
||||
* and display mirroring. A temporary workaround until we express such things with
|
||||
* the hierarchy.
|
||||
* TODO: b/64227542
|
||||
* @hide
|
||||
*/
|
||||
public static final int WINDOW_TYPE_DONT_SCREENSHOT = 441731;
|
||||
|
||||
/**
|
||||
* internal representation of how to interpret pixel value, used only to convert to ColorSpace.
|
||||
*/
|
||||
@@ -3287,6 +3286,22 @@ public final class SurfaceControl implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds or removes the flag SKIP_SCREENSHOT of the surface. Setting the flag is equivalent
|
||||
* to creating the Surface with the {@link #SKIP_SCREENSHOT} flag.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public Transaction setSkipScreenshot(SurfaceControl sc, boolean skipScrenshot) {
|
||||
checkPreconditions(sc);
|
||||
if (skipScrenshot) {
|
||||
nativeSetFlags(mNativeObject, sc.mNativeObject, SKIP_SCREENSHOT, SKIP_SCREENSHOT);
|
||||
} else {
|
||||
nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SKIP_SCREENSHOT);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the other transaction into this transaction, clearing the
|
||||
* other transaction as if it had been applied.
|
||||
|
||||
@@ -441,10 +441,6 @@ class WindowStateAnimator {
|
||||
return mSurfaceController;
|
||||
}
|
||||
|
||||
if ((mWin.mAttrs.privateFlags & PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY) != 0) {
|
||||
windowType = SurfaceControl.WINDOW_TYPE_DONT_SCREENSHOT;
|
||||
}
|
||||
|
||||
w.setHasSurface(false);
|
||||
|
||||
if (DEBUG_ANIM) {
|
||||
@@ -462,6 +458,10 @@ class WindowStateAnimator {
|
||||
flags |= SurfaceControl.SECURE;
|
||||
}
|
||||
|
||||
if ((mWin.mAttrs.privateFlags & PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY) != 0) {
|
||||
flags |= SurfaceControl.SKIP_SCREENSHOT;
|
||||
}
|
||||
|
||||
calculateSurfaceBounds(w, attrs, mTmpSize);
|
||||
final int width = mTmpSize.width();
|
||||
final int height = mTmpSize.height();
|
||||
|
||||
Reference in New Issue
Block a user