Search in sources :

Example 41 with IBinder

use of android.os.IBinder in project android_frameworks_base by ParanoidAndroid.

the class ActivityManagerProxy method newUriPermissionOwner.

public IBinder newUriPermissionOwner(String name) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    data.writeInterfaceToken(IActivityManager.descriptor);
    data.writeString(name);
    mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
    reply.readException();
    IBinder res = reply.readStrongBinder();
    data.recycle();
    reply.recycle();
    return res;
}
Also used : IBinder(android.os.IBinder) Parcel(android.os.Parcel)

Example 42 with IBinder

use of android.os.IBinder in project android_frameworks_base by ParanoidAndroid.

the class ActivityManagerProxy method peekService.

public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    data.writeInterfaceToken(IActivityManager.descriptor);
    service.writeToParcel(data, 0);
    data.writeString(resolvedType);
    mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
    reply.readException();
    IBinder binder = reply.readStrongBinder();
    reply.recycle();
    data.recycle();
    return binder;
}
Also used : IBinder(android.os.IBinder) Parcel(android.os.Parcel)

Example 43 with IBinder

use of android.os.IBinder in project android_frameworks_base by ParanoidAndroid.

the class NotificationManager method getService.

/** @hide */
public static INotificationManager getService() {
    if (sService != null) {
        return sService;
    }
    IBinder b = ServiceManager.getService("notification");
    sService = INotificationManager.Stub.asInterface(b);
    return sService;
}
Also used : IBinder(android.os.IBinder)

Example 44 with IBinder

use of android.os.IBinder in project android_frameworks_base by ParanoidAndroid.

the class BluetoothAdapter method getDefaultAdapter.

/**
     * Get a handle to the default local Bluetooth adapter.
     * <p>Currently Android only supports one Bluetooth adapter, but the API
     * could be extended to support more. This will always return the default
     * adapter.
     * @return the default local adapter, or null if Bluetooth is not supported
     *         on this hardware platform
     */
public static synchronized BluetoothAdapter getDefaultAdapter() {
    if (sAdapter == null) {
        IBinder b = ServiceManager.getService(BLUETOOTH_MANAGER_SERVICE);
        if (b != null) {
            IBluetoothManager managerService = IBluetoothManager.Stub.asInterface(b);
            sAdapter = new BluetoothAdapter(managerService);
        } else {
            Log.e(TAG, "Bluetooth binder is null");
        }
    }
    return sAdapter;
}
Also used : IBinder(android.os.IBinder)

Example 45 with IBinder

use of android.os.IBinder in project android_frameworks_base by ParanoidAndroid.

the class BroadcastReceiver method peekService.

/**
     * Provide a binder to an already-running service.  This method is synchronous
     * and will not start the target service if it is not present, so it is safe
     * to call from {@link #onReceive}.
     * 
     * @param myContext The Context that had been passed to {@link #onReceive(Context, Intent)}
     * @param service The Intent indicating the service you wish to use.  See {@link
     * Context#startService(Intent)} for more information.
     */
public IBinder peekService(Context myContext, Intent service) {
    IActivityManager am = ActivityManagerNative.getDefault();
    IBinder binder = null;
    try {
        service.prepareToLeaveProcess();
        binder = am.peekService(service, service.resolveTypeIfNeeded(myContext.getContentResolver()));
    } catch (RemoteException e) {
    }
    return binder;
}
Also used : IBinder(android.os.IBinder) RemoteException(android.os.RemoteException) IActivityManager(android.app.IActivityManager)

Aggregations

IBinder (android.os.IBinder)1139 RemoteException (android.os.RemoteException)553 Intent (android.content.Intent)186 ComponentName (android.content.ComponentName)166 ServiceConnection (android.content.ServiceConnection)127 Parcel (android.os.Parcel)112 PendingIntent (android.app.PendingIntent)69 Point (android.graphics.Point)67 Bundle (android.os.Bundle)56 IOException (java.io.IOException)53 UserHandle (android.os.UserHandle)50 Binder (android.os.Binder)47 Message (android.os.Message)37 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)35 Handler (android.os.Handler)33 AndroidRuntimeException (android.util.AndroidRuntimeException)33 ArrayList (java.util.ArrayList)30 IUsbManager (android.hardware.usb.IUsbManager)29 Context (android.content.Context)28 Messenger (android.os.Messenger)26