Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5c97302 authored by Pavel Grafov's avatar Pavel Grafov
Browse files

Update work notifivation settings on upgrade.

Work notifications settings should only allows the user to cause
notifications to be redacted, not hidden alltogehter. If some user
had it hidden, change it to redacted on upgrade.

Bug: 64829587
Test: manual
Change-Id: Iff88638b2536481fb7ff66ac8a29512c95fbada6
parent 31d58db7
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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;
        }