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;
}
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();
}
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;
}
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;
}
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;
}
Aggregations