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

Commit 41bec7bf authored by Koushik Dutta's avatar Koushik Dutta
Browse files

Add permission that allows cancelling notifications from other apps.

Change-Id: I055b17873e174f71174898a7649b1e221fd8c436
parent 2ce68c45
Loading
Loading
Loading
Loading
+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 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 intercept and rewrite outgoing SMS
         @hide -->
    <permission android:name="android.permission.INTERCEPT_SMS"
+5 −0
Original line number Diff line number Diff line
@@ -169,6 +169,11 @@
    <!-- 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>

    <!-- 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. -->
+4 −0
Original line number Diff line number Diff line
@@ -1583,6 +1583,10 @@ public class NotificationManagerService extends INotificationManager.Stub
    }

    void checkCallerIsSystemOrSameApp(String pkg) {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CANCEL_NOTIFICATIONS)
                == PackageManager.PERMISSION_GRANTED) {
            return;
        }
        int uid = Binder.getCallingUid();
        if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) {
            return;