summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Satakshi <satakshir@google.com> 2019-11-19 10:27:11 -0800
committer Satakshi <satakshir@google.com> 2019-11-19 10:27:11 -0800
commitb846e83ff5dc26c1de09d6d176da57778b31ff18 (patch)
tree0bc70e0ac77944a1c5d8ab144d54d025d2992010
parent7f9474cba360e4f1447e833e5c387d381eb59263 (diff)
Assert only one bitmap is provided to ContentSuggestionsService.
Test: Took a screenshot and verified that AiAi gets invoked and the screenshot notification shows smart actions. Long press in Overview shows smart actions. Bug: 141634285 Change-Id: I1e82f8bb837b8b032e6d25032642e47f492eb495
-rw-r--r--core/java/android/service/contentsuggestions/ContentSuggestionsService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/service/contentsuggestions/ContentSuggestionsService.java b/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
index 4bcd39fbd41f..306b4830932e 100644
--- a/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
+++ b/core/java/android/service/contentsuggestions/ContentSuggestionsService.java
@@ -64,6 +64,10 @@ public abstract class ContentSuggestionsService extends Service {
@Override
public void provideContextImage(int taskId, GraphicBuffer contextImage,
int colorSpaceId, Bundle imageContextRequestExtras) {
+ if (imageContextRequestExtras.containsKey(ContentSuggestionsManager.EXTRA_BITMAP)
+ && contextImage != null) {
+ throw new IllegalArgumentException("Two bitmaps provided; expected one.");
+ }
Bitmap wrappedBuffer = null;
if (imageContextRequestExtras.containsKey(ContentSuggestionsManager.EXTRA_BITMAP)) {