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 androidx.constraintlayout.widget.ConstraintSet 21 import com.android.keyguard.KeyguardUpdateMonitor 22 import com.android.systemui.dagger.SysUISingleton 23 import com.android.systemui.keyguard.data.repository.KeyguardBlueprint 24 import com.android.systemui.keyguard.ui.view.layout.sections.AlignShortcutsToUdfpsSection 25 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultAmbientIndicationAreaSection 26 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultIndicationAreaSection 27 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultLockIconSection 28 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultSettingsPopupMenuSection 29 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultShortcutsSection 30 import com.android.systemui.keyguard.ui.view.layout.sections.DefaultStatusViewSection 31 import com.android.systemui.keyguard.ui.view.layout.sections.SplitShadeGuidelines 32 import javax.inject.Inject 33 34 /** Vertically aligns the shortcuts with the udfps. */ 35 @SysUISingleton 36 class ShortcutsBesideUdfpsKeyguardBlueprint 37 @Inject 38 constructor( 39 private val keyguardUpdateMonitor: KeyguardUpdateMonitor, 40 private val defaultIndicationAreaSection: DefaultIndicationAreaSection, 41 private val defaultLockIconSection: DefaultLockIconSection, 42 private val defaultAmbientIndicationAreaSection: DefaultAmbientIndicationAreaSection, 43 private val defaultSettingsPopupMenuSection: DefaultSettingsPopupMenuSection, 44 private val alignShortcutsToUdfpsSection: AlignShortcutsToUdfpsSection, 45 private val defaultShortcutsSection: DefaultShortcutsSection, 46 private val defaultStatusViewSection: DefaultStatusViewSection, 47 private val splitShadeGuidelines: SplitShadeGuidelines, 48 ) : KeyguardBlueprint { 49 override val id: String = SHORTCUTS_BESIDE_UDFPS 50 51 override fun apply(constraintSet: ConstraintSet) { 52 defaultIndicationAreaSection.apply(constraintSet) 53 defaultLockIconSection.apply(constraintSet) 54 defaultAmbientIndicationAreaSection.apply(constraintSet) 55 defaultSettingsPopupMenuSection.apply(constraintSet) 56 if (keyguardUpdateMonitor.isUdfpsSupported) { 57 alignShortcutsToUdfpsSection.apply(constraintSet) 58 } else { 59 defaultShortcutsSection.apply(constraintSet) 60 } 61 defaultStatusViewSection.apply(constraintSet) 62 splitShadeGuidelines.apply(constraintSet) 63 } 64 65 companion object { 66 const val SHORTCUTS_BESIDE_UDFPS = "shortcutsBesideUdfps" 67 } 68 } 69