diff options
3 files changed, 13 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/AssistContentRequester.java b/packages/SystemUI/src/com/android/systemui/screenshot/AssistContentRequester.java index ab8fc652c938..12bff499217e 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/AssistContentRequester.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/AssistContentRequester.java @@ -15,6 +15,7 @@ */ package com.android.systemui.screenshot; +import android.annotation.Nullable; import android.app.ActivityTaskManager; import android.app.IActivityTaskManager; import android.app.IAssistDataReceiver; @@ -55,7 +56,7 @@ public class AssistContentRequester { * Called when the {@link android.app.assist.AssistContent} of the requested task is * available. **/ - void onAssistContentAvailable(AssistContent assistContent); + void onAssistContentAvailable(@Nullable AssistContent assistContent); } private final IActivityTaskManager mActivityTaskManager; @@ -117,15 +118,9 @@ public class AssistContentRequester { @Override public void onHandleAssistData(Bundle data) { - if (data == null) { - return; - } - - final AssistContent content = data.getParcelable(ASSIST_KEY_CONTENT); - if (content == null) { - Log.e(TAG, "Received AssistData, but no AssistContent found"); - return; - } + final AssistContent content = (data == null) ? null + : data.getParcelable( + ASSIST_KEY_CONTENT, AssistContent.class); AssistContentRequester requester = mParentRef.get(); if (requester != null) { diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsProvider.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsProvider.kt index 328742543184..07e143a34319 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotActionsProvider.kt @@ -42,7 +42,11 @@ interface ScreenshotActionsProvider { fun onScrollChipReady(onClick: Runnable) fun setCompletedScreenshot(result: ScreenshotSavedResult) - fun onAssistContentAvailable(assistContent: AssistContent) {} + /** + * Provide the AssistContent for the focused task if available, null if the focused task isn't + * known or didn't return data. + */ + fun onAssistContent(assistContent: AssistContent?) {} interface Factory { fun create( diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java index 9d42580ce83d..1428e7ed1756 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java @@ -412,9 +412,9 @@ public class ScreenshotController { if (screenshot.getTaskId() >= 0) { mAssistContentRequester.requestAssistContent(screenshot.getTaskId(), - assistContent -> { - mActionsProvider.onAssistContentAvailable(assistContent); - }); + assistContent -> mActionsProvider.onAssistContent(assistContent)); + } else { + mActionsProvider.onAssistContent(null); } } else { saveScreenshotInWorkerThread(screenshot.getUserHandle(), finisher, |