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

Commit 6b090c68 authored by Koushik Dutta's avatar Koushik Dutta Committed by Adnan Begovic
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: I30e38c6c27d339d55a8f9a0f4106185356a9b9a0
parent cff66336
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1616,6 +1616,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.
+9 −2
Original line number Diff line number Diff line
@@ -2465,8 +2465,15 @@
        android:description="@string/permdesc_broadcastPackageRemoved"
        android:protectionLevel="signature" />

    <!-- Allows an application to broadcast an SMS receipt notification.
    <p>Not for use by third-party applications. -->
    <!-- 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"
        android:label="@string/permlab_broadcastSmsReceived"
+6 −0
Original line number Diff line number Diff line
@@ -252,4 +252,10 @@

    <string name="theme_reset_notification_title">Theme reset</string>
    <string name="theme_reset_notification_body">System theme restored due to multiple app crashes.</string>

    <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>
+2 −1
Original line number Diff line number Diff line
@@ -729,7 +729,8 @@ 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));
        }
    };

+2 −1
Original line number Diff line number Diff line
@@ -15432,7 +15432,8 @@ 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