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

Commit 4ac50a0f authored by Iavor-Valentin Iftime's avatar Iavor-Valentin Iftime
Browse files

Add setting to always expand bundle content

 Add secure setting used in SystemUi to always show bundle groups as expanded.

Flag: com.android.systemui.notification_bundle_ui
Test: atest RowAppearanceCoordinatorTest
Bug: 435696295
Change-Id: I9dcaf99af9ad1164ed434e3dc2e6eaa16eb5979d
parent 068de199
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -13018,6 +13018,14 @@ public final class Settings {
        public static final String ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED =
                "accessibility_magnification_two_finger_triple_tap_enabled";
        /**
         * Whether to always expand notification bundles in the notification shade.
         * 1 = expand, 0 = collapse.
         * @hide
         */
        public static final String NOTIFICATION_BUNDLES_ALWAYS_EXPAND =
                "notification_bundles_always_expand";
        /**
         * Whether the magnify navigation bar and keyboard feature is enabled.
         *
+1 −0
Original line number Diff line number Diff line
@@ -324,5 +324,6 @@ public class SecureSettings {
        Settings.Secure.IDENTITY_CHECK_ENABLED_V1,
        Settings.Secure.IDENTITY_CHECK_PROMO_CARD_SHOWN,
        Settings.Secure.IDENTITY_CHECK_NOTIFICATION_VIEW_DETAILS_CLICKED,
        Settings.Secure.NOTIFICATION_BUNDLES_ALWAYS_EXPAND,
    };
}
+1 −0
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ public class SecureSettingsValidators {
        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.NOTIFICATION_BUNDLES_ALWAYS_EXPAND, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ZEN_DURATION, ANY_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.CHARGING_SOUNDS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.CHARGING_VIBRATION_ENABLED, BOOLEAN_VALIDATOR);
+13 −8
Original line number Diff line number Diff line
@@ -44,12 +44,21 @@ class NotificationSettingsRepository(
            .map { it == 1 }
            .distinctUntilChanged()

    val shouldExpandBundles: StateFlow<Boolean> =
        secureSettingsRepository
            .intSetting(name = Settings.Secure.NOTIFICATION_BUNDLES_ALWAYS_EXPAND)
            .map { it == 1 }
            .flowOn(backgroundDispatcher)
            .stateIn(
                scope = backgroundScope,
                started = SharingStarted.Eagerly,
                initialValue = false,
            )

    /** The current state of the notification setting. */
    suspend fun isShowNotificationsOnLockScreenEnabled(): StateFlow<Boolean> =
        secureSettingsRepository
            .intSetting(
                name = Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS,
            )
            .intSetting(name = Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS)
            .map { it == 1 }
            .flowOn(backgroundDispatcher)
            .stateIn(scope = backgroundScope)
@@ -68,11 +77,7 @@ class NotificationSettingsRepository(
            .intSetting(name = Settings.System.NOTIFICATION_COOLDOWN_ENABLED)
            .map { it == 1 }
            .flowOn(backgroundDispatcher)
            .stateIn(
                scope = backgroundScope,
                started = SharingStarted.Eagerly,
                initialValue = true,
            )
            .stateIn(scope = backgroundScope, started = SharingStarted.Eagerly, initialValue = true)

    /** The default duration for DND mode when enabled. See [Settings.Secure.ZEN_DURATION]. */
    val zenDuration: StateFlow<Int> =
+5 −4
Original line number Diff line number Diff line
@@ -20,9 +20,7 @@ import com.android.systemui.shared.notifications.data.repository.NotificationSet
import kotlinx.coroutines.flow.StateFlow

/** Encapsulates business logic for interacting with notification settings. */
class NotificationSettingsInteractor(
    private val repository: NotificationSettingsRepository,
) {
class NotificationSettingsInteractor(private val repository: NotificationSettingsRepository) {
    val isNotificationHistoryEnabled = repository.isNotificationHistoryEnabled

    /** Should notifications be visible on the lockscreen? */
@@ -39,4 +37,7 @@ class NotificationSettingsInteractor(
        repository.setShowNotificationsOnLockscreenEnabled(!current)
    }

    val isCooldownEnabled = repository.isCooldownEnabled}
    val isCooldownEnabled = repository.isCooldownEnabled

    val shouldExpandBundles = repository.shouldExpandBundles
}
Loading