Search in sources :

Example 6 with IBinder

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

the class ConnectivityService method makeWimaxStateTracker.

/**
     * Loads external WiMAX library and registers as system service, returning a
     * {@link NetworkStateTracker} for WiMAX. Caller is still responsible for
     * invoking {@link NetworkStateTracker#startMonitoring(Context, Handler)}.
     */
private static NetworkStateTracker makeWimaxStateTracker(Context context, Handler trackerHandler) {
    // Initialize Wimax
    DexClassLoader wimaxClassLoader;
    Class wimaxStateTrackerClass = null;
    Class wimaxServiceClass = null;
    Class wimaxManagerClass;
    String wimaxJarLocation;
    String wimaxLibLocation;
    String wimaxManagerClassName;
    String wimaxServiceClassName;
    String wimaxStateTrackerClassName;
    NetworkStateTracker wimaxStateTracker = null;
    boolean isWimaxEnabled = context.getResources().getBoolean(com.android.internal.R.bool.config_wimaxEnabled);
    if (isWimaxEnabled) {
        try {
            wimaxJarLocation = context.getResources().getString(com.android.internal.R.string.config_wimaxServiceJarLocation);
            wimaxLibLocation = context.getResources().getString(com.android.internal.R.string.config_wimaxNativeLibLocation);
            wimaxManagerClassName = context.getResources().getString(com.android.internal.R.string.config_wimaxManagerClassname);
            wimaxServiceClassName = context.getResources().getString(com.android.internal.R.string.config_wimaxServiceClassname);
            wimaxStateTrackerClassName = context.getResources().getString(com.android.internal.R.string.config_wimaxStateTrackerClassname);
            if (DBG)
                log("wimaxJarLocation: " + wimaxJarLocation);
            wimaxClassLoader = new DexClassLoader(wimaxJarLocation, new ContextWrapper(context).getCacheDir().getAbsolutePath(), wimaxLibLocation, ClassLoader.getSystemClassLoader());
            try {
                wimaxManagerClass = wimaxClassLoader.loadClass(wimaxManagerClassName);
                wimaxStateTrackerClass = wimaxClassLoader.loadClass(wimaxStateTrackerClassName);
                wimaxServiceClass = wimaxClassLoader.loadClass(wimaxServiceClassName);
            } catch (ClassNotFoundException ex) {
                loge("Exception finding Wimax classes: " + ex.toString());
                return null;
            }
        } catch (Resources.NotFoundException ex) {
            loge("Wimax Resources does not exist!!! ");
            return null;
        }
        try {
            if (DBG)
                log("Starting Wimax Service... ");
            Constructor wmxStTrkrConst = wimaxStateTrackerClass.getConstructor(new Class[] { Context.class, Handler.class });
            wimaxStateTracker = (NetworkStateTracker) wmxStTrkrConst.newInstance(context, trackerHandler);
            Constructor wmxSrvConst = wimaxServiceClass.getDeclaredConstructor(new Class[] { Context.class, wimaxStateTrackerClass });
            wmxSrvConst.setAccessible(true);
            IBinder svcInvoker = (IBinder) wmxSrvConst.newInstance(context, wimaxStateTracker);
            wmxSrvConst.setAccessible(false);
            ServiceManager.addService(WimaxManagerConstants.WIMAX_SERVICE, svcInvoker);
        } catch (Exception ex) {
            loge("Exception creating Wimax classes: " + ex.toString());
            return null;
        }
    } else {
        loge("Wimax is not enabled or not added to the network attributes!!! ");
        return null;
    }
    return wimaxStateTracker;
}
Also used : IBinder(android.os.IBinder) Constructor(java.lang.reflect.Constructor) DexClassLoader(dalvik.system.DexClassLoader) Resources(android.content.res.Resources) NetworkStateTracker(android.net.NetworkStateTracker) ContextWrapper(android.content.ContextWrapper) RemoteException(android.os.RemoteException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) FileNotFoundException(java.io.FileNotFoundException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) ActivityNotFoundException(android.content.ActivityNotFoundException)

Example 7 with IBinder

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

the class CommonTimeManagementService method systemReady.

void systemReady() {
    if (ServiceManager.checkService(CommonTimeConfig.SERVICE_NAME) == null) {
        Log.i(TAG, "No common time service detected on this platform.  " + "Common time services will be unavailable.");
        return;
    }
    mDetectedAtStartup = true;
    IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
    mNetMgr = INetworkManagementService.Stub.asInterface(b);
    // while trying to register this observer.
    try {
        mNetMgr.registerObserver(mIfaceObserver);
    } catch (RemoteException e) {
    }
    // Register with the connectivity manager for connectivity changed intents.
    IntentFilter filter = new IntentFilter();
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    mContext.registerReceiver(mConnectivityMangerObserver, filter);
    // Connect to the common time config service and apply the initial configuration.
    connectToTimeConfig();
}
Also used : IntentFilter(android.content.IntentFilter) IBinder(android.os.IBinder) RemoteException(android.os.RemoteException)

Example 8 with IBinder

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

the class DevicePolicyManagerService method getIPowerManager.

private IPowerManager getIPowerManager() {
    if (mIPowerManager == null) {
        IBinder b = ServiceManager.getService(Context.POWER_SERVICE);
        mIPowerManager = IPowerManager.Stub.asInterface(b);
    }
    return mIPowerManager;
}
Also used : IBinder(android.os.IBinder)

Example 9 with IBinder

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

the class DevicePolicyManagerService method getWindowManager.

private IWindowManager getWindowManager() {
    if (mIWindowManager == null) {
        IBinder b = ServiceManager.getService(Context.WINDOW_SERVICE);
        mIWindowManager = IWindowManager.Stub.asInterface(b);
    }
    return mIWindowManager;
}
Also used : IBinder(android.os.IBinder)

Example 10 with IBinder

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

the class LocationManagerService method getReceiverLocked.

private Receiver getReceiverLocked(ILocationListener listener, int pid, int uid, String packageName) {
    IBinder binder = listener.asBinder();
    Receiver receiver = mReceivers.get(binder);
    if (receiver == null) {
        receiver = new Receiver(listener, null, pid, uid, packageName);
        mReceivers.put(binder, receiver);
        try {
            receiver.getListener().asBinder().linkToDeath(receiver, 0);
        } catch (RemoteException e) {
            Slog.e(TAG, "linkToDeath failed:", e);
            return null;
        }
    }
    return receiver;
}
Also used : IBinder(android.os.IBinder) BroadcastReceiver(android.content.BroadcastReceiver) RemoteException(android.os.RemoteException)

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