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

Commit 2d1f3233 authored by Yining Liu's avatar Yining Liu
Browse files

Add New SecureSettings Constant for Notification Minimalism

Add a new SecureSettings constant for Notification Minimalism
and use it for LockScreenMinimalismCoordinator to replace
usage of lock_screen_show_only_unseen_notifications.

Bug: 330387368
Bug: 354047572
Flag: com.android.server.notification.notification_minimalism
Test: adb shell settings put secure
lock_screen_notification_minimalism <1|0>

Change-Id: Iecaf6d405201e1da8507b5300e5e77ae7d62da8b
parent e0a11a0c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -10749,6 +10749,16 @@ public final class Settings {
        public static final String LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS =
                "lock_screen_show_only_unseen_notifications";
        /**
         * Indicates whether to minimalize the number of notifications to show on the lockscreen.
         * <p>
         * Type: int (0 for false, 1 for true)
         *
         * @hide
         */
        public static final String LOCK_SCREEN_NOTIFICATION_MINIMALISM =
                "lock_screen_notification_minimalism";
        /**
         * Indicates whether snooze options should be shown on notifications
         * <p>
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class SecureSettings {
        Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS,
        Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS,
        Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS,
        Settings.Secure.LOCK_SCREEN_NOTIFICATION_MINIMALISM,
        Settings.Secure.SHOW_NOTIFICATION_SNOOZE,
        Settings.Secure.NOTIFICATION_HISTORY_ENABLED,
        Settings.Secure.ZEN_DURATION,
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCK_SCREEN_NOTIFICATION_MINIMALISM, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.SHOW_NOTIFICATION_SNOOZE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.NOTIFICATION_HISTORY_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ZEN_DURATION, ANY_INTEGER_VALIDATOR);
+2 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.systemui.statusbar.notification.collection.modifyEntry
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener
import com.android.systemui.statusbar.notification.data.repository.FakeHeadsUpRowRepository
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
import com.android.systemui.statusbar.notification.domain.interactor.lockScreenNotificationMinimalismSetting
import com.android.systemui.statusbar.notification.shared.NotificationMinimalism
import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository
import com.android.systemui.testKosmos
@@ -76,7 +77,7 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() {
                mock<SysuiStatusBarStateController>().also { mock ->
                    doAnswer { statusBarState.ordinal }.whenever(mock).state
                }
            fakeSettings.putInt(Settings.Secure.LOCK_SCREEN_SHOW_ONLY_UNSEEN_NOTIFICATIONS, 1)
            lockScreenNotificationMinimalismSetting = true
        }
    private val notifPipeline: NotifPipeline = mock()
    private var statusBarState: StatusBarState = StatusBarState.KEYGUARD
+13 −0
Original line number Diff line number Diff line
@@ -91,4 +91,17 @@ class SeenNotificationsInteractorTest : SysuiTestCase() {
        testScheduler.runCurrent()
        assertThat(settingEnabled).isTrue()
    }

    fun testLockScreenNotificationMinimalismSetting() = runTest {
        val settingEnabled by
            collectLastValue(underTest.isLockScreenNotificationMinimalismEnabled())

        kosmos.lockScreenNotificationMinimalismSetting = false
        testScheduler.runCurrent()
        assertThat(settingEnabled).isFalse()

        kosmos.lockScreenNotificationMinimalismSetting = true
        testScheduler.runCurrent()
        assertThat(settingEnabled).isTrue()
    }
}
Loading