ContentSuggetionsService, don't try and wrap a null graphics buffer.

Test: Ran CTS test
Change-Id: I93143f752e8d0b8a79fdbee038785dd20d26896d
This commit is contained in:
Zak Cohen
2019-02-27 11:47:52 -08:00
parent 5a9da78042
commit 47b581d4ef

View File

@@ -60,11 +60,17 @@ public abstract class ContentSuggestionsService extends Service {
@Override
public void provideContextImage(int taskId, GraphicBuffer contextImage,
Bundle imageContextRequestExtras) {
Bitmap wrappedBuffer = null;
if (contextImage != null) {
wrappedBuffer = Bitmap.wrapHardwareBuffer(
HardwareBuffer.createFromGraphicBuffer(contextImage), null);
}
mHandler.sendMessage(
obtainMessage(ContentSuggestionsService::processContextImage,
ContentSuggestionsService.this, taskId,
Bitmap.wrapHardwareBuffer(
HardwareBuffer.createFromGraphicBuffer(contextImage), null),
wrappedBuffer,
imageContextRequestExtras));
}