summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chirag Shah <chirags@google.com> 2015-06-16 16:54:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-06-16 16:54:03 +0000
commit7f92f06742fe3b66b9e8049db62ea55e1b41adf5 (patch)
tree0ce6dd83cda313e68eb2c55b95749740c2f2dfa6
parentece811dac9a2784b4a2937a4ece75b58d0db9e8b (diff)
parent61f794a70ffb05a343ef8fda91f3fd7ca5ac59f7 (diff)
Merge "Allow 3P apps to provide structured data within AssistContent." into mnc-dev
-rw-r--r--api/current.txt2
-rw-r--r--api/system-current.txt2
-rw-r--r--core/java/android/app/AssistContent.java26
3 files changed, 30 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 29fc7b130035..5126123999b0 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4019,10 +4019,12 @@ package android.app {
ctor public AssistContent();
method public android.content.ClipData getClipData();
method public android.os.Bundle getExtras();
+ method public java.lang.String getStructuredData();
method public android.net.Uri getWebUri();
method public boolean isAppProvidedIntent();
method public void setClipData(android.content.ClipData);
method public void setIntent(android.content.Intent);
+ method public void setStructuredData(java.lang.String);
method public void setWebUri(android.net.Uri);
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 4b4a77c754da..d3823fc66b0f 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4114,10 +4114,12 @@ package android.app {
ctor public AssistContent();
method public android.content.ClipData getClipData();
method public android.os.Bundle getExtras();
+ method public java.lang.String getStructuredData();
method public android.net.Uri getWebUri();
method public boolean isAppProvidedIntent();
method public void setClipData(android.content.ClipData);
method public void setIntent(android.content.Intent);
+ method public void setStructuredData(java.lang.String);
method public void setWebUri(android.net.Uri);
}
diff --git a/core/java/android/app/AssistContent.java b/core/java/android/app/AssistContent.java
index 0df9ce5b1dd9..ad2ba39761da 100644
--- a/core/java/android/app/AssistContent.java
+++ b/core/java/android/app/AssistContent.java
@@ -33,6 +33,7 @@ import android.os.Parcelable;
public class AssistContent {
private boolean mIsAppProvidedIntent = false;
private Intent mIntent;
+ private String mStructuredData;
private ClipData mClipData;
private Uri mUri;
private final Bundle mExtras;
@@ -125,6 +126,22 @@ public class AssistContent {
}
/**
+ * Sets optional structured data regarding the content being viewed. The provided data
+ * must be a string represented with <a href="http://json-ld.org/">JSON-LD</a> using the
+ * <a href="http://schema.org/">schema.org</a> vocabulary.
+ */
+ public void setStructuredData(String structuredData) {
+ mStructuredData = structuredData;
+ }
+
+ /**
+ * Returns the current {@link #setStructuredData}.
+ */
+ public String getStructuredData() {
+ return mStructuredData;
+ }
+
+ /**
* Set a web URI associated with the current data being shown to the user.
* This URI could be opened in a web browser, or in the app as an
* {@link Intent#ACTION_VIEW} Intent, to show the same data that is currently
@@ -163,6 +180,9 @@ public class AssistContent {
if (in.readInt() != 0) {
mUri = Uri.CREATOR.createFromParcel(in);
}
+ if (in.readInt() != 0) {
+ mStructuredData = in.readString();
+ }
mIsAppProvidedIntent = in.readInt() == 1;
mExtras = in.readBundle();
}
@@ -187,6 +207,12 @@ public class AssistContent {
} else {
dest.writeInt(0);
}
+ if (mStructuredData != null) {
+ dest.writeInt(1);
+ dest.writeString(mStructuredData);
+ } else {
+ dest.writeInt(0);
+ }
dest.writeInt(mIsAppProvidedIntent ? 1 : 0);
dest.writeBundle(mExtras);
}