summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorLars Greiss <kufikugel@googlemail.com>2014-11-24 23:45:41 +0100
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-06-01 10:38:58 -0700
commitee43aa5034d92153204f55f3ac0f70af3a70844f (patch)
tree642e2f0be78616cd41a9f8380b0c7c8fddc03ea6 /core/java
parent44e91e0ed2b3056e30ccfbb009be5f19495061ce (diff)
downloadframeworks_base-ee43aa5034d92153204f55f3ac0f70af3a70844f.zip
frameworks_base-ee43aa5034d92153204f55f3ac0f70af3a70844f.tar.gz
frameworks_base-ee43aa5034d92153204f55f3ac0f70af3a70844f.tar.bz2
Frameworks: Add per app controls for LP keyguard notifications (1/2)
Nice done by google but the UX is a problem especially for ppl who are using a lot apps and just want to see from important apps the notifications on the lockscreen. This commit adds the ability to - enable/disable per app the keyguard notification at all - enable/disable per app ongoing notifications on the keyguard We handle this over the app policy conf file like the other per app notification options. CRACKLING-1127 Change-Id: Ib166db1b1673aeaea132c8eeb16c650d2f254a82
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/INotificationManager.aidl3
-rw-r--r--core/java/android/app/Notification.java15
-rw-r--r--core/java/android/app/NotificationManager.java11
3 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index f78fb47..e749d0a 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -55,6 +55,9 @@ interface INotificationManager
void setPackageVisibilityOverride(String pkg, int uid, int visibility);
int getPackageVisibilityOverride(String pkg, int uid);
+ void setShowNotificationForPackageOnKeyguard(String pkg, int uid, int status);
+ int getShowNotificationForPackageOnKeyguard(String pkg, int uid);
+
// TODO: Remove this when callers have been migrated to the equivalent
// INotificationListener method.
StatusBarNotification[] getActiveNotifications(String callingPkg);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index d8e01cd..8835a09 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -523,6 +523,21 @@ public class Notification implements Parcelable
public int priority;
/**
+ * Default.
+ * Show all notifications from an app on keyguard.
+ *
+ * @hide
+ */
+ public static final int SHOW_ALL_NOTI_ON_KEYGUARD = 0x01;
+
+ /**
+ * Show only notifications from an app which are not ongoing ones.
+ *
+ * @hide
+ */
+ public static final int SHOW_NO_ONGOING_NOTI_ON_KEYGUARD = 0x02;
+
+ /**
* Accent color (an ARGB integer like the constants in {@link android.graphics.Color})
* to be applied by the standard Style templates when presenting this notification.
*
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 605c006..2219e64 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -19,6 +19,7 @@ package android.app;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
+import android.app.Notification;
import android.app.Notification.Builder;
import android.content.ComponentName;
import android.content.Context;
@@ -512,6 +513,16 @@ public class NotificationManager
return new ArraySet<String>();
}
+ /** @hide */
+ public int getShowNotificationForPackageOnKeyguard(String pkg, int uid) {
+ INotificationManager service = getService();
+ try {
+ return getService().getShowNotificationForPackageOnKeyguard(pkg, uid);
+ } catch (RemoteException e) {
+ return Notification.SHOW_ALL_NOTI_ON_KEYGUARD;
+ }
+ }
+
private Context mContext;
private static void checkRequired(String name, Object value) {