4

There are some apps for which "Show Notifications" is greyed out, thus effectively barring you from changing the notification policy of that app.

  1. Why or when does it happen?
  2. I've noticed this issue for system apps only? Does it mean that only system apps can have this option greyed out?
  3. How do I change the notification policy for such apps?

(Click image to enlarge)

IMG: IMG: IMG:

I have a rooted Android 4.2.1, 4.4.2 and 5.0.2. I'm aware of changing the notification policy in Android 4.2.1 and 4.4.2. You may move the focus to Lollipop, only for third point.

  • 2
    There are some apps for notification settings, some of them claiming to be capable of that. I've not tested any, so I cannot say for sure. – Izzy Aug 24 '15 at 15:01
  • @Izzy Thanks for the link. Using notifications_policy.xml in Android 4.2 and 4.4, I can easily disable app notifications for any of the app regardless of that greyed out check-box, so I don't have to rely on third-party apps. But the issue is more conceptual, the reason I asked three questions under one hood. – Firelord Aug 24 '15 at 15:11
  • Ah, so you've got a partial solution already – but look for a final one :) Well, I'm not aware on any not requiring a 3rd party app (which you surely would prefer). If there's really no such, feel free to post your answer with an app from my list, if you found a satisfying candidate. Good luck! – Izzy Aug 24 '15 at 16:36
2
+100

jan's answer already addresses how to change the notification policy for such (disabled "show notifications") apps.

As for why and when (or essentially, in what condition it applies), your guess of system apps is on the right track.

To be exact, as Sergey has explained in the comment, only packages that are signed with the platform key (from vendor/manufacturer, e.g. AOSP) will have this privilege. These packages are part of the core platform. Other preinstalled apps (including apps with some special privileges, which are signed with the shared or media key) and "system" apps (apps which are put on /system/app folder and granted access right) are not counted.

Summary: as of the latest version (Android 5.1.1 Lollipop), the checkbox is disabled if:

  1. The app is signed with platform key (part of the core platform), or
  2. The app is not installed on the current user (in multi-user case)

From InstalledAppDetails.java (this is what "App Info" displays),

private CompoundButton mNotificationSwitch; // this is the "show notifications" checkbox

...

private void initNotificationButton() {

    ...

    if (Utils.isSystemPackage(mPm, mPackageInfo)) {
        mNotificationSwitch.setEnabled(false);
    } else if ((mPackageInfo.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
        // App is not installed on the current user
        mNotificationSwitch.setEnabled(false);
    } else {
        mNotificationSwitch.setEnabled(true);
        mNotificationSwitch.setOnCheckedChangeListener(this);
    }
}

Note:

  • Utils.isSystemPackage() returns true only for packages signed with the platform key.
  • This doesn't apply on Android 6.0 Marshmallow due to overhaul on App Info's user interface; there's no checkbox, instead there's a centralized notification settings per app. However, the underlying principle is still the same that you cannot block notifications on an app that is system package.
  • Thanks for the link. But in My Paranoid and RR Rom some system apps like HTML viewer, Launcher, Download and more doesn't have that option greyed out. It would be much appreciated if a bit more reasoning concerning my point 1 and 2 is provided. – Firelord Aug 27 '15 at 18:03
  • 2
    @Firelord Utils.isSystemPackage() returns true only for packages signed by the platform key, which should be used only for packages which are part of the core platform. Other preinstalled apps (including apps with some special privileges, which are signed with the shared or media key) are not considered as “system” apps here. – Sergey Vlasov Aug 27 '15 at 21:34
  • Hi Andrew! Could you please fill in the point I asked in my earlier comment? Sergey covered it already but I have to award bounty in next two days, so may I suggest you incorporate facts from comment and optionally include anything else that may be relevant here. It's important info. – Firelord Aug 31 '15 at 19:02
  • @Firelord incorporated info from comment by Sergey. Sorry for the lack of information on the original post, I found it hard to understand what Utils.isSystemPackage() does at that time. – Andrew T. Sep 1 '15 at 3:04
4

With root access, there are some apps such as 3c Toolbox that allow you to change the notification settings for any app. App Ops is another one that gives you control over all apps' general permissions.

You can actually manage all app permissions from the command line with root access. In Android 5.x, appops was added. It gives control over general app permissions.

Find your app's package name by looking through the list generated by:

# pm list packages | sed 's/^package://'

Get a list of permissions and their mode (allow/ignore/deny/default) for a particular app:

(Note that get parameter is not available in 5.0.2 or earlier Lollipop releases, but was introduced in Android 5.1.0)

# appops get <package_name>

Set a particular app's permission:

# appops set <package_name> <permission> <mode>

To accomplish the same thing as unticking the "show notifications" box in the application manager:

# appops set <package_name> POST_NOTIFICATION ignore

From my experience, using deny as a mode can break appops so that permissions can't be accessed or changed from an app, so I recommend using ignore, which is what the system uses.

If in some case, you end up breaking access to app ops through something like the application manager, you can reset the permissions for an app:

appops reset <package_name>

For more control over detailed permissions, you can use pm in the terminal. This works with older Android versions.

Find your app's package name by looking through the list generated by:

# pm list packages | sed 's/^package://'

Then list the permissions for a particular package:

# pm list permissions <package_name>

Find the notifcation permissions:

# pm list permissions <package_name> | grep NOTIF

Grant or revoke a particular permission:

# pm grant <package_name> <permission>
# pm revoke <package_name> <permission>

The permissions listed with package manager are very detailed. Using a capable app to manage them may be a more practical route.

  • 1
    Just tested the appops method, and it works. Great and informative answer, and welcome to Android Enthusiasts! – Andrew T. Aug 27 '15 at 3:30
  • Hi! I added some info about get parameter availability because it was confusing me since Android 5.0.2 or any 5.0.x release doesn't have it. Feel free to rollback, but why would you? :) – Firelord Sep 2 '15 at 9:52
  • Jan, how do you revoke an app's ability to show a toast in Android 4.4.2? Unlike 4.2.1 Kitkat has appops.xml but doesn't have the binary appops for us to do anything with that file. And changing that file does nothing even after reboot. I'm interested in this question. See if you can help there or at least here. Thanks! – Firelord Oct 6 '15 at 18:06
  • @Firelord, thanks for making that modification. I wasn't aware of the appops difference between Lollipop versions. Also, I went ahead and posted to the link you provided here. It got a little to long to post as a comment. – jan Oct 7 '15 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.