diff options
author | Chris Wren <cwren@android.com> | 2014-09-02 17:23:51 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2014-09-04 11:49:06 -0400 |
commit | 3ad4e3a45bbe44129b14c4d391431e44f1e04f0c (patch) | |
tree | 43d0d023d84a38bbeb9d6169bfb9a20d634a1a31 /packages | |
parent | e23b8dd58fba275802d48fccb43170845aac0382 (diff) | |
download | frameworks_base-3ad4e3a45bbe44129b14c4d391431e44f1e04f0c.zip frameworks_base-3ad4e3a45bbe44129b14c4d391431e44f1e04f0c.tar.gz frameworks_base-3ad4e3a45bbe44129b14c4d391431e44f1e04f0c.tar.bz2 |
Honor per-app sensitivity setting.
Settings are stored by NotificationManagerService in the policy file,
and are communicated to NotificationListeners via a hidden API on the
RankingMap object.
Bug: 16324353
Change-Id: I2d5cf6782273744cbf9b309dec76780cc0a4c39e
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java | 11 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 15 |
2 files changed, 21 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index cef889c..0905fe7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar; import android.app.Notification; +import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; @@ -173,6 +174,14 @@ public class NotificationData { return false; } + public int getVisibilityOverride(String key) { + if (mRankingMap != null) { + mRankingMap.getRanking(key, mTmpRanking); + return mTmpRanking.getVisibilityOverride(); + } + return NotificationListenerService.Ranking.VISIBILITY_NO_OVERRIDE; + } + private void updateRankingAndSort(RankingMap ranking) { if (ranking != null) { mRankingMap = ranking; @@ -300,7 +309,7 @@ public class NotificationData { * Provides access to keyguard state and user settings dependent data. */ public interface Environment { - public boolean shouldHideSensitiveContents(int userId); + public boolean shouldHideSensitiveContents(int userid); public boolean isDeviceProvisioned(); public boolean isNotificationForCurrentProfiles(StatusBarNotification sbn); public String getCurrentMediaNotificationKey(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 00e9790..ddd03d6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -71,6 +71,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; +import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.util.ArraySet; @@ -1414,11 +1415,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // Display public version of the notification if we need to redact. final boolean hideSensitive = !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId()); - boolean sensitive = vis == Notification.VISIBILITY_PRIVATE; - boolean showingPublic = sensitive && hideSensitive && isLockscreenPublicMode(); - ent.row.setSensitive(sensitive && hideSensitive); + boolean sensitiveNote = vis == Notification.VISIBILITY_PRIVATE; + boolean sensitivePackage = packageHasVisibilityOverride(ent.notification.getKey()); + boolean sensitive = (sensitiveNote && hideSensitive) || sensitivePackage; + boolean showingPublic = sensitive && isLockscreenPublicMode(); + ent.row.setSensitive(sensitive); if (ent.autoRedacted && ent.legacy) { - // TODO: Also fade this? Or, maybe easier (and better), provide a dark redacted form // for legacy auto redacted notifications. if (showingPublic) { @@ -1479,6 +1481,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mShadeUpdates.check(); } + private boolean packageHasVisibilityOverride(String key) { + return mNotificationData.getVisibilityOverride(key) + != NotificationListenerService.Ranking.VISIBILITY_NO_OVERRIDE; + } + private void updateClearAll() { boolean showDismissView = mState != StatusBarState.KEYGUARD && |