Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73b4e192 authored by Satakshi Rana's avatar Satakshi Rana Committed by Android (Google) Code Review
Browse files

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

parents 15087a40 ce35ce9f
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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(
+10 −5
Original line number Diff line number Diff line
@@ -66,6 +66,10 @@ public abstract class ContentSuggestionsService extends Service {
                int colorSpaceId, Bundle imageContextRequestExtras) {

            Bitmap wrappedBuffer = null;
            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) {
@@ -73,6 +77,7 @@ public abstract class ContentSuggestionsService extends Service {
                    }
                    wrappedBuffer = Bitmap.wrapHardwareBuffer(contextImage, colorSpace);
                }
            }

            mHandler.sendMessage(
                    obtainMessage(ContentSuggestionsService::onProcessContextImage,
+14 −0
Original line number Diff line number Diff line
@@ -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. */
+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@
    <uses-permission android:name="android.permission.GET_APP_OPS_STATS" />
    <uses-permission android:name="android.permission.USE_RESERVED_DISK" />

    <!-- to invoke ContentSuggestionsService -->
    <uses-permission android:name="android.permission.MANAGE_CONTENT_SUGGESTIONS"/>

    <!-- Networking and telephony -->
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+10 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.screenshot.ScreenshotNotificationSmartActionsProvider;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.ScrimView;
@@ -110,6 +111,15 @@ public class SystemUIFactory {
        return new StatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils);
    }

    /**
     * Creates an instance of ScreenshotNotificationSmartActionsProvider.
     * This method is overridden in vendor specific implementation of Sys UI.
     */
    public ScreenshotNotificationSmartActionsProvider
            createScreenshotNotificationSmartActionsProvider() {
        return new ScreenshotNotificationSmartActionsProvider();
    }

    public KeyguardBouncer createKeyguardBouncer(Context context, ViewMediatorCallback callback,
            LockPatternUtils lockPatternUtils, ViewGroup container,
            DismissCallbackRegistry dismissCallbackRegistry,
Loading