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