diff --git a/media/java/android/media/projection/IMediaProjection.aidl b/media/java/android/media/projection/IMediaProjection.aidl index 5f7d636fdd1eb..e3829e6a30210 100644 --- a/media/java/android/media/projection/IMediaProjection.aidl +++ b/media/java/android/media/projection/IMediaProjection.aidl @@ -51,4 +51,26 @@ interface IMediaProjection { @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest" + ".permission.MANAGE_MEDIA_PROJECTION)") void setLaunchCookie(in IBinder launchCookie); + + /** + * Returns {@code true} if this token is still valid. A token is valid as long as the token + * hasn't timed out before it was used, and the token is only used once. + * + *

If the {@link IMediaProjection} is not valid, then either throws an exception if the + * target SDK is at least {@code U}, or returns {@code false} for target SDK below {@code U}. + * + * @throws IllegalStateException If the caller's target SDK is at least {@code U} and the + * projection is not valid. + */ + @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest" + + ".permission.MANAGE_MEDIA_PROJECTION)") + boolean isValid(); + + /** + * Sets that {@link MediaProjection#createVirtualDisplay} has been invoked with this token (it + * should only be called once). + */ + @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest" + + ".permission.MANAGE_MEDIA_PROJECTION)") + void notifyVirtualDisplayCreated(int displayId); } diff --git a/media/java/android/media/projection/IMediaProjectionManager.aidl b/media/java/android/media/projection/IMediaProjectionManager.aidl index c97265d4939dd..835e4c3ee4f60 100644 --- a/media/java/android/media/projection/IMediaProjectionManager.aidl +++ b/media/java/android/media/projection/IMediaProjectionManager.aidl @@ -44,6 +44,22 @@ interface IMediaProjectionManager { + ".permission.MANAGE_MEDIA_PROJECTION)") boolean isCurrentProjection(IMediaProjection projection); + /** + * Reshows the permisison dialog for the user to review consent they've already granted in + * the given projection instance. + * + *

Preconditions: + *