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

Commit 0f3b1103 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Android (Google) Code Review
Browse files

Merge "[SB][Chips] Add TimeSource in OngoingActivityChipModel.Active.Timer" into main

parents a23ba269 24e31c6a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -200,8 +200,8 @@ constructor(
                    colors,
                    startTimeMs = this.promotedContent.time.elapsedRealtimeMillis,
                    isEventInFuture = this.promotedContent.time.isCountDown,
                    onClickListenerLegacy,
                    clickBehavior,
                    onClickListenerLegacy = onClickListenerLegacy,
                    clickBehavior = clickBehavior,
                )
            }
        }
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ fun ChipContent(viewModel: OngoingActivityChipModel.Active, modifier: Modifier =
                rememberChronometerState(
                    eventTimeMillis = viewModel.startTimeMs,
                    isCountDown = viewModel.isEventInFuture,
                    timeSource = viewModel.timeSource,
                )
            timerState.currentTimeText?.let { text ->
                Text(
+9 −0
Original line number Diff line number Diff line
@@ -18,12 +18,14 @@ package com.android.systemui.statusbar.chips.ui.model

import android.annotation.CurrentTimeMillisLong
import android.annotation.ElapsedRealtimeLong
import android.os.SystemClock
import android.view.View
import com.android.systemui.animation.Expandable
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
import com.android.systemui.statusbar.chips.ui.viewmodel.TimeSource
import com.android.systemui.statusbar.core.StatusBarConnectedDisplays

/** Model representing the display of an ongoing activity as a chip in the status bar. */
@@ -105,6 +107,13 @@ sealed class OngoingActivityChipModel {
             * [android.widget.Chronometer.setBase].
             */
            @ElapsedRealtimeLong val startTimeMs: Long,

            /**
             * The [TimeSource] that should be used to track the current time for this timer. Should
             * be compatible with [startTimeMs].
             */
            val timeSource: TimeSource = TimeSource { SystemClock.elapsedRealtime() },

            /**
             * True if this chip represents an event starting in the future and false if this chip
             * represents an event that has already started. If true, [startTimeMs] should be in the
+1 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.systemui.statusbar.chips.ui.viewmodel

import android.annotation.ElapsedRealtimeLong
import android.os.SystemClock
import android.text.format.DateUtils.formatElapsedTime
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -90,7 +89,7 @@ class ChronometerState(
fun rememberChronometerState(
    eventTimeMillis: Long,
    isCountDown: Boolean,
    timeSource: TimeSource = remember { TimeSource { SystemClock.elapsedRealtime() } },
    timeSource: TimeSource,
): ChronometerState {
    val state =
        remember(timeSource, eventTimeMillis, isCountDown) {