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

Commit 92a41e0c authored by Koushik Dutta's avatar Koushik Dutta
Browse files

Revert "Add permission that allows cancelling notifications from other apps."

Change-Id: I4eaf3eedacc99db47da384ecb976fe8ef6a97209
parent 281cb51e
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -2205,15 +2205,6 @@
        android:description="@string/permdesc_broadcastPackageRemoved"
        android:protectionLevel="signature" />

    <!-- Allows an application to cancel notifications from other apps
         -->
    <permission android:name="android.permission.CANCEL_NOTIFICATIONS"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="signature|system"
        android:label="@string/permlab_cancelNotifications"
        android:description="@string/permdesc_cancelNotifications" />


    <!-- Allows an application to broadcast an SMS receipt notification.
    <p>Not for use by third-party applications. -->
    <permission android:name="android.permission.BROADCAST_SMS"
+0 −5
Original line number Diff line number Diff line
@@ -176,11 +176,6 @@
    <!-- 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_cancelNotifications">cancel application notifications</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_cancelNotifications">Allows the app to cancel notifications created by other apps.</string>

    <!-- Performance profile modes -->
    <string name="perf_profile_pwrsv">Power save</string>
    <string name="perf_profile_bal">Balanced</string>
+2 −10
Original line number Diff line number Diff line
@@ -2330,7 +2330,7 @@ public class NotificationManagerService extends INotificationManager.Stub
    }

    public void cancelNotificationWithTag(String pkg, String tag, int id, int userId) {
        checkCallerCanCancelNotification(pkg);
        checkCallerIsSystemOrSameApp(pkg);
        userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
                Binder.getCallingUid(), userId, true, false, "cancelNotificationWithTag", pkg);
        // Don't allow client applications to cancel foreground service notis.
@@ -2340,7 +2340,7 @@ public class NotificationManagerService extends INotificationManager.Stub
    }

    public void cancelAllNotifications(String pkg, int userId) {
        checkCallerCanCancelNotification(pkg);
        checkCallerIsSystemOrSameApp(pkg);

        userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
                Binder.getCallingUid(), userId, true, false, "cancelAllNotifications", pkg);
@@ -2369,14 +2369,6 @@ public class NotificationManagerService extends INotificationManager.Stub
        throw new SecurityException("Disallowed call for uid " + Binder.getCallingUid());
    }

    void checkCallerCanCancelNotification(String pkg) {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CANCEL_NOTIFICATIONS)
                == PackageManager.PERMISSION_GRANTED) {
            return;
        }
        checkCallerIsSystemOrSameApp(pkg);
    }

    void checkCallerIsSystemOrSameApp(String pkg) {
        if (isCallerSystem()) {
            return;