use of android.app.assist.AssistContent in project platform_frameworks_base by android.
the class VoiceInteractionSessionConnection method deliverSessionDataLocked.
private void deliverSessionDataLocked(AssistDataForActivity assistDataForActivity) {
Bundle assistData = assistDataForActivity.data.getBundle(VoiceInteractionSession.KEY_DATA);
AssistStructure structure = assistDataForActivity.data.getParcelable(VoiceInteractionSession.KEY_STRUCTURE);
AssistContent content = assistDataForActivity.data.getParcelable(VoiceInteractionSession.KEY_CONTENT);
int uid = assistDataForActivity.data.getInt(Intent.EXTRA_ASSIST_UID, -1);
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());
}
}
try {
mSession.handleAssist(assistData, structure, content, assistDataForActivity.activityIndex, assistDataForActivity.activityCount);
} catch (RemoteException e) {
}
}
use of android.app.assist.AssistContent in project android_frameworks_base by DirtyUnicorns.
the class VoiceInteractionSessionConnection method deliverSessionDataLocked.
private void deliverSessionDataLocked(AssistDataForActivity assistDataForActivity) {
Bundle assistData = assistDataForActivity.data.getBundle(VoiceInteractionSession.KEY_DATA);
AssistStructure structure = assistDataForActivity.data.getParcelable(VoiceInteractionSession.KEY_STRUCTURE);
AssistContent content = assistDataForActivity.data.getParcelable(VoiceInteractionSession.KEY_CONTENT);
int uid = assistDataForActivity.data.getInt(Intent.EXTRA_ASSIST_UID, -1);
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());
}
}
try {
mSession.handleAssist(assistData, structure, content, assistDataForActivity.activityIndex, assistDataForActivity.activityCount);
} catch (RemoteException e) {
}
}
use of android.app.assist.AssistContent in project android_frameworks_base by DirtyUnicorns.
the class ActivityThread method handleRequestAssistContextExtras.
public void handleRequestAssistContextExtras(RequestAssistContextExtras cmd) {
if (mLastSessionId != cmd.sessionId) {
// Clear the existing structures
mLastSessionId = cmd.sessionId;
for (int i = mLastAssistStructures.size() - 1; i >= 0; i--) {
AssistStructure structure = mLastAssistStructures.get(i).get();
if (structure != null) {
structure.clearSendChannel();
}
mLastAssistStructures.remove(i);
}
}
Bundle data = new Bundle();
AssistStructure structure = null;
AssistContent content = new AssistContent();
ActivityClientRecord r = mActivities.get(cmd.activityToken);
Uri referrer = null;
if (r != null) {
r.activity.getApplication().dispatchOnProvideAssistData(r.activity, data);
r.activity.onProvideAssistData(data);
referrer = r.activity.onProvideReferrer();
if (cmd.requestType == ActivityManager.ASSIST_CONTEXT_FULL) {
structure = new AssistStructure(r.activity);
Intent activityIntent = r.activity.getIntent();
if (activityIntent != null && (r.window == null || (r.window.getAttributes().flags & WindowManager.LayoutParams.FLAG_SECURE) == 0)) {
Intent intent = new Intent(activityIntent);
intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION));
intent.removeUnsafeExtras();
content.setDefaultIntent(intent);
} else {
content.setDefaultIntent(new Intent());
}
r.activity.onProvideAssistContent(content);
}
}
if (structure == null) {
structure = new AssistStructure();
}
mLastAssistStructures.add(new WeakReference<>(structure));
IActivityManager mgr = ActivityManagerNative.getDefault();
try {
mgr.reportAssistContextExtras(cmd.requestToken, data, structure, content, referrer);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
use of android.app.assist.AssistContent in project android_frameworks_base by AOSPA.
the class ActivityThread method handleRequestAssistContextExtras.
public void handleRequestAssistContextExtras(RequestAssistContextExtras cmd) {
if (mLastSessionId != cmd.sessionId) {
// Clear the existing structures
mLastSessionId = cmd.sessionId;
for (int i = mLastAssistStructures.size() - 1; i >= 0; i--) {
AssistStructure structure = mLastAssistStructures.get(i).get();
if (structure != null) {
structure.clearSendChannel();
}
mLastAssistStructures.remove(i);
}
}
Bundle data = new Bundle();
AssistStructure structure = null;
AssistContent content = new AssistContent();
ActivityClientRecord r = mActivities.get(cmd.activityToken);
Uri referrer = null;
if (r != null) {
r.activity.getApplication().dispatchOnProvideAssistData(r.activity, data);
r.activity.onProvideAssistData(data);
referrer = r.activity.onProvideReferrer();
if (cmd.requestType == ActivityManager.ASSIST_CONTEXT_FULL) {
structure = new AssistStructure(r.activity);
Intent activityIntent = r.activity.getIntent();
if (activityIntent != null && (r.window == null || (r.window.getAttributes().flags & WindowManager.LayoutParams.FLAG_SECURE) == 0)) {
Intent intent = new Intent(activityIntent);
intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION));
intent.removeUnsafeExtras();
content.setDefaultIntent(intent);
} else {
content.setDefaultIntent(new Intent());
}
r.activity.onProvideAssistContent(content);
}
}
if (structure == null) {
structure = new AssistStructure();
}
mLastAssistStructures.add(new WeakReference<>(structure));
IActivityManager mgr = ActivityManagerNative.getDefault();
try {
mgr.reportAssistContextExtras(cmd.requestToken, data, structure, content, referrer);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
use of android.app.assist.AssistContent in project android_frameworks_base by ResurrectionRemix.
the class ActivityThread method handleRequestAssistContextExtras.
public void handleRequestAssistContextExtras(RequestAssistContextExtras cmd) {
if (mLastSessionId != cmd.sessionId) {
// Clear the existing structures
mLastSessionId = cmd.sessionId;
for (int i = mLastAssistStructures.size() - 1; i >= 0; i--) {
AssistStructure structure = mLastAssistStructures.get(i).get();
if (structure != null) {
structure.clearSendChannel();
}
mLastAssistStructures.remove(i);
}
}
Bundle data = new Bundle();
AssistStructure structure = null;
AssistContent content = new AssistContent();
ActivityClientRecord r = mActivities.get(cmd.activityToken);
Uri referrer = null;
if (r != null) {
r.activity.getApplication().dispatchOnProvideAssistData(r.activity, data);
r.activity.onProvideAssistData(data);
referrer = r.activity.onProvideReferrer();
if (cmd.requestType == ActivityManager.ASSIST_CONTEXT_FULL) {
structure = new AssistStructure(r.activity);
Intent activityIntent = r.activity.getIntent();
if (activityIntent != null && (r.window == null || (r.window.getAttributes().flags & WindowManager.LayoutParams.FLAG_SECURE) == 0)) {
Intent intent = new Intent(activityIntent);
intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION));
intent.removeUnsafeExtras();
content.setDefaultIntent(intent);
} else {
content.setDefaultIntent(new Intent());
}
r.activity.onProvideAssistContent(content);
}
}
if (structure == null) {
structure = new AssistStructure();
}
mLastAssistStructures.add(new WeakReference<>(structure));
IActivityManager mgr = ActivityManagerNative.getDefault();
try {
mgr.reportAssistContextExtras(cmd.requestToken, data, structure, content, referrer);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
Aggregations