Merge "Screenshot Notification Smart Action: AiAi and - Sys UI integration" into qt-qpr1-dev

This commit is contained in:
Satakshi Rana
2019-11-19 17:14:49 +00:00
committed by Android (Google) Code Review
12 changed files with 464 additions and 15 deletions

View File

@@ -45,6 +45,17 @@ import java.util.concurrent.Executor;
*/
@SystemApi
public final class ContentSuggestionsManager {
/**
* Key into the extras Bundle passed to {@link #provideContextImage(int, Bundle)}.
* This can be used to provide the bitmap to
* {@link android.service.contentsuggestions.ContentSuggestionsService}.
* The value must be a {@link android.graphics.Bitmap} with the
* config {@link android.graphics.Bitmap.Config.HARDWARE}.
*
* @hide
*/
public static final String EXTRA_BITMAP = "android.contentsuggestions.extra.BITMAP";
private static final String TAG = ContentSuggestionsManager.class.getSimpleName();
/**
@@ -70,7 +81,7 @@ public final class ContentSuggestionsManager {
* system content suggestions service.
*
* @param taskId of the task to snapshot.
* @param imageContextRequestExtras sent with with request to provide implementation specific
* @param imageContextRequestExtras sent with request to provide implementation specific
* extra information.
*/
public void provideContextImage(

View File

@@ -66,12 +66,17 @@ public abstract class ContentSuggestionsService extends Service {
int colorSpaceId, Bundle imageContextRequestExtras) {
Bitmap wrappedBuffer = null;
if (contextImage != null) {
ColorSpace colorSpace = null;
if (colorSpaceId >= 0 && colorSpaceId < ColorSpace.Named.values().length) {
colorSpace = ColorSpace.get(ColorSpace.Named.values()[colorSpaceId]);
if (imageContextRequestExtras.containsKey(ContentSuggestionsManager.EXTRA_BITMAP)) {
wrappedBuffer = imageContextRequestExtras.getParcelable(
ContentSuggestionsManager.EXTRA_BITMAP);
} else {
if (contextImage != null) {
ColorSpace colorSpace = null;
if (colorSpaceId >= 0 && colorSpaceId < ColorSpace.Named.values().length) {
colorSpace = ColorSpace.get(ColorSpace.Named.values()[colorSpaceId]);
}
wrappedBuffer = Bitmap.wrapHardwareBuffer(contextImage, colorSpace);
}
wrappedBuffer = Bitmap.wrapHardwareBuffer(contextImage, colorSpace);
}
mHandler.sendMessage(

View File

@@ -47,6 +47,20 @@ public final class SystemUiDeviceConfigFlags {
*/
public static final String NAS_MAX_SUGGESTIONS = "nas_max_suggestions";
// Flags related to screenshot intelligence
/**
* (bool) Whether to enable smart actions in screenshot notifications.
*/
public static final String ENABLE_SCREENSHOT_NOTIFICATION_SMART_ACTIONS =
"enable_screenshot_notification_smart_actions";
/**
* (int) Timeout value in ms to get smart actions for screenshot notification.
*/
public static final String SCREENSHOT_NOTIFICATION_SMART_ACTIONS_TIMEOUT_MS =
"screenshot_notification_smart_actions_timeout_ms";
// Flags related to Smart Suggestions - these are read in SmartReplyConstants.
/** (boolean) Whether to enable smart suggestions in notifications. */