use of android.os.IBinder in project AsmackService by rtreffer.
the class SyncAdapter method bindService.
/**
* Bind to the xmpp transport service.
*/
private final synchronized void bindService() {
if (serviceConnection == null) {
XmppTransportService.start(applicationContext);
serviceConnection = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {
}
public void onServiceConnected(ComponentName name, IBinder binder) {
service = IXmppTransportService.Stub.asInterface(binder);
}
};
}
applicationContext.bindService(new Intent(IXmppTransportService.class.getName()), serviceConnection, Context.BIND_AUTO_CREATE);
}
use of android.os.IBinder in project platform_packages_apps_launcher by android.
the class Launcher method setWallpaperDimension.
private void setWallpaperDimension() {
IBinder binder = ServiceManager.getService(WALLPAPER_SERVICE);
IWallpaperService wallpaperService = IWallpaperService.Stub.asInterface(binder);
Display display = getWindowManager().getDefaultDisplay();
boolean isPortrait = display.getWidth() < display.getHeight();
final int width = isPortrait ? display.getWidth() : display.getHeight();
final int height = isPortrait ? display.getHeight() : display.getWidth();
try {
wallpaperService.setDimensionHints(width * WALLPAPER_SCREENS_SPAN, height);
} catch (RemoteException e) {
// System is dead!
}
}
use of android.os.IBinder in project platform_frameworks_base by android.
the class InputManagerService method registerInputDevicesChangedListener.
// Binder call
@Override
public void registerInputDevicesChangedListener(IInputDevicesChangedListener listener) {
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
}
synchronized (mInputDevicesLock) {
int callingPid = Binder.getCallingPid();
if (mInputDevicesChangedListeners.get(callingPid) != null) {
throw new SecurityException("The calling process has already " + "registered an InputDevicesChangedListener.");
}
InputDevicesChangedListenerRecord record = new InputDevicesChangedListenerRecord(callingPid, listener);
try {
IBinder binder = listener.asBinder();
binder.linkToDeath(record, 0);
} catch (RemoteException ex) {
// give up
throw new RuntimeException(ex);
}
mInputDevicesChangedListeners.put(callingPid, record);
}
}
use of android.os.IBinder in project platform_frameworks_base by android.
the class PackageManagerService method isPackageSignedByKeySet.
@Override
public boolean isPackageSignedByKeySet(String packageName, KeySet ks) {
if (packageName == null || ks == null) {
return false;
}
synchronized (mPackages) {
final PackageParser.Package pkg = mPackages.get(packageName);
if (pkg == null) {
Slog.w(TAG, "KeySet requested for unknown package: " + packageName);
throw new IllegalArgumentException("Unknown package: " + packageName);
}
IBinder ksh = ks.getToken();
if (ksh instanceof KeySetHandle) {
KeySetManagerService ksms = mSettings.mKeySetManagerService;
return ksms.packageIsSignedByLPr(packageName, (KeySetHandle) ksh);
}
return false;
}
}
use of android.os.IBinder in project platform_frameworks_base by android.
the class LockPatternUtils method setVisiblePatternEnabled.
/**
* Set whether the visible pattern is enabled.
*/
public void setVisiblePatternEnabled(boolean enabled, int userId) {
setBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, enabled, userId);
// Update for crypto if owner
if (userId != UserHandle.USER_SYSTEM) {
return;
}
IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the user info");
return;
}
IMountService mountService = IMountService.Stub.asInterface(service);
try {
mountService.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing pattern visible state", e);
}
}
Aggregations