FileDocCategorySizeDatePackage
ServiceManagerNative.javaAPI DocAndroid 5.1 API6637Thu Mar 12 22:22:10 GMT 2015android.os

ServiceManagerNative

public abstract class ServiceManagerNative extends Binder implements IServiceManager
Native implementation of the service manager. Most clients will only care about getDefault() and possibly asInterface().
hide

Fields Summary
Constructors Summary
public ServiceManagerNative()

        attachInterface(this, descriptor);
    
Methods Summary
public IBinderasBinder()

        return this;
    
public static IServiceManagerasInterface(IBinder obj)
Cast a Binder object into a service manager interface, generating a proxy if needed.

        if (obj == null) {
            return null;
        }
        IServiceManager in =
            (IServiceManager)obj.queryLocalInterface(descriptor);
        if (in != null) {
            return in;
        }
        
        return new ServiceManagerProxy(obj);
    
public booleanonTransact(int code, Parcel data, Parcel reply, int flags)

        try {
            switch (code) {
            case IServiceManager.GET_SERVICE_TRANSACTION: {
                data.enforceInterface(IServiceManager.descriptor);
                String name = data.readString();
                IBinder service = getService(name);
                reply.writeStrongBinder(service);
                return true;
            }
    
            case IServiceManager.CHECK_SERVICE_TRANSACTION: {
                data.enforceInterface(IServiceManager.descriptor);
                String name = data.readString();
                IBinder service = checkService(name);
                reply.writeStrongBinder(service);
                return true;
            }
    
            case IServiceManager.ADD_SERVICE_TRANSACTION: {
                data.enforceInterface(IServiceManager.descriptor);
                String name = data.readString();
                IBinder service = data.readStrongBinder();
                boolean allowIsolated = data.readInt() != 0;
                addService(name, service, allowIsolated);
                return true;
            }
    
            case IServiceManager.LIST_SERVICES_TRANSACTION: {
                data.enforceInterface(IServiceManager.descriptor);
                String[] list = listServices();
                reply.writeStringArray(list);
                return true;
            }
            
            case IServiceManager.SET_PERMISSION_CONTROLLER_TRANSACTION: {
                data.enforceInterface(IServiceManager.descriptor);
                IPermissionController controller
                        = IPermissionController.Stub.asInterface(
                                data.readStrongBinder());
                setPermissionController(controller);
                return true;
            }
            }
        } catch (RemoteException e) {
        }
        
        return false;