Loading core/java/android/view/SurfaceControl.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -661,6 +662,7 @@ public final class SurfaceControl implements Parcelable { mFrameScale = builder.mFrameScale; mCaptureSecureLayers = builder.mCaptureSecureLayers; mAllowProtected = builder.mAllowProtected; mUid = builder.mUid; } /** Loading @@ -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. Loading Loading @@ -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 */ Loading core/jni/android_view_SurfaceControl.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ static struct { jfieldID frameScale; jfieldID captureSecureLayers; jfieldID allowProtected; jfieldID uid; } gCaptureArgsClassInfo; static struct { Loading Loading @@ -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, Loading Loading @@ -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"); Loading Loading
core/java/android/view/SurfaceControl.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -661,6 +662,7 @@ public final class SurfaceControl implements Parcelable { mFrameScale = builder.mFrameScale; mCaptureSecureLayers = builder.mCaptureSecureLayers; mAllowProtected = builder.mAllowProtected; mUid = builder.mUid; } /** Loading @@ -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. Loading Loading @@ -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 */ Loading
core/jni/android_view_SurfaceControl.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ static struct { jfieldID frameScale; jfieldID captureSecureLayers; jfieldID allowProtected; jfieldID uid; } gCaptureArgsClassInfo; static struct { Loading Loading @@ -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, Loading Loading @@ -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"); Loading