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

Commit c118e962 authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge "Notification Minimalism Prototype tweaks" into main

parents 09c1b425 74188382
Loading
Loading
Loading
Loading
+31 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

package com.android.systemui.statusbar.notification.collection.coordinator

import android.os.SystemProperties
import android.os.UserHandle
import android.provider.Settings
import androidx.annotation.VisibleForTesting
@@ -340,12 +341,41 @@ constructor(

            var hasFilteredAnyNotifs = false

            /**
             * the [notificationMinimalismPrototype] will now show seen notifications on the locked
             * shade by default, but this property read allows that to be quickly disabled for
             * testing
             */
            private val minimalismShowOnLockedShade
                get() =
                    SystemProperties.getBoolean(
                        "persist.notification_minimalism_prototype.show_on_locked_shade",
                        true
                    )

            /**
             * Encapsulates a definition of "being on the keyguard". Note that these two definitions
             * are wildly different: [StatusBarState.KEYGUARD] is when on the lock screen and does
             * not include shade or occluded states, whereas [KeyguardRepository.isKeyguardShowing]
             * is any state where the keyguard has not been dismissed, including locked shade and
             * occluded lock screen.
             *
             * Returning false for locked shade and occluded states means that this filter will
             * allow seen notifications to appear in the locked shade.
             */
            private fun isOnKeyguard(): Boolean =
                if (notificationMinimalismPrototype() && minimalismShowOnLockedShade) {
                    statusBarStateController.state == StatusBarState.KEYGUARD
                } else {
                    keyguardRepository.isKeyguardShowing()
                }

            override fun shouldFilterOut(entry: NotificationEntry, now: Long): Boolean =
                when {
                    // Don't apply filter if the setting is disabled
                    !unseenFilterEnabled -> false
                    // Don't apply filter if the keyguard isn't currently showing
                    !keyguardRepository.isKeyguardShowing() -> false
                    !isOnKeyguard() -> false
                    // Don't apply the filter if the notification is unseen
                    unseenNotifications.contains(entry) -> false
                    // Don't apply the filter to (non-promoted) group summaries
+15 −5
Original line number Diff line number Diff line
@@ -17,14 +17,15 @@
package com.android.systemui.statusbar.notification.stack

import android.content.res.Resources
import android.os.SystemProperties
import android.util.Log
import android.view.View.GONE
import androidx.annotation.VisibleForTesting
import com.android.systemui.Flags.notificationMinimalismPrototype
import com.android.systemui.res.R
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.media.controls.domain.pipeline.MediaDataManager
import com.android.systemui.res.R
import com.android.systemui.statusbar.LockscreenShadeTransitionController
import com.android.systemui.statusbar.StatusBarState.KEYGUARD
import com.android.systemui.statusbar.SysuiStatusBarStateController
@@ -177,8 +178,8 @@ constructor(

        // TODO: Avoid making this split shade assumption by simply checking the stack for media
        val isMediaShowing = mediaDataManager.hasActiveMediaOrRecommendation()
        val isMediaShowingInStack = isMediaShowing && !splitShadeStateController
                .shouldUseSplitNotificationShade(resources)
        val isMediaShowingInStack =
            isMediaShowing && !splitShadeStateController.shouldUseSplitNotificationShade(resources)

        log { "\tGet maxNotifWithoutSavingSpace ---" }
        val maxNotifWithoutSavingSpace =
@@ -378,8 +379,17 @@ constructor(
    }

    fun updateResources() {
        maxKeyguardNotifications = if (notificationMinimalismPrototype()) 1
            else infiniteIfNegative(resources.getInteger(R.integer.keyguard_max_notification_count))
        maxKeyguardNotifications =
            infiniteIfNegative(
                if (notificationMinimalismPrototype()) {
                    SystemProperties.getInt(
                        "persist.notification_minimalism_prototype.lock_screen_max_notifs",
                        1
                    )
                } else {
                    resources.getInteger(R.integer.keyguard_max_notification_count)
                }
            )
        maxNotificationsExcludesMedia = notificationMinimalismPrototype()

        dividerHeight =