diff options
| author | Fyodor Kupolov <fkupolov@google.com> | 2015-07-14 22:43:44 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-14 22:43:47 +0000 |
| commit | 4a817924ecb282eef48b06b92f8e1914edd6cec2 (patch) | |
| tree | cda783ed060c8f8dbdc7039539ff505b93f90fda /core/java/android | |
| parent | f1c2a1f798fc029200291ca9d5bbedb1f483d428 (diff) | |
| parent | e37520b49da8fc2b7b7501c6dbbe1e6ac984dd9f (diff) | |
Merge "Revert "Allow array of required permissions in sendBroadcast"" into mnc-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 8 | ||||
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 49 | ||||
| -rw-r--r-- | core/java/android/app/IActivityManager.java | 2 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 26 | ||||
| -rw-r--r-- | core/java/android/content/ContextWrapper.java | 6 |
5 files changed, 15 insertions, 76 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index fc408a8158b6..cc93ac906d06 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -456,14 +456,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM int resultCode = data.readInt(); String resultData = data.readString(); Bundle resultExtras = data.readBundle(); - String[] perms = data.readStringArray(); + String perm = data.readString(); int appOp = data.readInt(); Bundle options = data.readBundle(); boolean serialized = data.readInt() != 0; boolean sticky = data.readInt() != 0; int userId = data.readInt(); int res = broadcastIntent(app, intent, resolvedType, resultTo, - resultCode, resultData, resultExtras, perms, appOp, + resultCode, resultData, resultExtras, perm, appOp, options, serialized, sticky, userId); reply.writeNoException(); reply.writeInt(res); @@ -3007,7 +3007,7 @@ class ActivityManagerProxy implements IActivityManager public int broadcastIntent(IApplicationThread caller, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, String resultData, Bundle map, - String[] requiredPermissions, int appOp, Bundle options, boolean serialized, + String requiredPermission, int appOp, Bundle options, boolean serialized, boolean sticky, int userId) throws RemoteException { Parcel data = Parcel.obtain(); @@ -3020,7 +3020,7 @@ class ActivityManagerProxy implements IActivityManager data.writeInt(resultCode); data.writeString(resultData); data.writeBundle(map); - data.writeStringArray(requiredPermissions); + data.writeString(requiredPermission); data.writeInt(appOp); data.writeBundle(options); data.writeInt(serialized ? 1 : 0); diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 71cada34ae82..75dd35c5243f 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -180,7 +180,7 @@ class ContextImpl extends Context { @GuardedBy("mSync") private File[] mExternalMediaDirs; - private static final String[] EMPTY_STRING_ARRAY = {}; + private static final String[] EMPTY_FILE_LIST = {}; // The system service cache for the system services that are cached per-ContextImpl. final Object[] mServiceCache = SystemServiceRegistry.createServiceCache(); @@ -552,7 +552,7 @@ class ContextImpl extends Context { @Override public String[] fileList() { final String[] list = getFilesDir().list(); - return (list != null) ? list : EMPTY_STRING_ARRAY; + return (list != null) ? list : EMPTY_FILE_LIST; } @Override @@ -591,7 +591,7 @@ class ContextImpl extends Context { @Override public String[] databaseList() { final String[] list = getDatabasesDir().list(); - return (list != null) ? list : EMPTY_STRING_ARRAY; + return (list != null) ? list : EMPTY_FILE_LIST; } @@ -777,28 +777,11 @@ class ContextImpl extends Context { public void sendBroadcast(Intent intent, String receiverPermission) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, - null, false, false, getUserId()); - } catch (RemoteException e) { - throw new RuntimeException("Failure from system", e); - } - } - - @Override - public void sendBroadcast(Intent intent, String[] receiverPermissions) { - warnIfCallingFromSystemProcess(); - String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - try { - intent.prepareToLeaveProcess(); - ActivityManagerNative.getDefault().broadcastIntent( - mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, + Activity.RESULT_OK, null, null, receiverPermission, AppOpsManager.OP_NONE, null, false, false, getUserId()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); @@ -809,13 +792,11 @@ class ContextImpl extends Context { public void sendBroadcast(Intent intent, String receiverPermission, Bundle options) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, + Activity.RESULT_OK, null, null, receiverPermission, AppOpsManager.OP_NONE, options, false, false, getUserId()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); @@ -826,13 +807,11 @@ class ContextImpl extends Context { public void sendBroadcast(Intent intent, String receiverPermission, int appOp) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false, + Activity.RESULT_OK, null, null, receiverPermission, appOp, null, false, false, getUserId()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); @@ -843,13 +822,11 @@ class ContextImpl extends Context { public void sendOrderedBroadcast(Intent intent, String receiverPermission) { warnIfCallingFromSystemProcess(); String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermissions, AppOpsManager.OP_NONE, + Activity.RESULT_OK, null, null, receiverPermission, AppOpsManager.OP_NONE, null, true, false, getUserId()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); @@ -906,13 +883,11 @@ class ContextImpl extends Context { } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, - initialCode, initialData, initialExtras, receiverPermissions, appOp, + initialCode, initialData, initialExtras, receiverPermission, appOp, options, true, false, getUserId()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); @@ -942,13 +917,11 @@ class ContextImpl extends Context { public void sendBroadcastAsUser(Intent intent, UserHandle user, String receiverPermission, int appOp) { String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, null, - Activity.RESULT_OK, null, null, receiverPermissions, appOp, null, false, false, + Activity.RESULT_OK, null, null, receiverPermission, appOp, null, false, false, user.getIdentifier()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); @@ -986,13 +959,11 @@ class ContextImpl extends Context { } } String resolvedType = intent.resolveTypeIfNeeded(getContentResolver()); - String[] receiverPermissions = receiverPermission == null ? null - : new String[] {receiverPermission}; try { intent.prepareToLeaveProcess(); ActivityManagerNative.getDefault().broadcastIntent( mMainThread.getApplicationThread(), intent, resolvedType, rd, - initialCode, initialData, initialExtras, receiverPermissions, + initialCode, initialData, initialExtras, receiverPermission, appOp, null, true, false, user.getIdentifier()); } catch (RemoteException e) { throw new RuntimeException("Failure from system", e); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 1d87d77957fc..acce81c9fe5d 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -106,7 +106,7 @@ public interface IActivityManager extends IInterface { public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException; public int broadcastIntent(IApplicationThread caller, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, - String resultData, Bundle map, String[] requiredPermissions, + String resultData, Bundle map, String requiredPermission, int appOp, Bundle options, boolean serialized, boolean sticky, int userId) throws RemoteException; public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId) throws RemoteException; public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index f841a7a10ec4..675515b5d12c 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -1516,32 +1516,6 @@ public abstract class Context { public abstract void sendBroadcast(Intent intent, @Nullable String receiverPermission); - - /** - * Broadcast the given intent to all interested BroadcastReceivers, allowing - * an array of required permissions to be enforced. This call is asynchronous; it returns - * immediately, and you will continue executing while the receivers are run. No results are - * propagated from receivers and receivers can not abort the broadcast. If you want to allow - * receivers to propagate results or abort the broadcast, you must send an ordered broadcast - * using {@link #sendOrderedBroadcast(Intent, String)}. - * - * <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 receiverPermissions Array of names of permissions that a receiver must hold - * in order to receive your broadcast. - * If null or empty, no permissions are required. - * - * @see android.content.BroadcastReceiver - * @see #registerReceiver - * @see #sendBroadcast(Intent) - * @see #sendOrderedBroadcast(Intent, String) - * @see #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle) - * @hide - */ - public abstract void sendBroadcast(Intent intent, String[] receiverPermissions); - /** * Broadcast the given intent to all interested BroadcastReceivers, allowing * an optional required permission to be enforced. This diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index 52323c39a9f3..4e7c832cff44 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -402,12 +402,6 @@ public class ContextWrapper extends Context { } /** @hide */ - @Override - public void sendBroadcast(Intent intent, String[] receiverPermissions) { - mBase.sendBroadcast(intent, receiverPermissions); - } - - /** @hide */ @SystemApi @Override public void sendBroadcast(Intent intent, String receiverPermission, Bundle options) { |
