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

Commit dfc23dd1 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Add API to determine if the app supplied a web URI.

Change-Id: I60aa39b9db822fe46ddd57ef5483b5708cf21422
parent 4c956456
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5881,6 +5881,7 @@ package android.app.assist {
    method public java.lang.String getStructuredData();
    method public android.net.Uri getWebUri();
    method public boolean isAppProvidedIntent();
    method public boolean isAppProvidedWebUri();
    method public void setClipData(android.content.ClipData);
    method public void setIntent(android.content.Intent);
    method public void setStructuredData(java.lang.String);
+1 −0
Original line number Diff line number Diff line
@@ -6014,6 +6014,7 @@ package android.app.assist {
    method public java.lang.String getStructuredData();
    method public android.net.Uri getWebUri();
    method public boolean isAppProvidedIntent();
    method public boolean isAppProvidedWebUri();
    method public void setClipData(android.content.ClipData);
    method public void setIntent(android.content.Intent);
    method public void setStructuredData(java.lang.String);
+13 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import android.os.Parcelable;
 */
public class AssistContent implements Parcelable {
    private boolean mIsAppProvidedIntent = false;
    private boolean mIsAppProvidedWebUri = false;
    private Intent mIntent;
    private String mStructuredData;
    private ClipData mClipData;
@@ -39,7 +40,7 @@ public class AssistContent implements Parcelable {
            Uri uri = intent.getData();
            if (uri != null) {
                if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) {
                    setWebUri(uri);
                    mUri = uri;
                }
            }
        }
@@ -116,6 +117,7 @@ public class AssistContent implements Parcelable {
     * leave the null and only report the local intent and clip data.
     */
    public void setWebUri(Uri uri) {
        mIsAppProvidedWebUri = true;
        mUri = uri;
    }

@@ -127,6 +129,16 @@ public class AssistContent implements Parcelable {
        return mUri;
    }

    /**
     * Returns whether or not the current {@link #getWebUri} was explicitly provided in
     * {@link android.app.Activity#onProvideAssistContent Activity.onProvideAssistContent}. If not,
     * the Intent was automatically set based on
     * {@link android.app.Activity#getIntent Activity.getIntent}.
     */
    public boolean isAppProvidedWebUri() {
        return mIsAppProvidedWebUri;
    }

    /**
     * Return Bundle for extra vendor-specific data that can be modified and examined.
     */