Sunday, March 27, 2016

applications - "Show notifications" is greyed out for some apps. What's causing it and how do I change it?


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.



Answer



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.



No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...