am a28863e7: Merge "Record provision of custom Intents in AssistContent" into mnc-dev
* commit 'a28863e76979a3551509d8e5eccf3a1c7c604022': Record provision of custom Intents in AssistContent
This commit is contained in:
@@ -4000,6 +4000,7 @@ package android.app {
|
||||
ctor public AssistContent();
|
||||
method public android.content.ClipData getClipData();
|
||||
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 setWebUri(android.net.Uri);
|
||||
|
||||
@@ -4096,6 +4096,7 @@ package android.app {
|
||||
ctor public AssistContent();
|
||||
method public android.content.ClipData getClipData();
|
||||
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 setWebUri(android.net.Uri);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,13 +75,35 @@ 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() {
|
||||
return mIntent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user