diff options
author | Lars Greiss <kufikugel@googlemail.com> | 2014-11-24 23:45:41 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-06-01 10:38:58 -0700 |
commit | ee43aa5034d92153204f55f3ac0f70af3a70844f (patch) | |
tree | 642e2f0be78616cd41a9f8380b0c7c8fddc03ea6 /packages/SystemUI | |
parent | 44e91e0ed2b3056e30ccfbb009be5f19495061ce (diff) | |
download | frameworks_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 'packages/SystemUI')
-rwxr-xr-x | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 3d7d4f6..39b6072 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -226,6 +226,8 @@ public abstract class BaseStatusBar extends SystemUI implements protected WindowManager mWindowManager; protected IWindowManager mWindowManagerService; + private NotificationManager mNoMan; + protected abstract void refreshLayout(int layoutDirection); protected Display mDisplay; @@ -432,9 +434,7 @@ public abstract class BaseStatusBar extends SystemUI implements } } } else if (BANNER_ACTION_CANCEL.equals(action) || BANNER_ACTION_SETUP.equals(action)) { - NotificationManager noMan = (NotificationManager) - mContext.getSystemService(Context.NOTIFICATION_SERVICE); - noMan.cancel(R.id.notification_hidden); + mNoMan.cancel(R.id.notification_hidden); Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, 0); @@ -563,6 +563,9 @@ public abstract class BaseStatusBar extends SystemUI implements public void start() { mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); mWindowManagerService = WindowManagerGlobal.getWindowManagerService(); + + mNoMan = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); + mDisplay = mWindowManager.getDefaultDisplay(); mDevicePolicyManager = (DevicePolicyManager)mContext.getSystemService( Context.DEVICE_POLICY_SERVICE); @@ -728,9 +731,7 @@ public abstract class BaseStatusBar extends SystemUI implements mContext.getString(R.string.hidden_notifications_setup), setupIntent); - NotificationManager noMan = - (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); - noMan.notify(R.id.notification_hidden, note.build()); + mNoMan.notify(R.id.notification_hidden, note.build()); } } @@ -1901,7 +1902,16 @@ public abstract class BaseStatusBar extends SystemUI implements } private boolean shouldShowOnKeyguard(StatusBarNotification sbn) { - return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey()); + final int showOnKeyguard = mNoMan.getShowNotificationForPackageOnKeyguard( + sbn.getPackageName(), sbn.getUid()); + boolean isKeyguardAllowedForApp = + (showOnKeyguard & Notification.SHOW_ALL_NOTI_ON_KEYGUARD) != 0; + if (isKeyguardAllowedForApp && sbn.isOngoing()) { + isKeyguardAllowedForApp = + (showOnKeyguard & Notification.SHOW_NO_ONGOING_NOTI_ON_KEYGUARD) == 0; + } + return mShowLockscreenNotifications && !mNotificationData.isAmbient(sbn.getKey()) + && isKeyguardAllowedForApp; } protected void setZenMode(int mode) { |