summaryrefslogtreecommitdiffstats
path: root/services/voiceinteraction
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-05-27 18:05:52 -0700
committerDianne Hackborn <hackbod@google.com>2015-05-28 11:44:58 -0700
commit09d57fe9b357495b7bc62be39a8befa00d9d7ffb (patch)
tree1d71edec334401bb5b978f64267d7d8b496582cb /services/voiceinteraction
parentda1b398173a94e94c61a0d186c7dc0ef2a7bd060 (diff)
downloadframeworks_base-09d57fe9b357495b7bc62be39a8befa00d9d7ffb.zip
frameworks_base-09d57fe9b357495b7bc62be39a8befa00d9d7ffb.tar.gz
frameworks_base-09d57fe9b357495b7bc62be39a8befa00d9d7ffb.tar.bz2
Add new API to set URI on AssistContent.
Also rework how we transfer AssistContent and AssistStructure to the assistant, so they are delivered as completely separate objects rather than the kludgy bundling them in the assist data thing. Change-Id: Ib40cc3b152bafeb358fd3adec564a7dda3a0dd1d
Diffstat (limited to 'services/voiceinteraction')
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java45
1 files changed, 25 insertions, 20 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 03abfba..1117373 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -20,6 +20,7 @@ import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.AssistContent;
+import android.app.AssistStructure;
import android.app.IActivityManager;
import android.content.ClipData;
import android.content.ComponentName;
@@ -291,33 +292,37 @@ final class VoiceInteractionSessionConnection implements ServiceConnection {
return;
}
if (mHaveAssistData) {
+ Bundle assistData;
+ AssistStructure structure;
+ AssistContent content;
if (mAssistData != null) {
+ assistData = mAssistData.getBundle("data");
+ structure = mAssistData.getParcelable("structure");
+ content = mAssistData.getParcelable("content");
int uid = mAssistData.getInt(Intent.EXTRA_ASSIST_UID, -1);
- if (uid >= 0) {
- Bundle assistContext = mAssistData.getBundle(Intent.EXTRA_ASSIST_CONTEXT);
- if (assistContext != null) {
- AssistContent content = AssistContent.getAssistContent(assistContext);
- if (content != null) {
- Intent intent = content.getIntent();
- if (intent != null) {
- ClipData data = intent.getClipData();
- if (data != null && Intent.isAccessUriMode(intent.getFlags())) {
- grantClipDataPermissions(data, intent.getFlags(), uid,
- mCallingUid, mSessionComponentName.getPackageName());
- }
- }
- ClipData data = content.getClipData();
- if (data != null) {
- grantClipDataPermissions(data,
- Intent.FLAG_GRANT_READ_URI_PERMISSION,
- uid, mCallingUid, mSessionComponentName.getPackageName());
- }
+ if (uid >= 0 && content != null) {
+ Intent intent = content.getIntent();
+ if (intent != null) {
+ ClipData data = intent.getClipData();
+ if (data != null && Intent.isAccessUriMode(intent.getFlags())) {
+ grantClipDataPermissions(data, intent.getFlags(), uid,
+ mCallingUid, mSessionComponentName.getPackageName());
}
}
+ ClipData data = content.getClipData();
+ if (data != null) {
+ grantClipDataPermissions(data,
+ Intent.FLAG_GRANT_READ_URI_PERMISSION,
+ uid, mCallingUid, mSessionComponentName.getPackageName());
+ }
}
+ } else {
+ assistData = null;
+ structure = null;
+ content = null;
}
try {
- mSession.handleAssist(mAssistData);
+ mSession.handleAssist(assistData, structure, content);
} catch (RemoteException e) {
}
mAssistData = null;