use of android.os.RemoteException in project android_frameworks_base by ParanoidAndroid.
the class ContextImpl method startServiceAsUser.
@Override
public ComponentName startServiceAsUser(Intent service, UserHandle user) {
try {
service.prepareToLeaveProcess();
ComponentName cn = ActivityManagerNative.getDefault().startService(mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(getContentResolver()), user.getIdentifier());
if (cn != null) {
if (cn.getPackageName().equals("!")) {
throw new SecurityException("Not allowed to start service " + service + " without permission " + cn.getClassName());
} else if (cn.getPackageName().equals("!!")) {
throw new SecurityException("Unable to start service " + service + ": " + cn.getClassName());
}
}
return cn;
} catch (RemoteException e) {
return null;
}
}
use of android.os.RemoteException in project android_frameworks_base by ParanoidAndroid.
the class ContextImpl method removeStickyBroadcast.
@Override
public void removeStickyBroadcast(Intent intent) {
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
if (resolvedType != null) {
intent = new Intent(intent);
intent.setDataAndType(intent.getData(), resolvedType);
}
try {
intent.prepareToLeaveProcess();
ActivityManagerNative.getDefault().unbroadcastIntent(mMainThread.getApplicationThread(), intent, getUserId());
} catch (RemoteException e) {
}
}
use of android.os.RemoteException in project android_frameworks_base by ParanoidAndroid.
the class ContextImpl method sendStickyOrderedBroadcastAsUser.
@Override
public void sendStickyOrderedBroadcastAsUser(Intent intent, UserHandle user, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) {
IIntentReceiver rd = null;
if (resultReceiver != null) {
if (mPackageInfo != null) {
if (scheduler == null) {
scheduler = mMainThread.getHandler();
}
rd = mPackageInfo.getReceiverDispatcher(resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false);
} else {
if (scheduler == null) {
scheduler = mMainThread.getHandler();
}
rd = new LoadedApk.ReceiverDispatcher(resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver();
}
}
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess();
ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, true, true, user.getIdentifier());
} catch (RemoteException e) {
}
}
use of android.os.RemoteException in project android_frameworks_base by ParanoidAndroid.
the class ContextImpl method sendStickyOrderedBroadcast.
@Override
public void sendStickyOrderedBroadcast(Intent intent, BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData, Bundle initialExtras) {
warnIfCallingFromSystemProcess();
IIntentReceiver rd = null;
if (resultReceiver != null) {
if (mPackageInfo != null) {
if (scheduler == null) {
scheduler = mMainThread.getHandler();
}
rd = mPackageInfo.getReceiverDispatcher(resultReceiver, getOuterContext(), scheduler, mMainThread.getInstrumentation(), false);
} else {
if (scheduler == null) {
scheduler = mMainThread.getHandler();
}
rd = new LoadedApk.ReceiverDispatcher(resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver();
}
}
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.prepareToLeaveProcess();
ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(), intent, resolvedType, rd, initialCode, initialData, initialExtras, null, AppOpsManager.OP_NONE, true, true, getUserId());
} catch (RemoteException e) {
}
}
use of android.os.RemoteException in project android_frameworks_base by ParanoidAndroid.
the class ActivityOptions method setListener.
private void setListener(Handler handler, OnAnimationStartedListener listener) {
if (listener != null) {
final Handler h = handler;
final OnAnimationStartedListener finalListener = listener;
mAnimationStartedListener = new IRemoteCallback.Stub() {
@Override
public void sendResult(Bundle data) throws RemoteException {
h.post(new Runnable() {
@Override
public void run() {
finalListener.onAnimationStarted();
}
});
}
};
}
}
Aggregations