• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.systemui.shade
18 
19 import android.view.MotionEvent
20 import android.view.ViewGroup
21 import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor
22 import com.android.systemui.shade.domain.interactor.ShadeBackActionInteractor
23 import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractor
24 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
25 import com.android.systemui.statusbar.phone.HeadsUpAppearanceController
26 import java.util.function.Consumer
27 import javax.inject.Inject
28 import kotlinx.coroutines.flow.MutableStateFlow
29 import kotlinx.coroutines.flow.flowOf
30 
31 /** Empty implementation of ShadeViewController for variants with no shade. */
32 open class ShadeViewControllerEmptyImpl @Inject constructor() :
33     ShadeViewController,
34     ShadeBackActionInteractor,
35     ShadeLockscreenInteractor,
36     PanelExpansionInteractor {
expandToNotificationsnull37     @Deprecated("Use ShadeInteractor instead") override fun expandToNotifications() {}
38     @Deprecated("Use ShadeInteractor instead") override val isExpanded: Boolean = false
39     override val isPanelExpanded: Boolean = false
animateCollapseQsnull40     override fun animateCollapseQs(fullyCollapse: Boolean) {}
canBeCollapsednull41     override fun canBeCollapsed(): Boolean = false
42     @Deprecated("Use ShadeAnimationInteractor instead") override val isCollapsing: Boolean = false
43     @Deprecated("Use !ShadeInteractor.isAnyExpanded instead")
44     override val isFullyCollapsed: Boolean = false
45     override val isTracking: Boolean = false
46     override val isViewEnabled: Boolean = false
47     override fun shouldHideStatusBarIconsWhenExpanded() = false
48     @Deprecated("Not supported by scenes") override fun blockExpansionForCurrentTouch() {}
startExpandLatencyTrackingnull49     override fun startExpandLatencyTracking() {}
startBouncerPreHideAnimationnull50     override fun startBouncerPreHideAnimation() {}
dozeTimeTicknull51     override fun dozeTimeTick() {}
resetViewsnull52     override fun resetViews(animate: Boolean) {}
53     override val barState: Int = 0
54     @Deprecated("Only supported by very old devices that will not adopt scenes.")
closeUserSwitcherIfOpennull55     override fun closeUserSwitcherIfOpen(): Boolean {
56         return false
57     }
onBackPressednull58     override fun onBackPressed() {}
59     @Deprecated("According to b/318376223, shade predictive back is not be supported.")
onBackProgressednull60     override fun onBackProgressed(progressFraction: Float) {}
setAlphanull61     override fun setAlpha(alpha: Int, animate: Boolean) {}
setAlphaChangeAnimationEndActionnull62     override fun setAlphaChangeAnimationEndAction(r: Runnable) {}
setPulsingnull63     @Deprecated("Not supported by scenes") override fun setPulsing(pulsing: Boolean) {}
setQsScrimEnablednull64     override fun setQsScrimEnabled(qsScrimEnabled: Boolean) {}
setAmbientIndicationTopnull65     override fun setAmbientIndicationTop(ambientIndicationTop: Int, ambientTextVisible: Boolean) {}
updateSystemUiStateFlagsnull66     override fun updateSystemUiStateFlags() {}
updateTouchableRegionnull67     override fun updateTouchableRegion() {}
transitionToExpandedShadenull68     override fun transitionToExpandedShade(delay: Long) {}
69 
resetViewGroupFadenull70     @Deprecated("Not supported by scenes") override fun resetViewGroupFade() {}
71     @Deprecated("Not supported by scenes")
setKeyguardTransitionProgressnull72     override fun setKeyguardTransitionProgress(keyguardAlpha: Float, keyguardTranslationY: Int) {}
setOverStretchAmountnull73     @Deprecated("Not supported by scenes") override fun setOverStretchAmount(amount: Float) {}
74     @Deprecated("TODO(b/325072511) delete this")
setKeyguardStatusBarAlphanull75     override fun setKeyguardStatusBarAlpha(alpha: Float) {}
showAodUinull76     override fun showAodUi() {}
77     @Deprecated(
78         "depends on the state you check, use {@link #isShadeFullyExpanded()},\n" +
79             "{@link #isOnAod()}, {@link #isOnKeyguard()} instead."
80     )
81     override val isFullyExpanded = false
handleExternalTouchnull82     override fun handleExternalTouch(event: MotionEvent): Boolean {
83         return false
84     }
handleExternalInterceptTouchnull85     override fun handleExternalInterceptTouch(event: MotionEvent): Boolean {
86         return false
87     }
88 
startInputFocusTransfernull89     override fun startInputFocusTransfer() {}
cancelInputFocusTransfernull90     override fun cancelInputFocusTransfer() {}
finishInputFocusTransfernull91     override fun finishInputFocusTransfer(velocity: Float) {}
92     override val shadeHeadsUpTracker = ShadeHeadsUpTrackerEmptyImpl()
93     override val shadeFoldAnimator = ShadeFoldAnimatorEmptyImpl()
94     @Deprecated("Use SceneInteractor.currentScene instead.")
95     override val legacyPanelExpansion = flowOf(0f)
96     override val udfpsTransitionToFullShadeProgress = MutableStateFlow(0f)
97 }
98 
99 class ShadeHeadsUpTrackerEmptyImpl : ShadeHeadsUpTracker {
addTrackingHeadsUpListenernull100     override fun addTrackingHeadsUpListener(listener: Consumer<ExpandableNotificationRow>) {}
removeTrackingHeadsUpListenernull101     override fun removeTrackingHeadsUpListener(listener: Consumer<ExpandableNotificationRow>) {}
setHeadsUpAppearanceControllernull102     override fun setHeadsUpAppearanceController(
103         headsUpAppearanceController: HeadsUpAppearanceController?
104     ) {}
105     override val trackedHeadsUpNotification: ExpandableNotificationRow? = null
106 }
107 
108 class ShadeFoldAnimatorEmptyImpl : ShadeFoldAnimator {
prepareFoldToAodAnimationnull109     override fun prepareFoldToAodAnimation() {}
startFoldToAodAnimationnull110     override fun startFoldToAodAnimation(
111         startAction: Runnable,
112         endAction: Runnable,
113         cancelAction: Runnable,
114     ) {}
cancelFoldToAodAnimationnull115     override fun cancelFoldToAodAnimation() {}
116     override val view: ViewGroup? = null
117 }
118