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

Commit e88ff9e2 authored by Maryam Dehaini's avatar Maryam Dehaini
Browse files

Adding Api that allows apps to provide URI to be utilized to switch user's...

Adding Api that allows apps to provide URI to be utilized to switch user's session to another surface

Adds EXTRA_SESSION_TRANSFER_WEB_URI to AssistContent which allows an application to provide a URI with information that will assist in switching the user's session to another surface. The "Open in browser" feature will use this URI to transition the current session from one surface to the other.  Apps may choose to encode session or user information into this URI in order to provide a better session transfer experience.

Design Doc: go/app-to-web-api
Bug: 373680430
Flag:com.android.window.flags.enable_desktop_windowing_app_to_web_education
Test: m

Change-Id: I103181ed475b08f46c3a4c55fb692beb678b56a2
parent ed6a189e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8917,6 +8917,7 @@ package android.app.assist {
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.assist.AssistContent> CREATOR;
    field @FlaggedApi("android.app.appfunctions.flags.enable_app_function_manager") public static final String EXTRA_APP_FUNCTION_DATA = "android.app.assist.extra.APP_FUNCTION_DATA";
    field @FlaggedApi("com.android.window.flags.enable_desktop_windowing_app_to_web_education") public static final String EXTRA_SESSION_TRANSFER_WEB_URI = "android.app.assist.extra.SESSION_TRANSFER_WEB_URI";
  }
  public class AssistStructure implements android.os.Parcelable {
+25 −0
Original line number Diff line number Diff line
@@ -30,6 +30,31 @@ public class AssistContent implements Parcelable {
    public static final String EXTRA_APP_FUNCTION_DATA =
            "android.app.assist.extra.APP_FUNCTION_DATA";

    /**
     * This extra can be optionally supplied in the {@link #getExtras} bundle to provide a
     * {@link Uri} which will be utilized when transitioning a user's session to another surface.
     *
     * <p>If provided, instead of using the URI provided in {@link #setWebUri}, the
     * "Open in browser" feature will use this URI to transition the current session from one
     * surface to the other. Apps may choose to encode session or user information into this
     * URI in order to provide a better session transfer experience.
     *
     * <p>Unlike {@link #setWebUri}, this URI will not be used for features where the user might
     * accidentally share it with another user. However, developers should not encode
     * authentication credentials into this URI, because it will be surfaced in the browser URL
     * bar and may be copied and shared from there.
     *
     * <p>When providing this extra, developers should still continue to provide
     * {@link #setWebUri} for backwards compatibility with features such as
     * <a href="https://developer.android.com/guide/components/activities/recents#url-sharing">
     * recents URL sharing</a> which do not benefit from a session-transfer web URI.
     *
     * @see android.app.Activity#requestOpenInBrowserEducation()
     */
    @FlaggedApi(com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_WINDOWING_APP_TO_WEB_EDUCATION)
    public static final String EXTRA_SESSION_TRANSFER_WEB_URI =
            "android.app.assist.extra.SESSION_TRANSFER_WEB_URI";

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
    private boolean mIsAppProvidedIntent = false;
    private boolean mIsAppProvidedWebUri = false;