Merge "Add permission for takeScreenshot API." into tm-dev
This commit is contained in:
@@ -11410,7 +11410,7 @@ package android.service.games {
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_GAME_ACTIVITY) public final boolean restartGame();
|
||||
method public void setTaskOverlayView(@NonNull android.view.View, @NonNull android.view.ViewGroup.LayoutParams);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_GAME_ACTIVITY) public final void startActivityFromGameSessionForResult(@NonNull android.content.Intent, @Nullable android.os.Bundle, @NonNull java.util.concurrent.Executor, @NonNull android.service.games.GameSessionActivityCallback);
|
||||
method public void takeScreenshot(@NonNull java.util.concurrent.Executor, @NonNull android.service.games.GameSession.ScreenshotCallback);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_GAME_ACTIVITY) public void takeScreenshot(@NonNull java.util.concurrent.Executor, @NonNull android.service.games.GameSession.ScreenshotCallback);
|
||||
}
|
||||
|
||||
public static interface GameSession.ScreenshotCallback {
|
||||
|
||||
@@ -426,6 +426,7 @@ public abstract class GameSession {
|
||||
* or failed.
|
||||
* @throws IllegalStateException if this method is called prior to {@link #onCreate}.
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_GAME_ACTIVITY)
|
||||
public void takeScreenshot(@NonNull Executor executor, @NonNull ScreenshotCallback callback) {
|
||||
if (mGameSessionController == null) {
|
||||
throw new IllegalStateException("Can not call before onCreate()");
|
||||
|
||||
@@ -192,8 +192,11 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan
|
||||
private final IGameSessionController mGameSessionController =
|
||||
new IGameSessionController.Stub() {
|
||||
@Override
|
||||
@RequiresPermission(android.Manifest.permission.MANAGE_GAME_ACTIVITY)
|
||||
public void takeScreenshot(int taskId,
|
||||
@NonNull AndroidFuture gameScreenshotResultFuture) {
|
||||
mContext.enforceCallingPermission(Manifest.permission.MANAGE_GAME_ACTIVITY,
|
||||
"takeScreenshot()");
|
||||
mBackgroundExecutor.execute(() -> {
|
||||
GameServiceProviderInstanceImpl.this.takeScreenshot(taskId,
|
||||
gameScreenshotResultFuture);
|
||||
|
||||
Reference in New Issue
Block a user