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

Commit e49288d5 authored by Koushik Dutta's avatar Koushik Dutta
Browse files

Add SMS Middleware layer.

Add fix so ordered broadcasts are delivered to system
apps first in the event of a tie. This works around
the issue where terrible apps steal SMS notifications
from the broadcast queue to simply prevent notifications
that could otherwise be removed by a toggle.

Change-Id: I4fff0c584f8fce9c5f2f4fe86a82fe6480c307c7
parent 9929e6bc
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1384,6 +1384,15 @@ public class IntentFilter implements Parcelable {
        dest.writeInt(mHasPartialTypes ? 1 : 0);
    }

    /**
     * {@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.
+8 −0
Original line number Diff line number Diff line
@@ -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"
+8 −0
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -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));
        }
    };

+1 −1
Original line number Diff line number Diff line
@@ -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");
Loading