• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     /** True if the clock is large frame clock, which will use weather in compose. */
34     val useCustomClockScene: Boolean = false,
35 )
36 
37 /** Render configuration options for a specific clock face. */
38 data class ClockFaceConfig(
39     /** Expected interval between calls to onTimeTick. Can always reduce to PER_MINUTE in AOD. */
40     val tickRate: ClockTickRate = ClockTickRate.PER_MINUTE,
41 
42     /** Call to check whether the clock consumes weather data */
43     val hasCustomWeatherDataDisplay: Boolean = false,
44 
45     /**
46      * Whether this clock has a custom position update animation. If true, the keyguard will call
47      * `onPositionUpdated` to notify the clock of a position update animation. If false, a default
48      * animation will be used (e.g. a simple translation).
49      */
50     val hasCustomPositionUpdatedAnimation: Boolean = false,
51 
52     /** True if the clock is large frame clock, which will use weatherBlueprint in compose. */
53     val useCustomClockScene: Boolean = false,
54 )
55 
56 /** Tick rates for clocks */
57 enum class ClockTickRate(val value: Int) {
58     PER_MINUTE(2), // Update the clock once per minute.
59     PER_SECOND(1), // Update the clock once per second.
60     PER_FRAME(0), // Update the clock every second.
61 }
62