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

Commit 89f635b1 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Determines the associated display id when launching assistant" into main

parents 97aec975 db8290b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ interface IActivityTaskManager {
            boolean focused, boolean newSessionId);
    boolean requestAutofillData(in IAssistDataReceiver receiver, in Bundle receiverExtras,
            in IBinder activityToken, int flags);
    // @deprecated Use ActivityTaskManagerInternal#isAssistDataAllowed instead.
    boolean isAssistDataAllowed();
    boolean requestAssistDataForTask(in IAssistDataReceiver receiver, int taskId,
            in String callingPackageName, String callingAttributionTag, boolean fetchStructure);
+11 −0
Original line number Diff line number Diff line
@@ -1522,6 +1522,17 @@ public class Intent implements Parcelable, Cloneable {
    public static final String EXTRA_ASSIST_INPUT_DEVICE_ID =
            "android.intent.extra.ASSIST_INPUT_DEVICE_ID";
    /**
     * An optional field on {@link #ACTION_ASSIST} containing the display id
     * that should be used to invoke the assist. If not set, invoke the assist on the default
     * display is suggested.
     *
     * @hide
     */
    @FlaggedApi(com.android.window.flags.Flags.FLAG_SUPPORT_GEMINI_ON_MULTI_DISPLAY)
    public static final String EXTRA_ASSIST_DISPLAY_ID =
            "android.intent.extra.ASSIST_DISPLAY_ID";
    /**
     * Activity Action: List all available applications.
     * <p>Input: Nothing.
+1 −0
Original line number Diff line number Diff line
@@ -470,6 +470,7 @@ interface IWindowManager

    /**
     * Used only for assist -- request a screenshot of the current application.
     * @deprecated. Use WindowManagerInternal#requestAssistScreenshot instead.
     */
    void requestAssistScreenshot(IAssistDataReceiver receiver);

+8 −0
Original line number Diff line number Diff line
@@ -227,3 +227,11 @@ flag {
    bug: "406967985"
    is_fixed_read_only: true
}

flag {
    namespace: "windowing_sdk"
    name: "support_gemini_on_multi_display"
    description: "Launch Gemini on a multi-display environment"
    bug: "400351723"
    is_fixed_read_only: true
}
 No newline at end of file
+25 −10
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ import android.view.IWindowManager;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.server.LocalServices;
import com.android.server.wm.ActivityTaskManagerInternal;
import com.android.server.wm.WindowManagerInternal;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -221,11 +224,18 @@ public class AssistDataRequester extends IAssistDataReceiver.Stub {

        // Ensure that the current activity supports assist data
        boolean isAssistDataAllowed = false;
        if (com.android.window.flags.Flags.supportGeminiOnMultiDisplay()) {
            isAssistDataAllowed = LocalServices.getService(
                    ActivityTaskManagerInternal.class).isAssistDataForActivitiesAllowed(
                    activityTokens);
        } else {
            try {
                isAssistDataAllowed = mActivityTaskManager.isAssistDataAllowed();
            } catch (RemoteException e) {
                // Should never happen
            }
        }

        allowFetchData &= isAssistDataAllowed;
        allowFetchScreenshot &= fetchData && isAssistDataAllowed
                && (mRequestScreenshotAppOps != OP_NONE);
@@ -291,13 +301,18 @@ public class AssistDataRequester extends IAssistDataReceiver.Stub {
            if (mAppOpsManager.noteOpNoThrow(mRequestScreenshotAppOps, callingUid,
                    callingPackage, callingAttributionTag, /* message */ null) == MODE_ALLOWED
                    && allowFetchScreenshot) {
                try {
                MetricsLogger.count(mContext, "assist_with_screen", 1);
                mPendingScreenshotCount++;
                if (com.android.window.flags.Flags.supportGeminiOnMultiDisplay()) {
                    LocalServices.getService(WindowManagerInternal.class).requestAssistScreenshot(
                            this, activityTokens.get(0));
                } else {
                    try {
                        mWindowManager.requestAssistScreenshot(this);
                    } catch (RemoteException e) {
                        // Can't happen
                    }
                }
            } else {
                if (mCallbacks.canHandleReceivedAssistDataLocked()) {
                    dispatchAssistScreenshotReceived(null);
Loading