xref: /aosp_15_r20/frameworks/base/packages/SystemUI/plugin/src/com/android/systemui/plugins/clocks/ClockConfig.kt (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the
10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11  * KIND, either express or implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */
14 package com.android.systemui.plugins.clocks
15 
16 /**
17  * Exposes the rendering capabilities of this clock to SystemUI so that it can be hosted and render
18  * correctly in SystemUI's process. Ideally all clocks could be rendered identically, but in
19  * practice we different clocks require different behavior from SystemUI.
20  */
21 data class ClockConfig(
22     val id: ClockId,
23 
24     /** Localized name of the clock */
25     val name: String,
26 
27     /** Localized accessibility description for the clock */
28     val description: String,
29 
30     /** Transition to AOD should move smartspace like large clock instead of small clock */
31     val useAlternateSmartspaceAODTransition: Boolean = false,
32 
33     /** Deprecated version of isReactiveToTone; moved to ClockPickerConfig */
34     @Deprecated("TODO(b/352049256): Remove in favor of ClockPickerConfig.isReactiveToTone")
35     val isReactiveToTone: Boolean = true,
36 
37     /** True if the clock is large frame clock, which will use weather in compose. */
38     val useCustomClockScene: Boolean = false,
39 )
40 
41 /** Render configuration options for a specific clock face. */
42 data class ClockFaceConfig(
43     /** Expected interval between calls to onTimeTick. Can always reduce to PER_MINUTE in AOD. */
44     val tickRate: ClockTickRate = ClockTickRate.PER_MINUTE,
45 
46     /** Call to check whether the clock consumes weather data */
47     val hasCustomWeatherDataDisplay: Boolean = false,
48 
49     /**
50      * Whether this clock has a custom position update animation. If true, the keyguard will call
51      * `onPositionUpdated` to notify the clock of a position update animation. If false, a default
52      * animation will be used (e.g. a simple translation).
53      */
54     val hasCustomPositionUpdatedAnimation: Boolean = false,
55 
56     /** True if the clock is large frame clock, which will use weatherBlueprint in compose. */
57     val useCustomClockScene: Boolean = false,
58 )
59 
60 /** Tick rates for clocks */
61 enum class ClockTickRate(val value: Int) {
62     PER_MINUTE(2), // Update the clock once per minute.
63     PER_SECOND(1), // Update the clock once per second.
64     PER_FRAME(0), // Update the clock every second.
65 }
66