maxLayer = INT32_MAX;
}
sp<GraphicBuffer> buffer;
+ bool capturedSecureLayers = false;
status_t res = ScreenshotClient::capture(displayToken,
sourceCrop, width, height, minLayer, maxLayer, useIdentityTransform,
- rotation, captureSecureLayers, &buffer);
+ rotation, captureSecureLayers, &buffer, capturedSecureLayers);
if (res != NO_ERROR) {
return NULL;
}
buffer->getHeight(),
buffer->getPixelFormat(),
(jint)buffer->getUsage(),
- (jlong)buffer.get());
+ (jlong)buffer.get(),
+ capturedSecureLayers);
}
static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz,
jclass graphicsBufferClazz = FindClassOrDie(env, "android/graphics/GraphicBuffer");
gGraphicBufferClassInfo.clazz = MakeGlobalRefOrDie(env, graphicsBufferClazz);
gGraphicBufferClassInfo.builder = GetStaticMethodIDOrDie(env, graphicsBufferClazz,
- "createFromExisting", "(IIIIJ)Landroid/graphics/GraphicBuffer;");
+ "createFromExisting", "(IIIIJZ)Landroid/graphics/GraphicBuffer;");
return err;
}
private final int mHeight;
private final int mFormat;
private final int mUsage;
+ private final boolean mCapturedSecureLayers;
// Note: do not rename, this field is used by native code
private final long mNativeObject;
}
/**
- * Private use only. See {@link #create(int, int, int, int)}.
+ * Private use only. See {@link #create(int, int, int, int, boolean)}.
*/
- private GraphicBuffer(int width, int height, int format, int usage, long nativeObject) {
+ private GraphicBuffer(int width, int height, int format, int usage, long nativeObject,
+ boolean capturedSecureLayers) {
mWidth = width;
mHeight = height;
mFormat = format;
mUsage = usage;
mNativeObject = nativeObject;
+ mCapturedSecureLayers = capturedSecureLayers;
+ }
+
+ /**
+ * Private use only. See {@link #create(int, int, int, int)}.
+ */
+ private GraphicBuffer(int width, int height, int format, int usage, long nativeObject) {
+ this(width, height, format, usage, nativeObject, false);
}
/**
* @hide
*/
public static GraphicBuffer createFromExisting(int width, int height,
- int format, int usage, long unwrappedNativeObject) {
+ int format, int usage, long unwrappedNativeObject,
+ boolean capturedSecureLayers) {
long nativeObject = nWrapGraphicBuffer(unwrappedNativeObject);
if (nativeObject != 0) {
- return new GraphicBuffer(width, height, format, usage, nativeObject);
+ return new GraphicBuffer(width, height, format, usage, nativeObject,
+ capturedSecureLayers);
}
return null;
}
/**
+ * For SurfaceControl JNI. Provides and ignored value for capturedSecureLayers for backwards
+ * compatibility
+ * @hide
+ */
+ public static GraphicBuffer createFromExisting(int width, int height,
+ int format, int usage, long unwrappedNativeObject) {
+ return createFromExisting(width, height, format, usage, unwrappedNativeObject, false);
+ }
+
+ /**
+ * Returns true if the buffer contains visible secure layers.
+ */
+ public boolean doesContainSecureLayers() {
+ return mCapturedSecureLayers;
+ }
+
+ /**
* Returns the width of this buffer in pixels.
*/
public int getWidth() {