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

Commit 688478cd authored by Julia Tuttle's avatar Julia Tuttle
Browse files

Move clock to left when AOD RON is present on split shade

Bug: 369151941
Flag: com.android.systemui.aod_ui_rich_ongoing
Test: manual
Change-Id: Ia55a9386d679752b22a8537a10271a09d4b61610
parent c51b1acb
Loading
Loading
Loading
Loading
+38 −5
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor
import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationInteractor
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiAod
import com.android.systemui.statusbar.notification.promoted.domain.interactor.AODPromotedNotificationInteractor
import com.android.systemui.util.kotlin.combine
import com.android.systemui.wallpapers.domain.interactor.WallpaperFocalAreaInteractor
import javax.inject.Inject
@@ -45,6 +47,7 @@ import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn

@@ -57,6 +60,7 @@ class KeyguardClockInteractor
constructor(
    mediaCarouselInteractor: MediaCarouselInteractor,
    activeNotificationsInteractor: ActiveNotificationsInteractor,
    aodPromotedNotificationInteractor: AODPromotedNotificationInteractor,
    shadeInteractor: ShadeInteractor,
    keyguardInteractor: KeyguardInteractor,
    keyguardTransitionInteractor: KeyguardTransitionInteractor,
@@ -80,11 +84,30 @@ constructor(

    var clock: ClockController? by keyguardClockRepository.clockEventController::clock

    private val isAodPromotedNotificationPresent: Flow<Boolean> =
        if (PromotedNotificationUiAod.isEnabled) {
            aodPromotedNotificationInteractor.isPresent
        } else {
            flowOf(false)
        }

    private val areAnyNotificationsPresent: Flow<Boolean> =
        if (PromotedNotificationUiAod.isEnabled) {
            combine(
                activeNotificationsInteractor.areAnyNotificationsPresent,
                isAodPromotedNotificationPresent,
            ) { areAnyNotificationsPresent, isAodPromotedNotificationPresent ->
                areAnyNotificationsPresent || isAodPromotedNotificationPresent
            }
        } else {
            activeNotificationsInteractor.areAnyNotificationsPresent
        }

    val clockSize: StateFlow<ClockSize> =
        if (SceneContainerFlag.isEnabled) {
            combine(
                    shadeInteractor.isShadeLayoutWide,
                    activeNotificationsInteractor.areAnyNotificationsPresent,
                    areAnyNotificationsPresent,
                    mediaCarouselInteractor.hasActiveMediaOrRecommendation,
                    keyguardInteractor.isDozing,
                    isOnAod,
@@ -110,23 +133,32 @@ constructor(
        if (SceneContainerFlag.isEnabled) {
            combine(
                shadeInteractor.isShadeLayoutWide,
                activeNotificationsInteractor.areAnyNotificationsPresent,
                areAnyNotificationsPresent,
                isAodPromotedNotificationPresent,
                isOnAod,
                headsUpNotificationInteractor.isHeadsUpOrAnimatingAway,
                keyguardInteractor.isDozing,
            ) { isShadeLayoutWide, areAnyNotificationsPresent, isOnAod, isHeadsUp, isDozing ->
            ) {
                isShadeLayoutWide,
                areAnyNotificationsPresent,
                isAodPromotedNotificationPresent,
                isOnAod,
                isHeadsUp,
                isDozing ->
                when {
                    !isShadeLayoutWide -> true
                    !areAnyNotificationsPresent -> true
                    // Pulsing notification appears on the right. Move clock left to avoid overlap.
                    isHeadsUp && isDozing -> false
                    isAodPromotedNotificationPresent -> false
                    else -> isOnAod
                }
            }
        } else {
            combine(
                    shadeInteractor.isShadeLayoutWide,
                    activeNotificationsInteractor.areAnyNotificationsPresent,
                    areAnyNotificationsPresent,
                    isAodPromotedNotificationPresent,
                    keyguardInteractor.dozeTransitionModel,
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map { it.to == AOD },
                    keyguardTransitionInteractor.startedKeyguardTransitionStep.map {
@@ -140,6 +172,7 @@ constructor(
                ) {
                    isShadeLayoutWide,
                    areAnyNotificationsPresent,
                    isAodPromotedNotificationPresent,
                    dozeTransitionModel,
                    startedToAod,
                    startedToLockScreen,
@@ -156,7 +189,7 @@ constructor(
                        // use null to skip emitting wrong value
                        startedToGone || startedToDoze -> null
                        startedToLockScreen -> !areAnyNotificationsPresent
                        startedToAod -> !isPulsing
                        startedToAod -> !(isPulsing || isAodPromotedNotificationPresent)
                        else -> true
                    }
                }
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel.Style
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
@@ -31,4 +32,6 @@ constructor(activeNotificationsInteractor: ActiveNotificationsInteractor) {
        activeNotificationsInteractor.topLevelRepresentativeNotifications.map { notifs ->
            notifs.firstNotNullOfOrNull { it.promotedContent }
        }

    val isPresent: Flow<Boolean> = content.map { (it != null) && (it.style != Style.Ineligible) }
}
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.media.controls.domain.pipeline.interactor.mediaCarouselInteractor
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor
import com.android.systemui.statusbar.notification.promoted.domain.interactor.aodPromotedNotificationInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor
import com.android.systemui.wallpapers.domain.interactor.wallpaperFocalAreaInteractor

@@ -30,6 +31,7 @@ val Kosmos.keyguardClockInteractor by
        KeyguardClockInteractor(
            mediaCarouselInteractor = mediaCarouselInteractor,
            activeNotificationsInteractor = activeNotificationsInteractor,
            aodPromotedNotificationInteractor = aodPromotedNotificationInteractor,
            shadeInteractor = shadeInteractor,
            keyguardInteractor = keyguardInteractor,
            keyguardTransitionInteractor = keyguardTransitionInteractor,
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.notification.promoted.domain.interactor

import com.android.systemui.kosmos.Kosmos
import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor

val Kosmos.aodPromotedNotificationInteractor by
    Kosmos.Fixture {
        AODPromotedNotificationInteractor(
            activeNotificationsInteractor = activeNotificationsInteractor
        )
    }