Loading core/java/android/app/IActivityTaskManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -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); Loading core/java/android/content/Intent.java +11 −0 Original line number Diff line number Diff line Loading @@ -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. Loading core/java/android/view/IWindowManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -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); Loading core/java/android/window/flags/windowing_sdk.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -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 services/core/java/com/android/server/am/AssistDataRequester.java +25 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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 Loading
core/java/android/app/IActivityTaskManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
core/java/android/content/Intent.java +11 −0 Original line number Diff line number Diff line Loading @@ -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. Loading
core/java/android/view/IWindowManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
core/java/android/window/flags/windowing_sdk.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -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
services/core/java/com/android/server/am/AssistDataRequester.java +25 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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