diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index bb973342d5..00fb7ec299 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -29,7 +29,6 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ShortcutInfo; -import android.graphics.Insets; import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; @@ -51,10 +50,10 @@ import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; import com.android.internal.logging.InstanceId; +import com.android.internal.util.ScreenshotRequest; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.systemui.shared.recents.ISystemUiProxy; -import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController; import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController; import com.android.systemui.shared.system.smartspace.SmartspaceState; @@ -384,14 +383,12 @@ public class SystemUiProxy implements ISystemUiProxy { } @Override - public void handleImageBundleAsScreenshot(Bundle screenImageBundle, Rect locationInScreen, - Insets visibleInsets, Task.TaskKey task) { + public void takeScreenshot(ScreenshotRequest request) { if (mSystemUiProxy != null) { try { - mSystemUiProxy.handleImageBundleAsScreenshot(screenImageBundle, locationInScreen, - visibleInsets, task); + mSystemUiProxy.takeScreenshot(request); } catch (RemoteException e) { - Log.w(TAG, "Failed call handleImageBundleAsScreenshot"); + Log.w(TAG, "Failed call takeScreenshot"); } } } diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java index 9fe24dec66..3a1c99b078 100644 --- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java +++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java @@ -18,6 +18,8 @@ package com.android.quickstep.util; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION; +import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_OVERVIEW; +import static android.view.WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR; @@ -47,7 +49,7 @@ import androidx.annotation.WorkerThread; import androidx.core.content.FileProvider; import com.android.internal.app.ChooserActivity; -import com.android.internal.util.ScreenshotHelper; +import com.android.internal.util.ScreenshotRequest; import com.android.launcher3.BuildConfig; import com.android.quickstep.SystemUiProxy; import com.android.systemui.shared.recents.model.Task; @@ -74,11 +76,17 @@ public class ImageActionUtils { * Saves screenshot to location determine by SystemUiProxy */ public static void saveScreenshot(SystemUiProxy systemUiProxy, Bitmap screenshot, - Rect screenshotBounds, - Insets visibleInsets, Task.TaskKey task) { - systemUiProxy.handleImageBundleAsScreenshot( - ScreenshotHelper.HardwareBitmapBundler.hardwareBitmapToBundle(screenshot), - screenshotBounds, visibleInsets, task); + Rect screenshotBounds, Insets visibleInsets, Task.TaskKey task) { + ScreenshotRequest request = + new ScreenshotRequest.Builder(TAKE_SCREENSHOT_PROVIDED_IMAGE, SCREENSHOT_OVERVIEW) + .setTopComponent(task.sourceComponent) + .setTaskId(task.id) + .setUserId(task.userId) + .setBitmap(screenshot) + .setBoundsOnScreen(screenshotBounds) + .setInsets(visibleInsets) + .build(); + systemUiProxy.takeScreenshot(request); } /**