From b846e83ff5dc26c1de09d6d176da57778b31ff18 Mon Sep 17 00:00:00 2001 From: Satakshi Date: Tue, 19 Nov 2019 10:27:11 -0800 Subject: 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 --- .../android/service/contentsuggestions/ContentSuggestionsService.java | 4 ++++ 1 file changed, 4 insertions(+) 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)) { -- cgit v1.2.3-59-g8ed1b