Add uid to CaptureArgs.
Expose uid to the CaptureArgs in Java and JNI. The implementation in native is already merged. Test: Builds Bug: 155825630 Change-Id: I66e8870bfbf84a089387b73751cddbac253f9781
This commit is contained in:
@@ -654,6 +654,7 @@ public final class SurfaceControl implements Parcelable {
|
||||
private final float mFrameScale;
|
||||
private final boolean mCaptureSecureLayers;
|
||||
private final boolean mAllowProtected;
|
||||
private final long mUid;
|
||||
|
||||
private CaptureArgs(Builder<? extends Builder<?>> builder) {
|
||||
mPixelFormat = builder.mPixelFormat;
|
||||
@@ -661,6 +662,7 @@ public final class SurfaceControl implements Parcelable {
|
||||
mFrameScale = builder.mFrameScale;
|
||||
mCaptureSecureLayers = builder.mCaptureSecureLayers;
|
||||
mAllowProtected = builder.mAllowProtected;
|
||||
mUid = builder.mUid;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -674,6 +676,7 @@ public final class SurfaceControl implements Parcelable {
|
||||
private float mFrameScale = 1;
|
||||
private boolean mCaptureSecureLayers;
|
||||
private boolean mAllowProtected;
|
||||
private long mUid = -1;
|
||||
|
||||
/**
|
||||
* The desired pixel format of the returned buffer.
|
||||
@@ -722,6 +725,15 @@ public final class SurfaceControl implements Parcelable {
|
||||
return getThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the uid of the content that should be screenshot. The code will skip any surfaces
|
||||
* that don't belong to the specified uid.
|
||||
*/
|
||||
public T setUid(long uid) {
|
||||
mUid = uid;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Each sub class should return itself to allow the builder to chain properly
|
||||
*/
|
||||
|
||||
@@ -111,6 +111,7 @@ static struct {
|
||||
jfieldID frameScale;
|
||||
jfieldID captureSecureLayers;
|
||||
jfieldID allowProtected;
|
||||
jfieldID uid;
|
||||
} gCaptureArgsClassInfo;
|
||||
|
||||
static struct {
|
||||
@@ -371,6 +372,7 @@ static void getCaptureArgs(JNIEnv* env, jobject captureArgsObject, CaptureArgs&
|
||||
env->GetBooleanField(captureArgsObject, gCaptureArgsClassInfo.captureSecureLayers);
|
||||
captureArgs.allowProtected =
|
||||
env->GetBooleanField(captureArgsObject, gCaptureArgsClassInfo.allowProtected);
|
||||
captureArgs.uid = env->GetLongField(captureArgsObject, gCaptureArgsClassInfo.uid);
|
||||
}
|
||||
|
||||
static DisplayCaptureArgs displayCaptureArgsFromObject(JNIEnv* env,
|
||||
@@ -1895,6 +1897,7 @@ int register_android_view_SurfaceControl(JNIEnv* env)
|
||||
GetFieldIDOrDie(env, captureArgsClazz, "mCaptureSecureLayers", "Z");
|
||||
gCaptureArgsClassInfo.allowProtected =
|
||||
GetFieldIDOrDie(env, captureArgsClazz, "mAllowProtected", "Z");
|
||||
gCaptureArgsClassInfo.uid = GetFieldIDOrDie(env, captureArgsClazz, "mUid", "J");
|
||||
|
||||
jclass displayCaptureArgsClazz =
|
||||
FindClassOrDie(env, "android/view/SurfaceControl$DisplayCaptureArgs");
|
||||
|
||||
Reference in New Issue
Block a user