Search in sources :

Example 11 with SomeArgs

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

the class PrintPreviewController method onContentUpdated.

public void onContentUpdated(boolean documentChanged, int documentPageCount, PageRange[] writtenPages, PageRange[] selectedPages, MediaSize mediaSize, Margins minMargins) {
    boolean contentChanged = false;
    if (documentChanged) {
        contentChanged = true;
    }
    if (documentPageCount != mDocumentPageCount) {
        mDocumentPageCount = documentPageCount;
        contentChanged = true;
    }
    if (contentChanged) {
        // If not closed, close as we start over.
        if (mPageAdapter.isOpened()) {
            Message operation = mHandler.obtainMessage(MyHandler.MSG_CLOSE);
            mHandler.enqueueOperation(operation);
        }
    }
    // all rendered pages and reopen the file...
    if ((contentChanged || !mPageAdapter.isOpened()) && writtenPages != null) {
        Message operation = mHandler.obtainMessage(MyHandler.MSG_OPEN);
        mHandler.enqueueOperation(operation);
    }
    // Update the attributes before after closed to avoid flicker.
    SomeArgs args = SomeArgs.obtain();
    args.arg1 = writtenPages;
    args.arg2 = selectedPages;
    args.arg3 = mediaSize;
    args.arg4 = minMargins;
    args.argi1 = documentPageCount;
    Message operation = mHandler.obtainMessage(MyHandler.MSG_UPDATE, args);
    mHandler.enqueueOperation(operation);
    // If document changed and has pages we want to start preloading.
    if (contentChanged && writtenPages != null) {
        operation = mHandler.obtainMessage(MyHandler.MSG_START_PRELOAD);
        mHandler.enqueueOperation(operation);
    }
}
Also used : Message(android.os.Message) SomeArgs(com.android.internal.os.SomeArgs)

Example 12 with SomeArgs

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

the class RecentsImplProxy method showRecents.

@Override
public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate, boolean reloadTasks, boolean fromHome, int growTarget) throws RemoteException {
    SomeArgs args = SomeArgs.obtain();
    args.argi1 = triggeredFromAltTab ? 1 : 0;
    args.argi2 = draggingInRecents ? 1 : 0;
    args.argi3 = animate ? 1 : 0;
    args.argi4 = reloadTasks ? 1 : 0;
    args.argi5 = fromHome ? 1 : 0;
    args.argi6 = growTarget;
    mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_RECENTS, args));
}
Also used : SomeArgs(com.android.internal.os.SomeArgs)

Example 13 with SomeArgs

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

the class InputMethodManagerService method handleMessage.

@Override
public boolean handleMessage(Message msg) {
    SomeArgs args;
    switch(msg.what) {
        case MSG_SHOW_IM_SUBTYPE_PICKER:
            final boolean showAuxSubtypes;
            switch(msg.arg1) {
                case InputMethodManager.SHOW_IM_PICKER_MODE_AUTO:
                    // This is undocumented so far, but IMM#showInputMethodPicker() has been
                    // implemented so that auxiliary subtypes will be excluded when the soft
                    // keyboard is invisible.
                    showAuxSubtypes = mInputShown;
                    break;
                case InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES:
                    showAuxSubtypes = true;
                    break;
                case InputMethodManager.SHOW_IM_PICKER_MODE_EXCLUDE_AUXILIARY_SUBTYPES:
                    showAuxSubtypes = false;
                    break;
                default:
                    Slog.e(TAG, "Unknown subtype picker mode = " + msg.arg1);
                    return false;
            }
            showInputMethodMenu(showAuxSubtypes);
            return true;
        case MSG_SHOW_IM_SUBTYPE_ENABLER:
            showInputMethodAndSubtypeEnabler((String) msg.obj);
            return true;
        case MSG_SHOW_IM_CONFIG:
            showConfigureInputMethods();
            return true;
        case MSG_UNBIND_INPUT:
            try {
                ((IInputMethod) msg.obj).unbindInput();
            } catch (RemoteException e) {
            // There is nothing interesting about the method dying.
            }
            return true;
        case MSG_BIND_INPUT:
            args = (SomeArgs) msg.obj;
            try {
                ((IInputMethod) args.arg1).bindInput((InputBinding) args.arg2);
            } catch (RemoteException e) {
            }
            args.recycle();
            return true;
        case MSG_SHOW_SOFT_INPUT:
            args = (SomeArgs) msg.obj;
            try {
                if (DEBUG)
                    Slog.v(TAG, "Calling " + args.arg1 + ".showSoftInput(" + msg.arg1 + ", " + args.arg2 + ")");
                ((IInputMethod) args.arg1).showSoftInput(msg.arg1, (ResultReceiver) args.arg2);
            } catch (RemoteException e) {
            }
            args.recycle();
            return true;
        case MSG_HIDE_SOFT_INPUT:
            args = (SomeArgs) msg.obj;
            try {
                if (DEBUG)
                    Slog.v(TAG, "Calling " + args.arg1 + ".hideSoftInput(0, " + args.arg2 + ")");
                ((IInputMethod) args.arg1).hideSoftInput(0, (ResultReceiver) args.arg2);
            } catch (RemoteException e) {
            }
            args.recycle();
            return true;
        case MSG_HIDE_CURRENT_INPUT_METHOD:
            synchronized (mMethodMap) {
                hideCurrentInputLocked(0, null);
            }
            return true;
        case MSG_ATTACH_TOKEN:
            args = (SomeArgs) msg.obj;
            try {
                if (DEBUG)
                    Slog.v(TAG, "Sending attach of token: " + args.arg2);
                ((IInputMethod) args.arg1).attachToken((IBinder) args.arg2);
            } catch (RemoteException e) {
            }
            args.recycle();
            return true;
        case MSG_CREATE_SESSION:
            {
                args = (SomeArgs) msg.obj;
                IInputMethod method = (IInputMethod) args.arg1;
                InputChannel channel = (InputChannel) args.arg2;
                try {
                    method.createSession(channel, (IInputSessionCallback) args.arg3);
                } catch (RemoteException e) {
                } finally {
                    // because the remote proxy will get its own copy when unparceled.
                    if (channel != null && Binder.isProxy(method)) {
                        channel.dispose();
                    }
                }
                args.recycle();
                return true;
            }
        case MSG_START_INPUT:
            {
                int missingMethods = msg.arg1;
                args = (SomeArgs) msg.obj;
                try {
                    SessionState session = (SessionState) args.arg1;
                    setEnabledSessionInMainThread(session);
                    session.method.startInput((IInputContext) args.arg2, missingMethods, (EditorInfo) args.arg3);
                } catch (RemoteException e) {
                }
                args.recycle();
                return true;
            }
        case MSG_RESTART_INPUT:
            {
                int missingMethods = msg.arg1;
                args = (SomeArgs) msg.obj;
                try {
                    SessionState session = (SessionState) args.arg1;
                    setEnabledSessionInMainThread(session);
                    session.method.restartInput((IInputContext) args.arg2, missingMethods, (EditorInfo) args.arg3);
                } catch (RemoteException e) {
                }
                args.recycle();
                return true;
            }
        case MSG_UNBIND_CLIENT:
            try {
                ((IInputMethodClient) msg.obj).onUnbindMethod(msg.arg1, msg.arg2);
            } catch (RemoteException e) {
            // There is nothing interesting about the last client dying.
            }
            return true;
        case MSG_BIND_CLIENT:
            {
                args = (SomeArgs) msg.obj;
                IInputMethodClient client = (IInputMethodClient) args.arg1;
                InputBindResult res = (InputBindResult) args.arg2;
                try {
                    client.onBindMethod(res);
                } catch (RemoteException e) {
                    Slog.w(TAG, "Client died receiving input method " + args.arg2);
                } finally {
                    // because the remote proxy will get its own copy when unparceled.
                    if (res.channel != null && Binder.isProxy(client)) {
                        res.channel.dispose();
                    }
                }
                args.recycle();
                return true;
            }
        case MSG_SET_ACTIVE:
            try {
                ((ClientState) msg.obj).client.setActive(msg.arg1 != 0);
            } catch (RemoteException e) {
                Slog.w(TAG, "Got RemoteException sending setActive(false) notification to pid " + ((ClientState) msg.obj).pid + " uid " + ((ClientState) msg.obj).uid);
            }
            return true;
        case MSG_SET_INTERACTIVE:
            handleSetInteractive(msg.arg1 != 0);
            return true;
        case MSG_SWITCH_IME:
            handleSwitchInputMethod(msg.arg1 != 0);
            return true;
        case MSG_SET_USER_ACTION_NOTIFICATION_SEQUENCE_NUMBER:
            {
                final int sequenceNumber = msg.arg1;
                final ClientState clientState = (ClientState) msg.obj;
                try {
                    clientState.client.setUserActionNotificationSequenceNumber(sequenceNumber);
                } catch (RemoteException e) {
                    Slog.w(TAG, "Got RemoteException sending " + "setUserActionNotificationSequenceNumber(" + sequenceNumber + ") notification to pid " + clientState.pid + " uid " + clientState.uid);
                }
                return true;
            }
        // --------------------------------------------------------------
        case MSG_HARD_KEYBOARD_SWITCH_CHANGED:
            mHardKeyboardListener.handleHardKeyboardStatusChange(msg.arg1 == 1);
            return true;
        case MSG_SYSTEM_UNLOCK_USER:
            final int userId = msg.arg1;
            onUnlockUser(userId);
            return true;
    }
    return false;
}
Also used : IInputSessionCallback(com.android.internal.view.IInputSessionCallback) InputBindResult(com.android.internal.view.InputBindResult) IInputContext(com.android.internal.view.IInputContext) IInputMethod(com.android.internal.view.IInputMethod) EditorInfo(android.view.inputmethod.EditorInfo) SomeArgs(com.android.internal.os.SomeArgs) IInputMethodClient(com.android.internal.view.IInputMethodClient) InputChannel(android.view.InputChannel) RemoteException(android.os.RemoteException)

Example 14 with SomeArgs

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

the class InputManagerService method notifySwitch.

// Native callback.
private void notifySwitch(long whenNanos, int switchValues, int switchMask) {
    if (DEBUG) {
        Slog.d(TAG, "notifySwitch: values=" + Integer.toHexString(switchValues) + ", mask=" + Integer.toHexString(switchMask));
    }
    if ((switchMask & SW_LID_BIT) != 0) {
        final boolean lidOpen = ((switchValues & SW_LID_BIT) == 0);
        mWindowManagerCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen);
    }
    if ((switchMask & SW_CAMERA_LENS_COVER_BIT) != 0) {
        final boolean lensCovered = ((switchValues & SW_CAMERA_LENS_COVER_BIT) != 0);
        mWindowManagerCallbacks.notifyCameraLensCoverSwitchChanged(whenNanos, lensCovered);
    }
    if (mUseDevInputEventForAudioJack && (switchMask & SW_JACK_BITS) != 0) {
        mWiredAccessoryCallbacks.notifyWiredAccessoryChanged(whenNanos, switchValues, switchMask);
    }
    if ((switchMask & SW_TABLET_MODE_BIT) != 0) {
        SomeArgs args = SomeArgs.obtain();
        args.argi1 = (int) (whenNanos & 0xFFFFFFFF);
        args.argi2 = (int) (whenNanos >> 32);
        args.arg1 = Boolean.valueOf((switchValues & SW_TABLET_MODE_BIT) != 0);
        mHandler.obtainMessage(MSG_DELIVER_TABLET_MODE_CHANGED, args).sendToTarget();
    }
}
Also used : SomeArgs(com.android.internal.os.SomeArgs)

Example 15 with SomeArgs

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

the class InputManagerService method setKeyboardLayoutForInputDeviceInner.

private void setKeyboardLayoutForInputDeviceInner(InputDeviceIdentifier identifier, InputMethodSubtypeHandle imeHandle, String keyboardLayoutDescriptor) {
    String key = getLayoutDescriptor(identifier);
    synchronized (mDataStore) {
        try {
            if (mDataStore.setKeyboardLayout(key, imeHandle, keyboardLayoutDescriptor)) {
                if (DEBUG) {
                    Slog.d(TAG, "Set keyboard layout " + keyboardLayoutDescriptor + " for subtype " + imeHandle + " and device " + identifier + " using key " + key);
                }
                if (imeHandle.equals(mCurrentImeHandle)) {
                    if (DEBUG) {
                        Slog.d(TAG, "Layout for current subtype changed, switching layout");
                    }
                    SomeArgs args = SomeArgs.obtain();
                    args.arg1 = identifier;
                    args.arg2 = imeHandle;
                    mHandler.obtainMessage(MSG_SWITCH_KEYBOARD_LAYOUT, args).sendToTarget();
                }
                mHandler.sendEmptyMessage(MSG_RELOAD_KEYBOARD_LAYOUTS);
            }
        } finally {
            mDataStore.saveIfNeeded();
        }
    }
}
Also used : SomeArgs(com.android.internal.os.SomeArgs)

Aggregations

SomeArgs (com.android.internal.os.SomeArgs)187 Message (android.os.Message)67 Point (android.graphics.Point)46 RemoteException (android.os.RemoteException)42 IAccessibilityInteractionConnectionCallback (android.view.accessibility.IAccessibilityInteractionConnectionCallback)36 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)30 Region (android.graphics.Region)25 AccessibilityNodeProvider (android.view.accessibility.AccessibilityNodeProvider)18 IInputMethod (com.android.internal.view.IInputMethod)12 InputChannel (android.view.InputChannel)11 EditorInfo (android.view.inputmethod.EditorInfo)11 IInputContext (com.android.internal.view.IInputContext)11 Rect (android.graphics.Rect)7 Configuration (android.content.res.Configuration)6 Bundle (android.os.Bundle)6 IBinder (android.os.IBinder)6 InputBinding (android.view.inputmethod.InputBinding)6 InputConnection (android.view.inputmethod.InputConnection)6 InputMethod (android.view.inputmethod.InputMethod)6 IInputMethodClient (com.android.internal.view.IInputMethodClient)6