diff options
Diffstat (limited to 'Settings/src/com/android/tv/settings/device/apps/NotificationsPreference.java')
-rw-r--r-- | Settings/src/com/android/tv/settings/device/apps/NotificationsPreference.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/Settings/src/com/android/tv/settings/device/apps/NotificationsPreference.java b/Settings/src/com/android/tv/settings/device/apps/NotificationsPreference.java index 7972df0e4..d844c394b 100644 --- a/Settings/src/com/android/tv/settings/device/apps/NotificationsPreference.java +++ b/Settings/src/com/android/tv/settings/device/apps/NotificationsPreference.java @@ -25,7 +25,6 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.content.res.Resources; import android.os.RemoteException; import android.util.Log; @@ -130,24 +129,19 @@ public class NotificationsPreference extends SwitchPreference { PackageInfo info = context.getPackageManager().getPackageInfo( app.packageName, PackageManager.GET_SIGNATURES); return Utils.isSystemPackage(context.getResources(), context.getPackageManager(), info) - || isNonBlockablePackage(context.getResources(), app.packageName); + || isNonBlockablePackage(info); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return false; } - private boolean isNonBlockablePackage(Resources resources, String packageName) { - final String[] nonBlockablePkgs = resources.getStringArray( - resources.getIdentifier("config_nonBlockableNotificationPackages", - "array", "android")); - for (String pkg : nonBlockablePkgs) { - // The non blockable package list can contain channels in the `package:channelId` - // format. Since TV settings don't support notifications channels, we'll consider - // the package non blockable if one of its channels is blocked - if (pkg != null && packageName.equals(pkg.split(":", 2)[0])) { - return true; - } + private boolean isNonBlockablePackage(PackageInfo app) { + try { + return mNotificationManager.isImportanceLocked(app.packageName, + app.applicationInfo.uid); + } catch (RemoteException e) { + Log.w(TAG, "Error calling NotificationManager ", e); } return false; } |