Search in sources :

Example 46 with IBinder

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);
}
Also used : ServiceConnection(android.content.ServiceConnection) IBinder(android.os.IBinder) ComponentName(android.content.ComponentName) Intent(android.content.Intent)

Example 47 with IBinder

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!
    }
}
Also used : IBinder(android.os.IBinder) RemoteException(android.os.RemoteException) IWallpaperService(android.app.IWallpaperService) Display(android.view.Display)

Example 48 with IBinder

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);
    }
}
Also used : IBinder(android.os.IBinder) RemoteException(android.os.RemoteException)

Example 49 with IBinder

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;
    }
}
Also used : IBinder(android.os.IBinder) PackageParser(android.content.pm.PackageParser)

Example 50 with IBinder

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);
    }
}
Also used : IBinder(android.os.IBinder) IMountService(android.os.storage.IMountService) RemoteException(android.os.RemoteException)

Aggregations

IBinder (android.os.IBinder)991 RemoteException (android.os.RemoteException)494 Intent (android.content.Intent)141 ComponentName (android.content.ComponentName)128 ServiceConnection (android.content.ServiceConnection)94 Parcel (android.os.Parcel)91 Point (android.graphics.Point)67 PendingIntent (android.app.PendingIntent)60 IOException (java.io.IOException)53 UserHandle (android.os.UserHandle)50 Bundle (android.os.Bundle)40 Binder (android.os.Binder)37 Message (android.os.Message)37 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)34 AndroidRuntimeException (android.util.AndroidRuntimeException)33 Handler (android.os.Handler)31 ArrayList (java.util.ArrayList)27 IContentProvider (android.content.IContentProvider)25 TransactionTooLargeException (android.os.TransactionTooLargeException)25 OperationResult (android.security.keymaster.OperationResult)25