diff options
author | Adam Skory <skory@google.com> | 2015-06-06 01:00:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-06 01:01:00 +0000 |
commit | a28863e76979a3551509d8e5eccf3a1c7c604022 (patch) | |
tree | 62099a4f7e687f14bc341a6a00bc81044731c359 /core/java | |
parent | 76233f068bde3c19d1d0986efee4fb21df973ed5 (diff) | |
parent | cd70c64f50be9e20c926a82bab3e9a737b05e464 (diff) | |
download | frameworks_base-a28863e76979a3551509d8e5eccf3a1c7c604022.zip frameworks_base-a28863e76979a3551509d8e5eccf3a1c7c604022.tar.gz frameworks_base-a28863e76979a3551509d8e5eccf3a1c7c604022.tar.bz2 |
Merge "Record provision of custom Intents in AssistContent" into mnc-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 4 | ||||
-rw-r--r-- | core/java/android/app/AssistContent.java | 40 |
2 files changed, 33 insertions, 11 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 10d76f7..3d26ccd 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -2584,9 +2584,9 @@ public final class ActivityThread { intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)); intent.removeUnsafeExtras(); - content.setIntent(intent); + content.setDefaultIntent(intent); } else { - content.setIntent(new Intent()); + content.setDefaultIntent(new Intent()); } r.activity.onProvideAssistContent(content); } diff --git a/core/java/android/app/AssistContent.java b/core/java/android/app/AssistContent.java index 4cb89a8..8c98aa9 100644 --- a/core/java/android/app/AssistContent.java +++ b/core/java/android/app/AssistContent.java @@ -31,6 +31,7 @@ import android.os.Parcelable; */ @Deprecated public class AssistContent { + private boolean mIsAppProvidedIntent = false; private Intent mIntent; private ClipData mClipData; private Uri mUri; @@ -55,12 +56,14 @@ public class AssistContent { } /** - * Sets the Intent associated with the content, describing the current top-level context of - * the activity. If this contains a reference to a piece of data related to the activity, - * be sure to set {@link Intent#FLAG_GRANT_READ_URI_PERMISSION} so the accessibility - * service can access it. + * @hide + * Called by {@link android.app.ActivityThread} to set the default Intent based on + * {@link android.app.Activity#getIntent Activity.getIntent}. + * + * <p>Automatically populates {@link #mUri} if that Intent is an {@link Intent#ACTION_VIEW} + * of a web (http or https scheme) URI.</p> */ - public void setIntent(Intent intent) { + public void setDefaultIntent(Intent intent) { mIntent = intent; setWebUri(null); if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) { @@ -72,7 +75,19 @@ public class AssistContent { } /** - * Return the current {@link #setIntent}, which you can modify in-place. + * Sets the Intent associated with the content, describing the current top-level context of + * the activity. If this contains a reference to a piece of data related to the activity, + * be sure to set {@link Intent#FLAG_GRANT_READ_URI_PERMISSION} so the accessibility + * service can access it. + */ + public void setIntent(Intent intent) { + mIsAppProvidedIntent = true; + mIntent = intent; + } + + /** + * Returns the current {@link #setIntent} if one is set, else the default Intent obtained from + * {@link android.app.Activity#getIntent Activity.getIntent}. Can be modified in-place. * @hide */ public Intent getIntent() { @@ -80,6 +95,16 @@ public class AssistContent { } /** + * Returns whether or not the current Intent 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 isAppProvidedIntent() { + return mIsAppProvidedIntent; + } + + /** * Optional additional content items that are involved with * the current UI. Access to this content will be granted to the assistant as if you * are sending it through an Intent with {@link Intent#FLAG_GRANT_READ_URI_PERMISSION}. @@ -103,9 +128,6 @@ public class AssistContent { * off the device into other environments to acesss the same data as is currently * being shown in the app; if the app does not have such a representation, it should * leave the null and only report the local intent and clip data. - * - * <p>This will be automatically populated for you from {@link #setIntent} if that Intent - * is an {@link Intent#ACTION_VIEW} of a web (http or https scheme) URI.</p> */ public void setWebUri(Uri uri) { mUri = uri; |