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

Commit 2d9a153b authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Android (Google) Code Review
Browse files

Merge "Modify clock message buffers for improved logging" into main

parents a6dc194d 6e34d791
Loading
Loading
Loading
Loading
+33 −26
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import com.android.internal.annotations.VisibleForTesting
import com.android.systemui.animation.GlyphCallback
import com.android.systemui.animation.TextAnimator
import com.android.systemui.customization.R
import com.android.systemui.log.core.LogcatOnlyMessageBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.core.Logger
import com.android.systemui.log.core.MessageBuffer
import java.io.PrintWriter
@@ -51,12 +53,13 @@ class AnimatableClockView @JvmOverloads constructor(
    defStyleAttr: Int = 0,
    defStyleRes: Int = 0
) : TextView(context, attrs, defStyleAttr, defStyleRes) {
    var messageBuffer: MessageBuffer? = null
        set(value) {
            logger = if (value != null) Logger(value, TAG) else null
        }

    private var logger: Logger? = null
    // To protect us from issues from this being null while the TextView constructor is running, we
    // implement the get method and ensure a value is returned before initialization is complete.
    private var logger = DEFAULT_LOGGER
        get() = field ?: DEFAULT_LOGGER
    var messageBuffer: MessageBuffer
        get() = logger.buffer
        set(value) { logger = Logger(value, TAG) }

    private val time = Calendar.getInstance()

@@ -133,8 +136,8 @@ class AnimatableClockView @JvmOverloads constructor(
    }

    override fun onAttachedToWindow() {
        logger.d("onAttachedToWindow")
        super.onAttachedToWindow()
        logger?.d("onAttachedToWindow")
        refreshFormat()
    }

@@ -150,13 +153,13 @@ class AnimatableClockView @JvmOverloads constructor(
        time.timeInMillis = timeOverrideInMillis ?: System.currentTimeMillis()
        contentDescription = DateFormat.format(descFormat, time)
        val formattedText = DateFormat.format(format, time)
        logger?.d({ "refreshTime: new formattedText=$str1" }) { str1 = formattedText?.toString() }
        logger.d({ "refreshTime: new formattedText=$str1" }) { str1 = formattedText?.toString() }
        // Setting text actually triggers a layout pass (because the text view is set to
        // wrap_content width and TextView always relayouts for this). Avoid needless
        // relayout if the text didn't actually change.
        if (!TextUtils.equals(text, formattedText)) {
            text = formattedText
            logger?.d({ "refreshTime: done setting new time text to: $str1" }) {
            logger.d({ "refreshTime: done setting new time text to: $str1" }) {
                str1 = formattedText?.toString()
            }
            // Because the TextLayout may mutate under the hood as a result of the new text, we
@@ -165,21 +168,22 @@ class AnimatableClockView @JvmOverloads constructor(
            // without being notified TextInterpolator being notified.
            if (layout != null) {
                textAnimator?.updateLayout(layout)
                logger?.d("refreshTime: done updating textAnimator layout")
                logger.d("refreshTime: done updating textAnimator layout")
            }
            requestLayout()
            logger?.d("refreshTime: after requestLayout")
            logger.d("refreshTime: after requestLayout")
        }
    }

    fun onTimeZoneChanged(timeZone: TimeZone?) {
        logger.d({ "onTimeZoneChanged($str1)" }) { str1 = timeZone?.toString() }
        time.timeZone = timeZone
        refreshFormat()
        logger?.d({ "onTimeZoneChanged newTimeZone=$str1" }) { str1 = timeZone?.toString() }
    }

    @SuppressLint("DrawAllocation")
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        logger.d("onMeasure")
        super.onMeasure(widthMeasureSpec, heightMeasureSpec)
        val animator = textAnimator
        if (animator == null) {
@@ -189,10 +193,10 @@ class AnimatableClockView @JvmOverloads constructor(
        } else {
            animator.updateLayout(layout)
        }
        logger?.d("onMeasure")
    }

    override fun onDraw(canvas: Canvas) {
        logger.d({ "onDraw($str1)"}) { str1 = text.toString() }
        // Use textAnimator to render text if animation is enabled.
        // Otherwise default to using standard draw functions.
        if (isAnimationEnabled) {
@@ -201,12 +205,13 @@ class AnimatableClockView @JvmOverloads constructor(
        } else {
            super.onDraw(canvas)
        }
        logger?.d("onDraw")
    }

    override fun invalidate() {
        @Suppress("UNNECESSARY_SAFE_CALL")
        // logger won't be initialized when called by TextView's constructor
        logger.d("invalidate")
        super.invalidate()
        logger?.d("invalidate")
    }

    override fun onTextChanged(
@@ -215,8 +220,8 @@ class AnimatableClockView @JvmOverloads constructor(
        lengthBefore: Int,
        lengthAfter: Int
    ) {
        logger.d({ "onTextChanged($str1)" }) { str1 = text.toString() }
        super.onTextChanged(text, start, lengthBefore, lengthAfter)
        logger?.d({ "onTextChanged text=$str1" }) { str1 = text.toString() }
    }

    fun setLineSpacingScale(scale: Float) {
@@ -230,7 +235,7 @@ class AnimatableClockView @JvmOverloads constructor(
    }

    fun animateColorChange() {
        logger?.d("animateColorChange")
        logger.d("animateColorChange")
        setTextStyle(
            weight = lockScreenWeight,
            textSize = -1f,
@@ -252,7 +257,7 @@ class AnimatableClockView @JvmOverloads constructor(
    }

    fun animateAppearOnLockscreen() {
        logger?.d("animateAppearOnLockscreen")
        logger.d("animateAppearOnLockscreen")
        setTextStyle(
            weight = dozingWeight,
            textSize = -1f,
@@ -278,7 +283,7 @@ class AnimatableClockView @JvmOverloads constructor(
        if (isAnimationEnabled && textAnimator == null) {
            return
        }
        logger?.d("animateFoldAppear")
        logger.d("animateFoldAppear")
        setTextStyle(
            weight = lockScreenWeightInternal,
            textSize = -1f,
@@ -305,7 +310,7 @@ class AnimatableClockView @JvmOverloads constructor(
            // Skip charge animation if dozing animation is already playing.
            return
        }
        logger?.d("animateCharge")
        logger.d("animateCharge")
        val startAnimPhase2 = Runnable {
            setTextStyle(
                weight = if (isDozing()) dozingWeight else lockScreenWeight,
@@ -329,7 +334,7 @@ class AnimatableClockView @JvmOverloads constructor(
    }

    fun animateDoze(isDozing: Boolean, animate: Boolean) {
        logger?.d("animateDoze")
        logger.d("animateDoze")
        setTextStyle(
            weight = if (isDozing) dozingWeight else lockScreenWeight,
            textSize = -1f,
@@ -448,7 +453,7 @@ class AnimatableClockView @JvmOverloads constructor(
            isSingleLineInternal && !use24HourFormat -> Patterns.sClockView12
            else -> DOUBLE_LINE_FORMAT_12_HOUR
        }
        logger?.d({ "refreshFormat format=$str1" }) { str1 = format?.toString() }
        logger.d({ "refreshFormat($str1)" }) { str1 = format?.toString() }

        descFormat = if (use24HourFormat) Patterns.sClockView24 else Patterns.sClockView12
        refreshTime()
@@ -552,6 +557,8 @@ class AnimatableClockView @JvmOverloads constructor(

    companion object {
        private val TAG = AnimatableClockView::class.simpleName!!
        private val DEFAULT_LOGGER = Logger(LogcatOnlyMessageBuffer(LogLevel.WARNING), TAG)

        const val ANIMATION_DURATION_FOLD_TO_AOD: Int = 600
        private const val DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm"
        private const val DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm"
+73 −157
Original line number Diff line number Diff line
@@ -21,20 +21,16 @@ import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.UserHandle
import android.provider.Settings
import android.util.Log
import androidx.annotation.OpenForTesting
import com.android.systemui.log.LogMessageImpl
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.core.LogMessage
import com.android.systemui.log.core.LogcatOnlyMessageBuffer
import com.android.systemui.log.core.Logger
import com.android.systemui.log.core.MessageBuffer
import com.android.systemui.log.core.MessageInitializer
import com.android.systemui.log.core.MessagePrinter
import com.android.systemui.plugins.PluginLifecycleManager
import com.android.systemui.plugins.PluginListener
import com.android.systemui.plugins.PluginManager
import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.plugins.clocks.ClockId
import com.android.systemui.plugins.clocks.ClockMessageBuffers
import com.android.systemui.plugins.clocks.ClockMetadata
import com.android.systemui.plugins.clocks.ClockProvider
import com.android.systemui.plugins.clocks.ClockProviderPlugin
@@ -77,32 +73,6 @@ private fun <TKey : Any, TVal : Any> ConcurrentHashMap<TKey, TVal>.concurrentGet
    return result ?: value
}

private val TMP_MESSAGE: LogMessage by lazy { LogMessageImpl.Factory.create() }

private inline fun Logger?.tryLog(
    tag: String,
    level: LogLevel,
    messageInitializer: MessageInitializer,
    noinline messagePrinter: MessagePrinter,
    ex: Throwable? = null,
) {
    if (this != null) {
        // Wrap messagePrinter to convert it from crossinline to noinline
        this.log(level, messagePrinter, ex, messageInitializer)
    } else {
        messageInitializer(TMP_MESSAGE)
        val msg = messagePrinter(TMP_MESSAGE)
        when (level) {
            LogLevel.VERBOSE -> Log.v(tag, msg, ex)
            LogLevel.DEBUG -> Log.d(tag, msg, ex)
            LogLevel.INFO -> Log.i(tag, msg, ex)
            LogLevel.WARNING -> Log.w(tag, msg, ex)
            LogLevel.ERROR -> Log.e(tag, msg, ex)
            LogLevel.WTF -> Log.wtf(tag, msg, ex)
        }
    }
}

/** ClockRegistry aggregates providers and plugins */
open class ClockRegistry(
    val context: Context,
@@ -114,12 +84,15 @@ open class ClockRegistry(
    val handleAllUsers: Boolean,
    defaultClockProvider: ClockProvider,
    val fallbackClockId: ClockId = DEFAULT_CLOCK_ID,
    messageBuffer: MessageBuffer? = null,
    val clockBuffers: ClockMessageBuffers? = null,
    val keepAllLoaded: Boolean,
    subTag: String,
    var isTransitClockEnabled: Boolean = false,
) {
    private val TAG = "${ClockRegistry::class.simpleName} ($subTag)"
    private val logger: Logger =
        Logger(clockBuffers?.infraMessageBuffer ?: LogcatOnlyMessageBuffer(LogLevel.DEBUG), TAG)

    interface ClockChangeListener {
        // Called when the active clock changes
        fun onCurrentClockChanged() {}
@@ -128,7 +101,6 @@ open class ClockRegistry(
        fun onAvailableClocksChanged() {}
    }

    private val logger: Logger? = if (messageBuffer != null) Logger(messageBuffer, TAG) else null
    private val availableClocks = ConcurrentHashMap<ClockId, ClockInfo>()
    private val clockChangeListeners = mutableListOf<ClockChangeListener>()
    private val settingObserver =
@@ -157,21 +129,15 @@ open class ClockRegistry(

                val knownClocks = KNOWN_PLUGINS.get(manager.getPackage())
                if (knownClocks == null) {
                    logger.tryLog(
                        TAG,
                        LogLevel.WARNING,
                        { str1 = manager.getPackage() },
                        { "Loading unrecognized clock package: $str1" }
                    )
                    logger.w({ "Loading unrecognized clock package: $str1" }) {
                        str1 = manager.getPackage()
                    }
                    return true
                }

                logger.tryLog(
                    TAG,
                    LogLevel.INFO,
                    { str1 = manager.getPackage() },
                    { "Skipping initial load of known clock package package: $str1" }
                )
                logger.i({ "Skipping initial load of known clock package package: $str1" }) {
                    str1 = manager.getPackage()
                }

                var isCurrentClock = false
                var isClockListChanged = false
@@ -185,19 +151,14 @@ open class ClockRegistry(
                        }

                    if (manager != info.manager) {
                        logger.tryLog(
                            TAG,
                            LogLevel.ERROR,
                            {
                        logger.e({
                            "Clock Id conflict on attach: " +
                                "$str1 is double registered by $str2 and $str3"
                        }) {
                            str1 = id
                            str2 = info.manager.toString()
                            str3 = manager.toString()
                            },
                            {
                                "Clock Id conflict on attach: " +
                                    "$str1 is double registered by $str2 and $str3"
                        }
                        )
                        continue
                    }

@@ -219,6 +180,8 @@ open class ClockRegistry(
                pluginContext: Context,
                manager: PluginLifecycleManager<ClockProviderPlugin>
            ) {
                plugin.initialize(clockBuffers)

                var isClockListChanged = false
                for (clock in plugin.getClocks()) {
                    val id = clock.clockId
@@ -233,19 +196,14 @@ open class ClockRegistry(
                        }

                    if (manager != info.manager) {
                        logger.tryLog(
                            TAG,
                            LogLevel.ERROR,
                            {
                        logger.e({
                            "Clock Id conflict on load: " +
                                "$str1 is double registered by $str2 and $str3"
                        }) {
                            str1 = id
                            str2 = info.manager.toString()
                            str3 = manager.toString()
                            },
                            {
                                "Clock Id conflict on load: " +
                                    "$str1 is double registered by $str2 and $str3"
                        }
                        )
                        manager.unloadPlugin()
                        continue
                    }
@@ -268,19 +226,14 @@ open class ClockRegistry(
                    val id = clock.clockId
                    val info = availableClocks[id]
                    if (info?.manager != manager) {
                        logger.tryLog(
                            TAG,
                            LogLevel.ERROR,
                            {
                        logger.e({
                            "Clock Id conflict on unload: " +
                                "$str1 is double registered by $str2 and $str3"
                        }) {
                            str1 = id
                            str2 = info?.manager.toString()
                            str3 = manager.toString()
                            },
                            {
                                "Clock Id conflict on unload: " +
                                    "$str1 is double registered by $str2 and $str3"
                        }
                        )
                        continue
                    }
                    info.provider = null
@@ -350,7 +303,7 @@ open class ClockRegistry(

                ClockSettings.deserialize(json)
            } catch (ex: Exception) {
                logger.tryLog(TAG, LogLevel.ERROR, {}, { "Failed to parse clock settings" }, ex)
                logger.e("Failed to parse clock settings", ex)
                null
            }
        settings = result
@@ -379,7 +332,7 @@ open class ClockRegistry(
                )
            }
        } catch (ex: Exception) {
            logger.tryLog(TAG, LogLevel.ERROR, {}, { "Failed to set clock settings" }, ex)
            logger.e("Failed to set clock settings", ex)
        }
        settings = value
    }
@@ -451,7 +404,8 @@ open class ClockRegistry(
        }

    init {
        // Register default clock designs
        // Initialize & register default clock designs
        defaultClockProvider.initialize(clockBuffers)
        for (clock in defaultClockProvider.getClocks()) {
            availableClocks[clock.clockId] = ClockInfo(clock, defaultClockProvider, null)
        }
@@ -514,12 +468,7 @@ open class ClockRegistry(
    fun verifyLoadedProviders() {
        val shouldSchedule = isQueued.compareAndSet(false, true)
        if (!shouldSchedule) {
            logger.tryLog(
                TAG,
                LogLevel.VERBOSE,
                {},
                { "verifyLoadedProviders: shouldSchedule=false" }
            )
            logger.v("verifyLoadedProviders: shouldSchedule=false")
            return
        }

@@ -528,12 +477,7 @@ open class ClockRegistry(
            synchronized(availableClocks) {
                isQueued.set(false)
                if (keepAllLoaded) {
                    logger.tryLog(
                        TAG,
                        LogLevel.INFO,
                        {},
                        { "verifyLoadedProviders: keepAllLoaded=true" }
                    )
                    logger.i("verifyLoadedProviders: keepAllLoaded=true")
                    // Enforce that all plugins are loaded if requested
                    for ((_, info) in availableClocks) {
                        info.manager?.loadPlugin()
@@ -543,12 +487,7 @@ open class ClockRegistry(

                val currentClock = availableClocks[currentClockId]
                if (currentClock == null) {
                    logger.tryLog(
                        TAG,
                        LogLevel.INFO,
                        {},
                        { "verifyLoadedProviders: currentClock=null" }
                    )
                    logger.i("verifyLoadedProviders: currentClock=null")
                    // Current Clock missing, load no plugins and use default
                    for ((_, info) in availableClocks) {
                        info.manager?.unloadPlugin()
@@ -556,12 +495,7 @@ open class ClockRegistry(
                    return@launch
                }

                logger.tryLog(
                    TAG,
                    LogLevel.INFO,
                    {},
                    { "verifyLoadedProviders: load currentClock" }
                )
                logger.i("verifyLoadedProviders: load currentClock")
                val currentManager = currentClock.manager
                currentManager?.loadPlugin()

@@ -577,30 +511,26 @@ open class ClockRegistry(

    private fun onConnected(info: ClockInfo) {
        val isCurrent = currentClockId == info.metadata.clockId
        logger.tryLog(
            TAG,
        logger.log(
            if (isCurrent) LogLevel.INFO else LogLevel.DEBUG,
            {
            { "Connected $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        ) {
            str1 = info.metadata.clockId
            str2 = info.manager.toString()
            bool1 = isCurrent
            },
            { "Connected $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        )
        }
    }

    private fun onLoaded(info: ClockInfo) {
        val isCurrent = currentClockId == info.metadata.clockId
        logger.tryLog(
            TAG,
        logger.log(
            if (isCurrent) LogLevel.INFO else LogLevel.DEBUG,
            {
            { "Loaded $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        ) {
            str1 = info.metadata.clockId
            str2 = info.manager.toString()
            bool1 = isCurrent
            },
            { "Loaded $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        )
        }

        if (isCurrent) {
            triggerOnCurrentClockChanged()
@@ -609,16 +539,14 @@ open class ClockRegistry(

    private fun onUnloaded(info: ClockInfo) {
        val isCurrent = currentClockId == info.metadata.clockId
        logger.tryLog(
            TAG,
        logger.log(
            if (isCurrent) LogLevel.WARNING else LogLevel.DEBUG,
            {
            { "Unloaded $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        ) {
            str1 = info.metadata.clockId
            str2 = info.manager.toString()
            bool1 = isCurrent
            },
            { "Unloaded $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        )
        }

        if (isCurrent) {
            triggerOnCurrentClockChanged()
@@ -627,16 +555,14 @@ open class ClockRegistry(

    private fun onDisconnected(info: ClockInfo) {
        val isCurrent = currentClockId == info.metadata.clockId
        logger.tryLog(
            TAG,
        logger.log(
            if (isCurrent) LogLevel.INFO else LogLevel.DEBUG,
            {
            { "Disconnected $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        ) {
            str1 = info.metadata.clockId
            str2 = info.manager.toString()
            bool1 = isCurrent
            },
            { "Disconnected $str1 @$str2" + if (bool1) " (Current Clock)" else "" }
        )
        }
    }

    fun getClocks(): List<ClockMetadata> {
@@ -676,23 +602,13 @@ open class ClockRegistry(
        if (isEnabled && clockId.isNotEmpty()) {
            val clock = createClock(clockId)
            if (clock != null) {
                logger.tryLog(TAG, LogLevel.INFO, { str1 = clockId }, { "Rendering clock $str1" })
                logger.i({ "Rendering clock $str1" }) { str1 = clockId }
                return clock
            } else if (availableClocks.containsKey(clockId)) {
                logger.tryLog(
                    TAG,
                    LogLevel.WARNING,
                    { str1 = clockId },
                    { "Clock $str1 not loaded; using default" }
                )
                logger.w({ "Clock $str1 not loaded; using default" }) { str1 = clockId }
                verifyLoadedProviders()
            } else {
                logger.tryLog(
                    TAG,
                    LogLevel.ERROR,
                    { str1 = clockId },
                    { "Clock $str1 not found; using default" }
                )
                logger.e({ "Clock $str1 not found; using default" }) { str1 = clockId }
            }
        }

+10 −11
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.systemui.plugins.clocks.ClockEvents
import com.android.systemui.plugins.clocks.ClockFaceConfig
import com.android.systemui.plugins.clocks.ClockFaceController
import com.android.systemui.plugins.clocks.ClockFaceEvents
import com.android.systemui.plugins.clocks.ClockMessageBuffers
import com.android.systemui.plugins.clocks.ClockSettings
import com.android.systemui.plugins.clocks.DefaultClockFaceLayout
import com.android.systemui.plugins.clocks.WeatherData
@@ -41,8 +42,6 @@ import java.io.PrintWriter
import java.util.Locale
import java.util.TimeZone

private val TAG = DefaultClockController::class.simpleName

/**
 * Controls the default clock visuals.
 *
@@ -56,6 +55,7 @@ class DefaultClockController(
    private val settings: ClockSettings?,
    private val hasStepClockAnimation: Boolean = false,
    private val migratedClocks: Boolean = false,
    messageBuffers: ClockMessageBuffers? = null,
) : ClockController {
    override val smallClock: DefaultClockFaceController
    override val largeClock: LargeClockFaceController
@@ -83,13 +83,15 @@ class DefaultClockController(
            DefaultClockFaceController(
                layoutInflater.inflate(R.layout.clock_default_small, parent, false)
                    as AnimatableClockView,
                settings?.seedColor
                settings?.seedColor,
                messageBuffers?.smallClockMessageBuffer
            )
        largeClock =
            LargeClockFaceController(
                layoutInflater.inflate(R.layout.clock_default_large, parent, false)
                    as AnimatableClockView,
                settings?.seedColor
                settings?.seedColor,
                messageBuffers?.largeClockMessageBuffer
            )
        clocks = listOf(smallClock.view, largeClock.view)

@@ -110,6 +112,7 @@ class DefaultClockController(
    open inner class DefaultClockFaceController(
        override val view: AnimatableClockView,
        var seedColor: Int?,
        messageBuffer: MessageBuffer?,
    ) : ClockFaceController {

        // MAGENTA is a placeholder, and will be assigned correctly in initialize
@@ -120,12 +123,6 @@ class DefaultClockController(
        override val config = ClockFaceConfig()
        override val layout = DefaultClockFaceLayout(view)

        override var messageBuffer: MessageBuffer?
            get() = view.messageBuffer
            set(value) {
                view.messageBuffer = value
            }

        override var animations: DefaultClockAnimations = DefaultClockAnimations(view, 0f, 0f)
            internal set

@@ -134,6 +131,7 @@ class DefaultClockController(
                currentColor = seedColor!!
            }
            view.setColors(DOZE_COLOR, currentColor)
            messageBuffer?.let { view.messageBuffer = it }
        }

        override val events =
@@ -188,7 +186,8 @@ class DefaultClockController(
    inner class LargeClockFaceController(
        view: AnimatableClockView,
        seedColor: Int?,
    ) : DefaultClockFaceController(view, seedColor) {
        messageBuffer: MessageBuffer?,
    ) : DefaultClockFaceController(view, seedColor, messageBuffer) {
        override val layout = DefaultClockFaceLayout(view)
        override val config =
            ClockFaceConfig(hasCustomPositionUpdatedAnimation = hasStepClockAnimation)
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.view.LayoutInflater
import com.android.systemui.customization.R
import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.plugins.clocks.ClockId
import com.android.systemui.plugins.clocks.ClockMessageBuffers
import com.android.systemui.plugins.clocks.ClockMetadata
import com.android.systemui.plugins.clocks.ClockProvider
import com.android.systemui.plugins.clocks.ClockSettings
@@ -35,6 +36,12 @@ class DefaultClockProvider(
    val hasStepClockAnimation: Boolean = false,
    val migratedClocks: Boolean = false
) : ClockProvider {
    private var messageBuffers: ClockMessageBuffers? = null

    override fun initialize(buffers: ClockMessageBuffers?) {
        messageBuffers = buffers
    }

    override fun getClocks(): List<ClockMetadata> = listOf(ClockMetadata(DEFAULT_CLOCK_ID))

    override fun createClock(settings: ClockSettings): ClockController {
@@ -49,6 +56,7 @@ class DefaultClockProvider(
            settings,
            hasStepClockAnimation,
            migratedClocks,
            messageBuffers,
        )
    }

+76 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading