summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsProvider.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotSmartActions.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java16
4 files changed, 26 insertions, 24 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java b/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
index 25715212a344..c828c4cccce5 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/SaveImageInBackgroundTask.java
@@ -130,7 +130,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
try {
CompletableFuture<List<Notification.Action>> smartActionsFuture =
ScreenshotSmartActions.getSmartActionsFuture(
- mScreenshotId, image, mSmartActionsProvider,
+ mScreenshotId, mImageFileName, image, mSmartActionsProvider,
mSmartActionsEnabled, isManagedProfile(mContext));
// Save the screenshot to the MediaStore
@@ -202,7 +202,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
1000);
smartActions.addAll(buildSmartActions(
ScreenshotSmartActions.getSmartActions(
- mScreenshotId, smartActionsFuture, timeoutMs,
+ mScreenshotId, mImageFileName, smartActionsFuture, timeoutMs,
mSmartActionsProvider),
mContext));
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsProvider.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsProvider.java
index b6f5447d2867..09a0644159e2 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsProvider.java
@@ -56,16 +56,18 @@ public class ScreenshotNotificationSmartActionsProvider {
* Default implementation that returns an empty list.
* This method is overridden in vendor-specific Sys UI implementation.
*
- * @param screenshotId A generated random unique id for the screenshot.
- * @param bitmap The bitmap of the screenshot. The bitmap config must be {@link
- * HARDWARE}.
- * @param componentName Contains package and activity class names where the screenshot was
- * taken. This is used as an additional signal to generate and rank more
- * relevant actions.
- * @param isManagedProfile The screenshot was taken for a work profile app.
+ * @param screenshotId A generated random unique id for the screenshot.
+ * @param screenshotFileName name of the file where the screenshot will be written.
+ * @param bitmap The bitmap of the screenshot. The bitmap config must be {@link
+ * HARDWARE}.
+ * @param componentName Contains package and activity class names where the screenshot was
+ * taken. This is used as an additional signal to generate and rank
+ * more relevant actions.
+ * @param isManagedProfile The screenshot was taken for a work profile app.
*/
public CompletableFuture<List<Notification.Action>> getActions(
String screenshotId,
+ String screenshotFileName,
Bitmap bitmap,
ComponentName componentName,
boolean isManagedProfile) {
@@ -77,7 +79,7 @@ public class ScreenshotNotificationSmartActionsProvider {
* Notify exceptions and latency encountered during generating smart actions.
* This method is overridden in vendor-specific Sys UI implementation.
*
- * @param screenshotId Unique id of the screenshot.
+ * @param screenshotId unique id of the screenshot.
* @param op screenshot execution phase defined in {@link ScreenshotOp}
* @param status {@link ScreenshotOpStatus} to report success or failure.
* @param durationMs latency experienced in different phases of screenshots.
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotSmartActions.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotSmartActions.java
index e76e37e5c608..d31344446fac 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotSmartActions.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotSmartActions.java
@@ -44,8 +44,9 @@ public class ScreenshotSmartActions {
private static final String TAG = "ScreenshotSmartActions";
@VisibleForTesting
- static CompletableFuture<List<Notification.Action>> getSmartActionsFuture(String screenshotId,
- Bitmap image, ScreenshotNotificationSmartActionsProvider smartActionsProvider,
+ static CompletableFuture<List<Notification.Action>> getSmartActionsFuture(
+ String screenshotId, String screenshotFileName, Bitmap image,
+ ScreenshotNotificationSmartActionsProvider smartActionsProvider,
boolean smartActionsEnabled, boolean isManagedProfile) {
if (!smartActionsEnabled) {
Slog.i(TAG, "Screenshot Intelligence not enabled, returning empty list.");
@@ -68,9 +69,8 @@ public class ScreenshotSmartActions {
(runningTask != null && runningTask.topActivity != null)
? runningTask.topActivity
: new ComponentName("", "");
- smartActionsFuture = smartActionsProvider.getActions(screenshotId, image,
- componentName,
- isManagedProfile);
+ smartActionsFuture = smartActionsProvider.getActions(
+ screenshotId, screenshotFileName, image, componentName, isManagedProfile);
} catch (Throwable e) {
long waitTimeMs = SystemClock.uptimeMillis() - startTimeMs;
smartActionsFuture = CompletableFuture.completedFuture(Collections.emptyList());
@@ -84,7 +84,7 @@ public class ScreenshotSmartActions {
}
@VisibleForTesting
- static List<Notification.Action> getSmartActions(String screenshotId,
+ static List<Notification.Action> getSmartActions(String screenshotId, String screenshotFileName,
CompletableFuture<List<Notification.Action>> smartActionsFuture, int timeoutMs,
ScreenshotNotificationSmartActionsProvider smartActionsProvider) {
long startTimeMs = SystemClock.uptimeMillis();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java
index aeb31e11be23..11649ca34709 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotNotificationSmartActionsTest.java
@@ -76,11 +76,11 @@ public class ScreenshotNotificationSmartActionsTest extends SysuiTestCase {
when(bitmap.getConfig()).thenReturn(Bitmap.Config.HARDWARE);
ScreenshotNotificationSmartActionsProvider smartActionsProvider = mock(
ScreenshotNotificationSmartActionsProvider.class);
- when(smartActionsProvider.getActions(any(), any(), any(),
+ when(smartActionsProvider.getActions(any(), any(), any(), any(),
eq(false))).thenThrow(
RuntimeException.class);
CompletableFuture<List<Notification.Action>> smartActionsFuture =
- ScreenshotSmartActions.getSmartActionsFuture("", bitmap,
+ ScreenshotSmartActions.getSmartActionsFuture("", "", bitmap,
smartActionsProvider, true, false);
Assert.assertNotNull(smartActionsFuture);
List<Notification.Action> smartActions = smartActionsFuture.get(5, TimeUnit.MILLISECONDS);
@@ -98,7 +98,7 @@ public class ScreenshotNotificationSmartActionsTest extends SysuiTestCase {
when(smartActionsFuture.get(timeoutMs, TimeUnit.MILLISECONDS)).thenThrow(
RuntimeException.class);
List<Notification.Action> actions = ScreenshotSmartActions.getSmartActions(
- "", smartActionsFuture, timeoutMs, mSmartActionsProvider);
+ "", "", smartActionsFuture, timeoutMs, mSmartActionsProvider);
Assert.assertEquals(Collections.emptyList(), actions);
}
@@ -119,9 +119,9 @@ public class ScreenshotNotificationSmartActionsTest extends SysuiTestCase {
Bitmap bitmap = mock(Bitmap.class);
when(bitmap.getConfig()).thenReturn(Bitmap.Config.RGB_565);
CompletableFuture<List<Notification.Action>> smartActionsFuture =
- ScreenshotSmartActions.getSmartActionsFuture("", bitmap,
+ ScreenshotSmartActions.getSmartActionsFuture("", "", bitmap,
mSmartActionsProvider, true, true);
- verify(mSmartActionsProvider, never()).getActions(any(), any(), any(),
+ verify(mSmartActionsProvider, never()).getActions(any(), any(), any(), any(),
eq(false));
Assert.assertNotNull(smartActionsFuture);
List<Notification.Action> smartActions = smartActionsFuture.get(5, TimeUnit.MILLISECONDS);
@@ -133,10 +133,10 @@ public class ScreenshotNotificationSmartActionsTest extends SysuiTestCase {
public void testScreenshotNotificationSmartActionsProviderInvokedOnce() {
Bitmap bitmap = mock(Bitmap.class);
when(bitmap.getConfig()).thenReturn(Bitmap.Config.HARDWARE);
- ScreenshotSmartActions.getSmartActionsFuture("", bitmap, mSmartActionsProvider,
+ ScreenshotSmartActions.getSmartActionsFuture("", "", bitmap, mSmartActionsProvider,
true, true);
verify(mSmartActionsProvider, times(1))
- .getActions(any(), any(), any(), eq(true));
+ .getActions(any(), any(), any(), any(), eq(true));
}
// Tests for a hardware bitmap, a completed future is returned.
@@ -149,7 +149,7 @@ public class ScreenshotNotificationSmartActionsTest extends SysuiTestCase {
SystemUIFactory.getInstance().createScreenshotNotificationSmartActionsProvider(
mContext, null, mHandler);
CompletableFuture<List<Notification.Action>> smartActionsFuture =
- ScreenshotSmartActions.getSmartActionsFuture("", bitmap,
+ ScreenshotSmartActions.getSmartActionsFuture("", "", bitmap,
actionsProvider,
true, true);
Assert.assertNotNull(smartActionsFuture);