1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 package com.android.systemui.keyguard.ui.view.layout.blueprints
19 
20 import com.android.systemui.communal.ui.view.layout.sections.CommunalTutorialIndicatorSection
21 import com.android.systemui.dagger.SysUISingleton
22 import com.android.systemui.keyguard.shared.model.KeyguardBlueprint
23 import com.android.systemui.keyguard.shared.model.KeyguardSection
24 import com.android.systemui.keyguard.ui.view.layout.sections.AccessibilityActionsSection
25 import com.android.systemui.keyguard.ui.view.layout.sections.AodBurnInSection
26 import com.android.systemui.keyguard.ui.view.layout.sections.AodNotificationIconsSection
27 import com.android.systemui.keyguard.ui.view.layout.sections.ClockSection
28 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultDeviceEntrySection
29 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultIndicationAreaSection
30 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultNotificationStackScrollLayoutSection
31 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultSettingsPopupMenuSection
32 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultShortcutsSection
33 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultStatusBarSection
34 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultStatusViewSection
35 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultUdfpsAccessibilityOverlaySection
36 import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule.Companion.KEYGUARD_AMBIENT_INDICATION_AREA_SECTION
37 import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSliceViewSection
38 import com.android.systemui.keyguard.ui.view.layout.sections.SmartspaceSection
39 import java.util.Optional
40 import javax.inject.Inject
41 import javax.inject.Named
42 import kotlin.jvm.optionals.getOrNull
43 import kotlinx.coroutines.ExperimentalCoroutinesApi
44 
45 /**
46  * Positions elements of the lockscreen to the default position.
47  *
48  * This will be the most common use case for phones in portrait mode.
49  */
50 @ExperimentalCoroutinesApi
51 @SysUISingleton
52 @JvmSuppressWildcards
53 class DefaultKeyguardBlueprint
54 @Inject
55 constructor(
56     accessibilityActionsSection: AccessibilityActionsSection,
57     defaultIndicationAreaSection: DefaultIndicationAreaSection,
58     defaultDeviceEntrySection: DefaultDeviceEntrySection,
59     defaultShortcutsSection: DefaultShortcutsSection,
60     @Named(KEYGUARD_AMBIENT_INDICATION_AREA_SECTION)
61     defaultAmbientIndicationAreaSection: Optional<KeyguardSection>,
62     defaultSettingsPopupMenuSection: DefaultSettingsPopupMenuSection,
63     defaultStatusViewSection: DefaultStatusViewSection,
64     defaultStatusBarSection: DefaultStatusBarSection,
65     defaultNotificationStackScrollLayoutSection: DefaultNotificationStackScrollLayoutSection,
66     aodNotificationIconsSection: AodNotificationIconsSection,
67     aodBurnInSection: AodBurnInSection,
68     communalTutorialIndicatorSection: CommunalTutorialIndicatorSection,
69     clockSection: ClockSection,
70     smartspaceSection: SmartspaceSection,
71     keyguardSliceViewSection: KeyguardSliceViewSection,
72     udfpsAccessibilityOverlaySection: DefaultUdfpsAccessibilityOverlaySection,
73 ) : KeyguardBlueprint {
74     override val id: String = DEFAULT
75 
76     override val sections =
77         listOfNotNull(
78             accessibilityActionsSection,
79             defaultIndicationAreaSection,
80             defaultShortcutsSection,
81             defaultAmbientIndicationAreaSection.getOrNull(),
82             defaultSettingsPopupMenuSection,
83             defaultStatusViewSection,
84             defaultStatusBarSection,
85             defaultNotificationStackScrollLayoutSection,
86             aodNotificationIconsSection,
87             smartspaceSection,
88             aodBurnInSection,
89             communalTutorialIndicatorSection,
90             clockSection,
91             keyguardSliceViewSection,
92             defaultDeviceEntrySection,
93             udfpsAccessibilityOverlaySection, // Add LAST: Intentionally has z-order above others
94         )
95 
96     companion object {
97         const val DEFAULT = "default"
98     }
99 }
100