Update ImageActionUtils to construct a ScreenshotRequest
Bug: 264457397
Test: atest
Merged-In: Ib629f5d9eed2091f2bc4c1082d5e0dd3d2f9176b
Change-Id: Ib629f5d9eed2091f2bc4c1082d5e0dd3d2f9176b
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index bb97334..00fb7ec 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -29,7 +29,6 @@
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.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 @@
}
@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 9fe24de..3a1c99b 100644
--- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
+++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
@@ -18,6 +18,8 @@
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.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 @@
* 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);
}
/**