use of com.android.internal.os.IResultReceiver in project android_frameworks_base by DirtyUnicorns.
the class ActivityManagerService method reportAssistContextExtras.
public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure, AssistContent content, Uri referrer) {
PendingAssistExtras pae = (PendingAssistExtras) token;
synchronized (pae) {
pae.result = extras;
pae.structure = structure;
pae.content = content;
if (referrer != null) {
pae.extras.putParcelable(Intent.EXTRA_REFERRER, referrer);
}
pae.haveResult = true;
pae.notifyAll();
if (pae.intent == null && pae.receiver == null) {
// Caller is just waiting for the result.
return;
}
}
// We are now ready to launch the assist activity.
IResultReceiver sendReceiver = null;
Bundle sendBundle = null;
synchronized (this) {
buildAssistBundleLocked(pae, extras);
boolean exists = mPendingAssistExtras.remove(pae);
mUiHandler.removeCallbacks(pae);
if (!exists) {
// Timed out.
return;
}
if ((sendReceiver = pae.receiver) != null) {
// Caller wants result sent back to them.
sendBundle = new Bundle();
sendBundle.putBundle(VoiceInteractionSession.KEY_DATA, pae.extras);
sendBundle.putParcelable(VoiceInteractionSession.KEY_STRUCTURE, pae.structure);
sendBundle.putParcelable(VoiceInteractionSession.KEY_CONTENT, pae.content);
sendBundle.putBundle(VoiceInteractionSession.KEY_RECEIVER_EXTRAS, pae.receiverExtras);
}
}
if (sendReceiver != null) {
try {
sendReceiver.send(0, sendBundle);
} catch (RemoteException e) {
}
return;
}
long ident = Binder.clearCallingIdentity();
try {
pae.intent.replaceExtras(pae.extras);
pae.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
closeSystemDialogs("assist");
try {
mContext.startActivityAsUser(pae.intent, new UserHandle(pae.userHandle));
} catch (ActivityNotFoundException e) {
Slog.w(TAG, "No activity to handle assist action.", e);
}
} finally {
Binder.restoreCallingIdentity(ident);
}
}
use of com.android.internal.os.IResultReceiver in project android_frameworks_base by DirtyUnicorns.
the class ActivityManagerService method pendingAssistExtrasTimedOut.
void pendingAssistExtrasTimedOut(PendingAssistExtras pae) {
IResultReceiver receiver;
synchronized (this) {
mPendingAssistExtras.remove(pae);
receiver = pae.receiver;
}
if (receiver != null) {
// Caller wants result sent back to them.
Bundle sendBundle = new Bundle();
// At least return the receiver extras
sendBundle.putBundle(VoiceInteractionSession.KEY_RECEIVER_EXTRAS, pae.receiverExtras);
try {
pae.receiver.send(0, sendBundle);
} catch (RemoteException e) {
}
}
}
use of com.android.internal.os.IResultReceiver in project android_frameworks_base by ResurrectionRemix.
the class WindowManagerImpl method requestAppKeyboardShortcuts.
@Override
public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId) {
IResultReceiver resultReceiver = new IResultReceiver.Stub() {
@Override
public void send(int resultCode, Bundle resultData) throws RemoteException {
List<KeyboardShortcutGroup> result = resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY);
receiver.onKeyboardShortcutsReceived(result);
}
};
try {
WindowManagerGlobal.getWindowManagerService().requestAppKeyboardShortcuts(resultReceiver, deviceId);
} catch (RemoteException e) {
}
}
use of com.android.internal.os.IResultReceiver in project android_frameworks_base by crdroidandroid.
the class WindowManagerImpl method requestAppKeyboardShortcuts.
@Override
public void requestAppKeyboardShortcuts(final KeyboardShortcutsReceiver receiver, int deviceId) {
IResultReceiver resultReceiver = new IResultReceiver.Stub() {
@Override
public void send(int resultCode, Bundle resultData) throws RemoteException {
List<KeyboardShortcutGroup> result = resultData.getParcelableArrayList(PARCEL_KEY_SHORTCUTS_ARRAY);
receiver.onKeyboardShortcutsReceived(result);
}
};
try {
WindowManagerGlobal.getWindowManagerService().requestAppKeyboardShortcuts(resultReceiver, deviceId);
} catch (RemoteException e) {
}
}
Aggregations