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

Commit 08763676 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Simplify the minimalism flag wrapper to a single version.

Bug: 330387368
Flag: com.android.systemui.notification_minimalism_prototype
Test: atest SystemUITests
Change-Id: I5c3cb781b525dfa6cf51133e8ab23d17b45abc9b
parent 88132e81
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -52,8 +52,11 @@ constructor(val proxy: DeviceConfigProxy, val context: Context) {
    }

    fun getNotificationBuckets(): IntArray {
        if (PriorityPeopleSection.isEnabled || NotificationMinimalismPrototype.V2.isEnabled
            || NotificationClassificationFlag.isEnabled) {
        if (
            PriorityPeopleSection.isEnabled ||
                NotificationMinimalismPrototype.isEnabled ||
                NotificationClassificationFlag.isEnabled
        ) {
            // We don't need this list to be adaptive, it can be the superset of all features.
            return PriorityBucket.getAllInOrder()
        }
+2 −2
Original line number Diff line number Diff line
@@ -120,11 +120,11 @@ constructor(
        }

        // Manually add Ordered Sections
        if (NotificationMinimalismPrototype.V2.isEnabled) {
        if (NotificationMinimalismPrototype.isEnabled) {
            mOrderedSections.add(unseenKeyguardCoordinator.topOngoingSectioner) // Top Ongoing
        }
        mOrderedSections.add(headsUpCoordinator.sectioner) // HeadsUp
        if (NotificationMinimalismPrototype.V2.isEnabled) {
        if (NotificationMinimalismPrototype.isEnabled) {
            mOrderedSections.add(unseenKeyguardCoordinator.topUnseenSectioner) // Top Unseen
        }
        mOrderedSections.add(colorizedFgsCoordinator.sectioner) // ForegroundService
+8 −16
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ constructor(
    private var unseenFilterEnabled = false

    override fun attach(pipeline: NotifPipeline) {
        if (NotificationMinimalismPrototype.V2.isEnabled) {
        if (NotificationMinimalismPrototype.isEnabled) {
            pipeline.addPromoter(unseenNotifPromoter)
            pipeline.addOnBeforeTransformGroupsListener(::pickOutTopUnseenNotifs)
        }
@@ -265,10 +265,7 @@ constructor(
    }

    private fun unseenFeatureEnabled(): Flow<Boolean> {
        if (
            NotificationMinimalismPrototype.V1.isEnabled ||
                NotificationMinimalismPrototype.V2.isEnabled
        ) {
        if (NotificationMinimalismPrototype.isEnabled) {
            return flowOf(true)
        }
        return secureSettings
@@ -341,7 +338,7 @@ constructor(
        }

    private fun pickOutTopUnseenNotifs(list: List<ListEntry>) {
        if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) return
        if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) return
        // Only ever elevate a top unseen notification on keyguard, not even locked shade
        if (statusBarStateController.state != StatusBarState.KEYGUARD) {
            seenNotificationsInteractor.setTopOngoingNotification(null)
@@ -376,8 +373,8 @@ constructor(
    val unseenNotifPromoter =
        object : NotifPromoter("$TAG-unseen") {
            override fun shouldPromoteToTopLevel(child: NotificationEntry): Boolean =
                if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) false
                else if (!NotificationMinimalismPrototype.V2.ungroupTopUnseen) false
                if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) false
                else if (!NotificationMinimalismPrototype.ungroupTopUnseen) false
                else
                    seenNotificationsInteractor.isTopOngoingNotification(child) ||
                        seenNotificationsInteractor.isTopUnseenNotification(child)
@@ -386,7 +383,7 @@ constructor(
    val topOngoingSectioner =
        object : NotifSectioner("TopOngoing", BUCKET_TOP_ONGOING) {
            override fun isInSection(entry: ListEntry): Boolean {
                if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) return false
                if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) return false
                return entry.anyEntry { notificationEntry ->
                    seenNotificationsInteractor.isTopOngoingNotification(notificationEntry)
                }
@@ -396,7 +393,7 @@ constructor(
    val topUnseenSectioner =
        object : NotifSectioner("TopUnseen", BUCKET_TOP_UNSEEN) {
            override fun isInSection(entry: ListEntry): Boolean {
                if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) return false
                if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) return false
                return entry.anyEntry { notificationEntry ->
                    seenNotificationsInteractor.isTopUnseenNotification(notificationEntry)
                }
@@ -427,13 +424,8 @@ constructor(
             * allow seen notifications to appear in the locked shade.
             */
            private fun isOnKeyguard(): Boolean =
                if (NotificationMinimalismPrototype.V2.isEnabled) {
                if (NotificationMinimalismPrototype.isEnabled) {
                    false // disable this feature under this prototype
                } else if (
                    NotificationMinimalismPrototype.V1.isEnabled &&
                        NotificationMinimalismPrototype.V1.showOnLockedShade
                ) {
                    statusBarStateController.state == StatusBarState.KEYGUARD
                } else {
                    keyguardRepository.isKeyguardShowing()
                }
+3 −2
Original line number Diff line number Diff line
@@ -150,8 +150,9 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable {
                    if (entry == null) {
                        return false;
                    }
                    boolean isTopUnseen = NotificationMinimalismPrototype.V2.isEnabled()
                            && mSeenNotificationsInteractor.isTopUnseenNotification(entry);
                    boolean isTopUnseen = NotificationMinimalismPrototype.isEnabled()
                            && (mSeenNotificationsInteractor.isTopUnseenNotification(entry)
                                || mSeenNotificationsInteractor.isTopOngoingNotification(entry));
                    if (isTopUnseen || mHeadsUpManager.isHeadsUpEntry(entry.getKey())) {
                        return !mVisibilityLocationProvider.isInVisibleLocation(entry);
                    }
+4 −4
Original line number Diff line number Diff line
@@ -41,24 +41,24 @@ constructor(

    /** Set the entry that is identified as the top ongoing notification. */
    fun setTopOngoingNotification(entry: NotificationEntry?) {
        if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) return
        if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) return
        notificationListRepository.topOngoingNotificationKey.value = entry?.key
    }

    /** Determine if the given notification is the top ongoing notification. */
    fun isTopOngoingNotification(entry: NotificationEntry?): Boolean =
        if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) false
        if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) false
        else
            entry != null && notificationListRepository.topOngoingNotificationKey.value == entry.key

    /** Set the entry that is identified as the top unseen notification. */
    fun setTopUnseenNotification(entry: NotificationEntry?) {
        if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) return
        if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) return
        notificationListRepository.topUnseenNotificationKey.value = entry?.key
    }

    /** Determine if the given notification is the top unseen notification. */
    fun isTopUnseenNotification(entry: NotificationEntry?): Boolean =
        if (NotificationMinimalismPrototype.V2.isUnexpectedlyInLegacyMode()) false
        if (NotificationMinimalismPrototype.isUnexpectedlyInLegacyMode()) false
        else entry != null && notificationListRepository.topUnseenNotificationKey.value == entry.key
}
Loading