summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pavel Grafov <pgrafov@google.com> 2018-03-20 22:14:54 +0000
committer android-build-merger <android-build-merger@google.com> 2018-03-20 22:14:54 +0000
commitd0c16b900dafa5e88998f2b5e86f8dd3d4c3213c (patch)
tree4cae313cf58c62e8724ecd1117478c666cb22316
parent6f2ed4ef0cb39b6775a37ac435b95b040d39e76a (diff)
parente205bc2e543185a7ae378cc8dbd967416cec3b10 (diff)
Merge "Update work notifivation settings on upgrade." into pi-dev am: 62931a44e5
am: e205bc2e54 Change-Id: Iff40426c8c7f62bab9a1ca4470b63dd1e00574c3
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java2
2 files changed, 24 insertions, 2 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 5102cbdf4c55..7de54db4ffeb 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2938,7 +2938,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 159;
+ private static final int SETTINGS_VERSION = 160;
private final int mUserId;
@@ -3646,6 +3646,28 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 159;
}
+ if (currentVersion == 159) {
+ // Version 160: Hiding notifications from the lockscreen is only available as
+ // primary user option, profiles can only make them redacted. If a profile was
+ // configured to not show lockscreen notifications, ensure that at the very
+ // least these will be come hidden.
+ if (mUserManager.isManagedProfile(userId)) {
+ final SettingsState secureSettings = getSecureSettingsLocked(userId);
+ Setting showNotifications = secureSettings.getSettingLocked(
+ Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS);
+ // The default value is "1", check if user has turned it off.
+ if ("0".equals(showNotifications.getValue())) {
+ secureSettings.insertSettingLocked(
+ Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, "0",
+ null /* tag */, false /* makeDefault */,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ // The setting is no longer valid for managed profiles, it should be
+ // treated as if it was set to "1".
+ secureSettings.deleteSettingLocked(Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS);
+ }
+ currentVersion = 160;
+ }
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
index cc584e7e79fe..ccabb79e229b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java
@@ -389,7 +389,7 @@ public class NotificationLockscreenUserManager implements Dumpable {
* "public" (secure & locked) mode?
*/
private boolean userAllowsNotificationsInPublic(int userHandle) {
- if (userHandle == UserHandle.USER_ALL) {
+ if (isCurrentProfile(userHandle)) {
return true;
}