Search in sources :

Example 1 with IResultReceiver

use of com.android.internal.os.IResultReceiver in project android_frameworks_base by DirtyUnicorns.

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) {
    }
}
Also used : IResultReceiver(com.android.internal.os.IResultReceiver) Bundle(android.os.Bundle) RemoteException(android.os.RemoteException)

Example 2 with IResultReceiver

use of com.android.internal.os.IResultReceiver in project android_frameworks_base by AOSPA.

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) {
    }
}
Also used : IResultReceiver(com.android.internal.os.IResultReceiver) Bundle(android.os.Bundle) RemoteException(android.os.RemoteException)

Example 3 with IResultReceiver

use of com.android.internal.os.IResultReceiver in project platform_frameworks_base by android.

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);
    }
}
Also used : IResultReceiver(com.android.internal.os.IResultReceiver) ActivityNotFoundException(android.content.ActivityNotFoundException) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) UserHandle(android.os.UserHandle) RemoteException(android.os.RemoteException)

Example 4 with IResultReceiver

use of com.android.internal.os.IResultReceiver in project platform_frameworks_base by android.

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) {
    }
}
Also used : IResultReceiver(com.android.internal.os.IResultReceiver) Bundle(android.os.Bundle) RemoteException(android.os.RemoteException)

Example 5 with IResultReceiver

use of com.android.internal.os.IResultReceiver in project platform_frameworks_base by android.

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) {
        }
    }
}
Also used : IResultReceiver(com.android.internal.os.IResultReceiver) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) RemoteException(android.os.RemoteException)

Aggregations

Bundle (android.os.Bundle)9 RemoteException (android.os.RemoteException)9 IResultReceiver (com.android.internal.os.IResultReceiver)9 PersistableBundle (android.os.PersistableBundle)4 ActivityNotFoundException (android.content.ActivityNotFoundException)2 UserHandle (android.os.UserHandle)2