diff options
| -rw-r--r-- | core/java/android/content/IntentFilter.java | 9 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 8 | ||||
| -rw-r--r-- | core/res/res/values/cm_strings.xml | 8 | ||||
| -rw-r--r-- | services/java/com/android/server/IntentResolver.java | 2 | ||||
| -rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 2 | ||||
| -rw-r--r-- | services/java/com/android/server/am/BroadcastFilter.java | 16 |
6 files changed, 42 insertions, 3 deletions
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java index 3b0d846..642a37d 100644 --- a/core/java/android/content/IntentFilter.java +++ b/core/java/android/content/IntentFilter.java @@ -1385,6 +1385,15 @@ public class IntentFilter implements Parcelable { } /** + * {@hide} + * @param other + * @return + */ + public int onCompareTie(IntentFilter other) { + return 0; + } + + /** * For debugging -- perform a check on the filter, return true if it passed * or false if it failed. * diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 74dccdd..ce9b3a8 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1942,6 +1942,14 @@ android:description="@string/permdesc_broadcastPackageRemoved" android:protectionLevel="signature" /> + <!-- Allows an application to intercept and rewrite outgoing SMS + @hide --> + <permission android:name="android.permission.INTERCEPT_SMS" + android:permissionGroup="android.permission-group.MESSAGES" + android:label="@string/permlab_interceptSmsSent" + android:description="@string/permdesc_interceptSmsSent" + android:protectionLevel="signature" /> + <!-- Allows an application to broadcast an SMS receipt notification --> <permission android:name="android.permission.BROADCAST_SMS" android:permissionGroup="android.permission-group.MESSAGES" diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml index c8a37903..5dd2a24 100644 --- a/core/res/res/values/cm_strings.xml +++ b/core/res/res/values/cm_strings.xml @@ -169,4 +169,12 @@ <!-- The item label for the no profile selection item. --> <string name="profile_none">None</string> + + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permlab_interceptSmsSent">intercept outgoing SMS</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> + <string name="permdesc_interceptSmsSent">Allows the app to + intercept an outgoing SMS. + Malicious apps may use this to prevent outgoing SMS messages.</string> + </resources> diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java index 9b19008..8f703f0 100644 --- a/services/java/com/android/server/IntentResolver.java +++ b/services/java/com/android/server/IntentResolver.java @@ -609,7 +609,7 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> { public int compare(Object o1, Object o2) { final int q1 = ((IntentFilter) o1).getPriority(); final int q2 = ((IntentFilter) o2).getPriority(); - return (q1 > q2) ? -1 : ((q1 < q2) ? 1 : 0); + return (q1 > q2) ? -1 : ((q1 < q2) ? 1 : ((IntentFilter) o1).onCompareTie((IntentFilter) o2)); } }; diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 618f02c..d7f9eb4 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -11522,7 +11522,7 @@ public final class ActivityManagerService extends ActivityManagerNative + " was previously registered for user " + rl.userId); } BroadcastFilter bf = new BroadcastFilter(filter, rl, callerPackage, - permission, callingUid, userId); + permission, callingUid, userId, (callerApp.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0); rl.add(bf); if (!bf.debugCheck()) { Slog.w(TAG, "==> For Dynamic broadast"); diff --git a/services/java/com/android/server/am/BroadcastFilter.java b/services/java/com/android/server/am/BroadcastFilter.java index c631b6e..1d983c7 100644 --- a/services/java/com/android/server/am/BroadcastFilter.java +++ b/services/java/com/android/server/am/BroadcastFilter.java @@ -29,15 +29,17 @@ class BroadcastFilter extends IntentFilter { final String requiredPermission; final int owningUid; final int owningUserId; + final boolean isSystem; BroadcastFilter(IntentFilter _filter, ReceiverList _receiverList, - String _packageName, String _requiredPermission, int _owningUid, int _userId) { + String _packageName, String _requiredPermission, int _owningUid, int _userId, boolean _isSystem) { super(_filter); receiverList = _receiverList; packageName = _packageName; requiredPermission = _requiredPermission; owningUid = _owningUid; owningUserId = _userId; + isSystem = _isSystem; } public void dump(PrintWriter pw, String prefix) { @@ -71,4 +73,16 @@ class BroadcastFilter extends IntentFilter { sb.append('}'); return sb.toString(); } + + @Override + public int onCompareTie(IntentFilter other) { + // in case of a tie when sorting ordered broadcasts, + // favor system apps. + BroadcastFilter bf = (BroadcastFilter)other; + if (isSystem) + return -1; + if (bf.isSystem) + return 1; + return 0; + } } |
