@android.annotation.BinderThread

Here are the examples of the java api @android.annotation.BinderThread taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

13 Examples 7

19 Source : BluetoothHealthCallback.java
with Apache License 2.0
from lulululbj

/**
 * Callback to inform change in registration state of the health
 * application.
 * <p> This callback is called on the binder thread (not on the UI thread)
 *
 * @param config Bluetooth Health app configuration
 * @param status Success or failure of the registration or unregistration calls. Can be one of
 * {@link BluetoothHealth#APP_CONFIG_REGISTRATION_SUCCESS} or {@link
 * BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or
 * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS}
 * or {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE}
 */
@BinderThread
public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, int status) {
    Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status);
}

18 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void changeInputMethodSubtype(InputMethodSubtype subtype) {
    mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CHANGE_INPUTMETHOD_SUBTYPE, subtype));
}

18 Source : BluetoothHealthCallback.java
with Apache License 2.0
from lulululbj

/**
 * Callback to inform change in channel state.
 * <p> Its the responsibility of the implementor of this callback to close the
 * parcel file descriptor when done. This callback is called on the Binder
 * thread (not the UI thread)
 *
 * @param config The Health app configutation
 * @param device The Bluetooth Device
 * @param prevState The previous state of the channel
 * @param newState The new state of the channel.
 * @param fd The Parcel File Descriptor when the channel state is connected.
 * @param channelId The id replacedociated with the channel. This id will be used in future calls
 * like when disconnecting the channel.
 */
@BinderThread
public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, int channelId) {
    Log.d(TAG, "onHealthChannelStateChange: " + config + "Device: " + device + "prevState:" + prevState + "newState:" + newState + "ParcelFd:" + fd + "ChannelId:" + channelId);
}

17 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void hideSoftInput(int flags, ResultReceiver resultReceiver) {
    mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_HIDE_SOFT_INPUT, flags, resultReceiver));
}

17 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void attachToken(IBinder token) {
    mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token));
}

17 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void unbindInput() {
    if (mIsUnbindIssued != null) {
        // Signal the flag then forget it.
        mIsUnbindIssued.set(true);
        mIsUnbindIssued = null;
    } else {
        Log.e(TAG, "unbindInput must be paired with bindInput.");
    }
    mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_UNSET_INPUT_CONTEXT));
}

17 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void showSoftInput(int flags, ResultReceiver resultReceiver) {
    mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_SHOW_SOFT_INPUT, flags, resultReceiver));
}

17 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void bindInput(InputBinding binding) {
    if (mIsUnbindIssued != null) {
        Log.e(TAG, "bindInput must be paired with unbindInput.");
    }
    mIsUnbindIssued = new AtomicBoolean();
    // This IInputContext is guaranteed to implement all the methods.
    final int missingMethodFlags = 0;
    InputConnection ic = new InputConnectionWrapper(mTarget, IInputContext.Stub.asInterface(binding.getConnectionToken()), missingMethodFlags, mIsUnbindIssued);
    InputBinding nu = new InputBinding(ic, binding);
    mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
}

17 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void revokeSession(IInputMethodSession session) {
    try {
        InputMethodSession ls = ((IInputMethodSessionWrapper) session).getInternalInputMethodSession();
        if (ls == null) {
            Log.w(TAG, "Session is already finished: " + session);
            return;
        }
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_REVOKE_SESSION, ls));
    } catch (ClreplacedCastException e) {
        Log.w(TAG, "Incoming session not of correct type: " + session, e);
    }
}

16 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    AbstractInputMethodService target = mTarget.get();
    if (target == null) {
        return;
    }
    if (target.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        fout.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    CountDownLatch latch = new CountDownLatch(1);
    mCaller.executeOrSendMessage(mCaller.obtainMessageOOOO(DO_DUMP, fd, fout, args, latch));
    try {
        if (!latch.await(5, TimeUnit.SECONDS)) {
            fout.println("Timeout waiting for dump");
        }
    } catch (InterruptedException e) {
        fout.println("Interrupted waiting for dump");
    }
}

16 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void setSessionEnabled(IInputMethodSession session, boolean enabled) {
    try {
        InputMethodSession ls = ((IInputMethodSessionWrapper) session).getInternalInputMethodSession();
        if (ls == null) {
            Log.w(TAG, "Session is already finished: " + session);
            return;
        }
        mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_SET_SESSION_ENABLED, enabled ? 1 : 0, ls));
    } catch (ClreplacedCastException e) {
        Log.w(TAG, "Incoming session not of correct type: " + session, e);
    }
}

16 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void startInput(IBinder startInputToken, IInputContext inputContext, @InputConnectionInspector.MissingMethodFlags final int missingMethods, EditorInfo attribute, boolean restarting) {
    if (mIsUnbindIssued == null) {
        Log.e(TAG, "startInput must be called after bindInput.");
        mIsUnbindIssued = new AtomicBoolean();
    }
    mCaller.executeOrSendMessage(mCaller.obtainMessageIIOOOO(DO_START_INPUT, missingMethods, restarting ? 1 : 0, startInputToken, inputContext, attribute, mIsUnbindIssued));
}

16 Source : IInputMethodWrapper.java
with Apache License 2.0
from lulululbj

@BinderThread
@Override
public void createSession(InputChannel channel, IInputSessionCallback callback) {
    mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_CREATE_SESSION, channel, callback));
}