Search in sources :

Example 56 with IBinder

use of android.os.IBinder in project platform_frameworks_base by android.

the class AppWidgetServiceImpl method destroyRemoteViewsService.

// Destroys the cached factory on the RemoteViewsService's side related to the specified intent
private void destroyRemoteViewsService(final Intent intent, Widget widget) {
    final ServiceConnection conn = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            final IRemoteViewsFactory cb = IRemoteViewsFactory.Stub.asInterface(service);
            try {
                cb.onDestroy(intent);
            } catch (RemoteException re) {
                Slog.e(TAG, "Error calling remove view factory", re);
            }
            mContext.unbindService(this);
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
        // Do nothing
        }
    };
    // Bind to the service and remove the static intent->factory mapping in the
    // RemoteViewsService.
    final long token = Binder.clearCallingIdentity();
    try {
        mContext.bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, widget.provider.info.getProfile());
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
Also used : ServiceConnection(android.content.ServiceConnection) IBinder(android.os.IBinder) IRemoteViewsFactory(com.android.internal.widget.IRemoteViewsFactory) ComponentName(android.content.ComponentName) RemoteException(android.os.RemoteException)

Example 57 with IBinder

use of android.os.IBinder in project platform_frameworks_base by android.

the class AccessibilityManagerService method getWindowToken.

@Override
public IBinder getWindowToken(int windowId, int userId) {
    mSecurityPolicy.enforceCallingPermission(Manifest.permission.RETRIEVE_WINDOW_TOKEN, GET_WINDOW_TOKEN);
    synchronized (mLock) {
        // We treat calls from a profile as if made by its parent as profiles
        // share the accessibility state of the parent. The call below
        // performs the current profile parent resolution.
        final int resolvedUserId = mSecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(userId);
        if (resolvedUserId != mCurrentUserId) {
            return null;
        }
        if (mSecurityPolicy.findWindowById(windowId) == null) {
            return null;
        }
        IBinder token = mGlobalWindowTokens.get(windowId);
        if (token != null) {
            return token;
        }
        return getCurrentUserStateLocked().mWindowTokens.get(windowId);
    }
}
Also used : IBinder(android.os.IBinder) Point(android.graphics.Point)

Example 58 with IBinder

use of android.os.IBinder in project platform_frameworks_base by android.

the class ActiveServices method peekServiceLocked.

IBinder peekServiceLocked(Intent service, String resolvedType, String callingPackage) {
    ServiceLookupResult r = retrieveServiceLocked(service, resolvedType, callingPackage, Binder.getCallingPid(), Binder.getCallingUid(), UserHandle.getCallingUserId(), false, false, false);
    IBinder ret = null;
    if (r != null) {
        // r.record is null if findServiceLocked() failed the caller permission check
        if (r.record == null) {
            throw new SecurityException("Permission Denial: Accessing service" + " from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " requires " + r.permission);
        }
        IntentBindRecord ib = r.record.bindings.get(r.record.intent);
        if (ib != null) {
            ret = ib.binder;
        }
    }
    return ret;
}
Also used : IBinder(android.os.IBinder)

Example 59 with IBinder

use of android.os.IBinder in project platform_frameworks_base by android.

the class AndroidKeyStoreSignatureSpiBase method resetWhilePreservingInitState.

/**
     * Resets this cipher while preserving the initialized state. This must be equivalent to
     * rolling back the cipher's state to just after the most recent {@code engineInit} completed
     * successfully.
     *
     * <p>Subclasses storing additional post-init state should override this method, reset the
     * additional state, and then chain to superclass.
     */
@CallSuper
protected void resetWhilePreservingInitState() {
    IBinder operationToken = mOperationToken;
    if (operationToken != null) {
        mOperationToken = null;
        mKeyStore.abort(operationToken);
    }
    mOperationHandle = 0;
    mMessageStreamer = null;
    mCachedException = null;
}
Also used : IBinder(android.os.IBinder) CallSuper(android.annotation.CallSuper)

Example 60 with IBinder

use of android.os.IBinder in project platform_frameworks_base by android.

the class AndroidKeyStoreSignatureSpiBase method resetAll.

/**
     * Resets this cipher to its pristine pre-init state. This must be equivalent to obtaining a new
     * cipher instance.
     *
     * <p>Subclasses storing additional state should override this method, reset the additional
     * state, and then chain to superclass.
     */
@CallSuper
protected void resetAll() {
    IBinder operationToken = mOperationToken;
    if (operationToken != null) {
        mOperationToken = null;
        mKeyStore.abort(operationToken);
    }
    mSigning = false;
    mKey = null;
    appRandom = null;
    mOperationToken = null;
    mOperationHandle = 0;
    mMessageStreamer = null;
    mCachedException = null;
}
Also used : IBinder(android.os.IBinder) CallSuper(android.annotation.CallSuper)

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