summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-07-10 16:08:18 -0400
committerChris Wren <cwren@android.com>2014-07-14 18:52:02 +0000
commita7d0062efd77ce5f5c8895d907881309d9efeea8 (patch)
tree67c4003b29303f04863d74305eb5b97565089d78 /src
parentf43bbeb247fdcdbf8fdc6b5ffbd437797a99ce6b (diff)
downloadpackages_apps_Settings-a7d0062efd77ce5f5c8895d907881309d9efeea8.tar.gz
packages_apps_Settings-a7d0062efd77ce5f5c8895d907881309d9efeea8.tar.bz2
packages_apps_Settings-a7d0062efd77ce5f5c8895d907881309d9efeea8.zip
Implement application-level high priority setting.
Bug: 15080024 Change-Id: I87a68cf89a643096ae374d0a808f820814e0b81b Depends-On: Ib1d3b0b5ca4fcfdc52c2cb6838a009b9addf1094
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/notification/AppNotificationSettings.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 34d465ec7..510d0d65c 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -70,7 +70,7 @@ public class AppNotificationSettings extends ListFragment {
* Show a checkbox in the per-app notification control dialog to allow the user
* to promote this app's notifications to higher priority.
*/
- private static final boolean ENABLE_APP_NOTIFICATION_PRIORITY_OPTION = false;
+ private static final boolean ENABLE_APP_NOTIFICATION_PRIORITY_OPTION = true;
/**
* Show a checkbox in the per-app notification control dialog to allow the user to
* selectively redact this app's notifications on the lockscreen.
@@ -585,13 +585,27 @@ public class AppNotificationSettings extends ListFragment {
}
public boolean getHighPriority(String pkg, int uid) {
- // TODO get high-pri state from NoMan
- return false;
+ INotificationManager nm = INotificationManager.Stub.asInterface(
+ ServiceManager.getService(Context.NOTIFICATION_SERVICE));
+ try {
+ return nm.getPackagePriority(pkg, uid) == Notification.PRIORITY_MAX;
+ } catch (Exception e) {
+ Log.w(TAG, "Error calling NoMan", e);
+ return false;
+ }
}
- public boolean setHighPriority(String pkg, int uid, boolean priority) {
- // TODO save high-pri state to NoMan
- return true;
+ public boolean setHighPriority(String pkg, int uid, boolean highPriority) {
+ INotificationManager nm = INotificationManager.Stub.asInterface(
+ ServiceManager.getService(Context.NOTIFICATION_SERVICE));
+ try {
+ nm.setPackagePriority(pkg, uid,
+ highPriority ? Notification.PRIORITY_MAX : Notification.PRIORITY_DEFAULT);
+ return true;
+ } catch (Exception e) {
+ Log.w(TAG, "Error calling NoMan", e);
+ return false;
+ }
}
public boolean getSensitive(String pkg, int uid) {