Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 852f06b3 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 53791582: Merge "More mult-user API work." into jb-mr1-dev

* commit '53791582':
  More mult-user API work.
parents 62293d8d 53791582
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -5075,6 +5075,7 @@ package android.content {
  public class ContentProviderClient {
    method public android.content.ContentProviderResult[] applyBatch(java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException, android.os.RemoteException;
    method public int bulkInsert(android.net.Uri, android.content.ContentValues[]) throws android.os.RemoteException;
    method public android.os.Bundle call(java.lang.String, java.lang.String, android.os.Bundle) throws android.os.RemoteException;
    method public int delete(android.net.Uri, java.lang.String, java.lang.String[]) throws android.os.RemoteException;
    method public android.content.ContentProvider getLocalContentProvider();
    method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String) throws android.os.RemoteException;
@@ -5319,9 +5320,10 @@ package android.content {
    method public abstract void revokeUriPermission(android.net.Uri, int);
    method public abstract void sendBroadcast(android.content.Intent);
    method public abstract void sendBroadcast(android.content.Intent, java.lang.String);
    method public void sendBroadcastToUser(android.content.Intent, int);
    method public abstract void sendBroadcastToUser(android.content.Intent, int);
    method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String);
    method public abstract void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public abstract void sendOrderedBroadcastToUser(android.content.Intent, int, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public abstract void sendStickyBroadcast(android.content.Intent);
    method public abstract void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public abstract void setTheme(int);
@@ -5453,8 +5455,10 @@ package android.content {
    method public void revokeUriPermission(android.net.Uri, int);
    method public void sendBroadcast(android.content.Intent);
    method public void sendBroadcast(android.content.Intent, java.lang.String);
    method public void sendBroadcastToUser(android.content.Intent, int);
    method public void sendOrderedBroadcast(android.content.Intent, java.lang.String);
    method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public void sendOrderedBroadcastToUser(android.content.Intent, int, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public void sendStickyBroadcast(android.content.Intent);
    method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public void setTheme(int);
@@ -6235,6 +6239,7 @@ package android.content.pm {
    field public static final int FLAG_HARDWARE_ACCELERATED = 512; // 0x200
    field public static final int FLAG_MULTIPROCESS = 1; // 0x1
    field public static final int FLAG_NO_HISTORY = 128; // 0x80
    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
    field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10
    field public static final int LAUNCH_MULTIPLE = 0; // 0x0
    field public static final int LAUNCH_SINGLE_INSTANCE = 3; // 0x3
@@ -6657,7 +6662,9 @@ package android.content.pm {
    ctor public ProviderInfo(android.content.pm.ProviderInfo);
    method public int describeContents();
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
    field public java.lang.String authority;
    field public int flags;
    field public boolean grantUriPermissions;
    field public int initOrder;
    field public deprecated boolean isSyncable;
@@ -6703,7 +6710,7 @@ package android.content.pm {
    method public void dump(android.util.Printer, java.lang.String);
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final int FLAG_ISOLATED_PROCESS = 2; // 0x2
    field public static final int FLAG_SINGLE_USER = 4; // 0x4
    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
    field public static final int FLAG_STOP_WITH_TASK = 1; // 0x1
    field public int flags;
    field public java.lang.String permission;
@@ -16248,6 +16255,7 @@ package android.os {
    method public static final int myPid();
    method public static final int myTid();
    method public static final int myUid();
    method public static final int myUserHandle();
    method public static final void sendSignal(int, int);
    method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
    method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
@@ -21143,8 +21151,10 @@ package android.test.mock {
    method public void revokeUriPermission(android.net.Uri, int);
    method public void sendBroadcast(android.content.Intent);
    method public void sendBroadcast(android.content.Intent, java.lang.String);
    method public void sendBroadcastToUser(android.content.Intent, int);
    method public void sendOrderedBroadcast(android.content.Intent, java.lang.String);
    method public void sendOrderedBroadcast(android.content.Intent, java.lang.String, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public void sendOrderedBroadcastToUser(android.content.Intent, int, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public void sendStickyBroadcast(android.content.Intent);
    method public void sendStickyOrderedBroadcast(android.content.Intent, android.content.BroadcastReceiver, android.os.Handler, int, java.lang.String, android.os.Bundle);
    method public void setTheme(int);
+12 −0
Original line number Diff line number Diff line
@@ -1840,6 +1840,18 @@ public class ActivityManager {
        return PackageManager.PERMISSION_DENIED;
    }

    /** @hide */
    public static int checkUidPermission(String permission, int uid) {
        try {
            return AppGlobals.getPackageManager()
                    .checkUidPermission(permission, uid);
        } catch (RemoteException e) {
            // Should never happen, but if it does... deny!
            Slog.e(TAG, "PackageManager is dead?!?", e);
        }
        return PackageManager.PERMISSION_DENIED;
    }

    /**
     * Returns the usage statistics of each installed package.
     *
+46 −14
Original line number Diff line number Diff line
@@ -966,18 +966,6 @@ class ContextImpl extends Context {
        }
    }

    @Override
    public void sendBroadcastToUser(Intent intent, int userId) {
        String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
        try {
            intent.setAllowFds(false);
            ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(),
                    intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false,
                    userId);
        } catch (RemoteException e) {
        }
    }

    @Override
    public void sendBroadcast(Intent intent, String receiverPermission) {
        String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
@@ -1038,6 +1026,50 @@ class ContextImpl extends Context {
        }
    }

    @Override
    public void sendBroadcastToUser(Intent intent, int userHandle) {
        String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
        try {
            intent.setAllowFds(false);
            ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread(),
                    intent, resolvedType, null, Activity.RESULT_OK, null, null, null, false, false,
                    userHandle);
        } catch (RemoteException e) {
        }
    }

    @Override
    public void sendOrderedBroadcastToUser(Intent intent, int userHandle,
            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.setAllowFds(false);
            ActivityManagerNative.getDefault().broadcastIntent(
                mMainThread.getApplicationThread(), intent, resolvedType, rd,
                initialCode, initialData, initialExtras, null,
                true, false, userHandle);
        } catch (RemoteException e) {
        }
    }

    @Override
    public void sendStickyBroadcast(Intent intent) {
        String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
@@ -1197,7 +1229,7 @@ class ContextImpl extends Context {

    /** @hide */
    @Override
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userId) {
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) {
        IServiceConnection sd;
        if (conn == null) {
            throw new IllegalArgumentException("connection is null");
@@ -1219,7 +1251,7 @@ class ContextImpl extends Context {
            int res = ActivityManagerNative.getDefault().bindService(
                mMainThread.getApplicationThread(), getActivityToken(),
                service, service.resolveTypeIfNeeded(getContentResolver()),
                sd, flags, userId);
                sd, flags, userHandle);
            if (res < 0) {
                throw new SecurityException(
                        "Not allowed to bind to service " + service);
+13 −0
Original line number Diff line number Diff line
@@ -231,6 +231,19 @@ public class ContentProviderClient {
        }
    }

    /** See {@link ContentProvider#call(String, String, Bundle)} */
    public Bundle call(String method, String arg, Bundle extras)
            throws RemoteException {
        try {
            return mContentProvider.call(method, arg, extras);
        } catch (DeadObjectException e) {
            if (!mStable) {
                mContentResolver.unstableProviderDied(mContentProvider);
            }
            throw e;
        }
    }

    /**
     * Call this to indicate to the system that the associated {@link ContentProvider} is no
     * longer needed by this {@link ContentProviderClient}.
+44 −14
Original line number Diff line number Diff line
@@ -987,18 +987,6 @@ public abstract class Context {
     */
    public abstract void sendBroadcast(Intent intent);

    /**
     * Same as #sendBroadcast(Intent intent), but for a specific user.  This broadcast
     * can only be sent to receivers that are part of the calling application.  It
     * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS}
     * permission.
     * @param intent the intent to broadcast
     * @param userId user to send the intent to
     */
    public void sendBroadcastToUser(Intent intent, int userId) {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

    /**
     * Broadcast the given intent to all interested BroadcastReceivers, allowing
     * an optional required permission to be enforced.  This
@@ -1096,6 +1084,48 @@ public abstract class Context {
            Handler scheduler, int initialCode, String initialData,
            Bundle initialExtras);

    /**
     * Same as {@link #sendBroadcast(Intent)}, but for a specific user.  This broadcast
     * can only be sent to receivers that are part of the calling application.  It
     * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS}
     * permission.
     * @param intent The intent to broadcast
     * @param userHandle User to send the intent to.
     * @see #sendBroadcast(Intent)
     */
    public abstract void sendBroadcastToUser(Intent intent, int userHandle);

    /**
     * Same as
     * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)},
     * but for a specific user.  This broadcast
     * can only be sent to receivers that are part of the calling application.  It
     * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS}
     * permission.
     *
     * <p>See {@link BroadcastReceiver} for more information on Intent broadcasts.
     *
     * @param intent The Intent to broadcast; all receivers matching this
     *               Intent will receive the broadcast.
     * @param userHandle User to send the intent to.
     * @param resultReceiver Your own BroadcastReceiver to treat as the final
     *                       receiver of the broadcast.
     * @param scheduler A custom Handler with which to schedule the
     *                  resultReceiver callback; if null it will be
     *                  scheduled in the Context's main thread.
     * @param initialCode An initial value for the result code.  Often
     *                    Activity.RESULT_OK.
     * @param initialData An initial value for the result data.  Often
     *                    null.
     * @param initialExtras An initial value for the result extras.  Often
     *                      null.
     *
     * @see #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)
     */
    public abstract void sendOrderedBroadcastToUser(Intent intent, int userHandle,
            BroadcastReceiver resultReceiver, Handler scheduler,
            int initialCode, String initialData, Bundle initialExtras);

    /**
     * Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the
     * Intent you are sending stays around after the broadcast is complete,
@@ -1403,11 +1433,11 @@ public abstract class Context {
            int flags);

    /**
     * Same as {@link #bindService(Intent, ServiceConnection, int)}, but with an explicit userId
     * Same as {@link #bindService(Intent, ServiceConnection, int)}, but with an explicit userHandle
     * argument for use by system server and other multi-user aware code.
     * @hide
     */
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userId) {
    public boolean bindService(Intent service, ServiceConnection conn, int flags, int userHandle) {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

Loading