Search in sources :

Example 31 with RemoteException

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

Example 32 with RemoteException

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) {
    }
}
Also used : Intent(android.content.Intent) RemoteException(android.os.RemoteException)

Example 33 with RemoteException

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) {
    }
}
Also used : IIntentReceiver(android.content.IIntentReceiver) RemoteException(android.os.RemoteException)

Example 34 with RemoteException

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) {
    }
}
Also used : IIntentReceiver(android.content.IIntentReceiver) RemoteException(android.os.RemoteException)

Example 35 with RemoteException

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

Aggregations

RemoteException (android.os.RemoteException)4527 Intent (android.content.Intent)595 IBinder (android.os.IBinder)480 Bundle (android.os.Bundle)461 Point (android.graphics.Point)423 IOException (java.io.IOException)381 PendingIntent (android.app.PendingIntent)274 ComponentName (android.content.ComponentName)265 ArrayList (java.util.ArrayList)248 ApplicationInfo (android.content.pm.ApplicationInfo)190 IPackageManager (android.content.pm.IPackageManager)190 Message (android.os.Message)184 Uri (android.net.Uri)157 UserHandle (android.os.UserHandle)154 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)151 Cursor (android.database.Cursor)150 Configuration (android.content.res.Configuration)133 UserInfo (android.content.pm.UserInfo)129 AndroidRuntimeException (android.util.AndroidRuntimeException)128 ParcelFileDescriptor (android.os.ParcelFileDescriptor)126