1 /*
2  * Copyright (C) 2024 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 @file:OptIn(ExperimentalCoroutinesApi::class)
18 
19 package com.android.systemui.shade.domain.interactor
20 
21 import com.android.systemui.dagger.SysUISingleton
22 import kotlinx.coroutines.ExperimentalCoroutinesApi
23 import kotlinx.coroutines.flow.Flow
24 
25 /**
26  * Expansion-related methods used throughout SysUI before the addition of the scene container as the
27  * top layer component. This interface exists to allow the scene container to fulfil
28  * NotificationPanelViewController's contracts with the rest of SysUI. Once the scene container is
29  * the only shade implementation in SysUI, the remaining implementation of this should be deleted
30  * after inlining all of its method bodies. No new calls to any of these methods should be added.
31  */
32 @SysUISingleton
33 @Deprecated("Use ShadeInteractor instead.")
34 interface PanelExpansionInteractor {
35     /**
36      * The amount by which the "panel" has been expanded (`0` when fully collapsed, `1` when fully
37      * expanded).
38      *
39      * This is a legacy concept from the time when the "panel" included the notification/QS shades
40      * as well as the keyguard (lockscreen and bouncer). This value is meant only for
41      * backwards-compatibility and should not be consumed by newer code.
42      */
43     @Deprecated("Use SceneInteractor.currentScene instead.") val legacyPanelExpansion: Flow<Float>
44 
45     /**
46      * Returns whether the shade height is greater than zero or the shade is expecting a synthesized
47      * down event.
48      */
49     @Deprecated("Use ShadeInteractor.isAnyExpanded instead.") val isPanelExpanded: Boolean
50 
51     /**
52      * This method should not be used anymore, you should probably use [.isShadeFullyOpen] instead.
53      * It was overused as indicating if shade is open or we're on keyguard/AOD. Moving forward we
54      * should be explicit about the what state we're checking.
55      *
56      * @return if panel is covering the screen, which means we're in expanded shade or keyguard/AOD
57      */
58     @Deprecated(
59         "depends on the state you check, use {@link #isShadeFullyExpanded()},\n" +
60             "{@link #isOnAod()}, {@link #isOnKeyguard()} instead."
61     )
62     val isFullyExpanded: Boolean
63 
64     /** Returns whether shade's height is zero. */
65     @Deprecated("Use !ShadeInteractor.isAnyExpanded instead") val isFullyCollapsed: Boolean
66 
67     /** Returns whether the shade is in the process of collapsing. */
68     @Deprecated("Use ShadeAnimationInteractor instead") val isCollapsing: Boolean
69 
70     /** Returns whether the shade is tracking touches for expand/collapse of the shade or QS. */
71     @Deprecated("Use sceneInteractor.isTransitionUserInputOngoing instead") val isTracking: Boolean
72 
73     /** Returns the StatusBarState. Note: System UI was formerly known simply as Status Bar. */
74     @Deprecated("Use SceneInteractor or ShadeInteractor instead") val barState: Int
75 
76     /** Returns whether status bar icons should be hidden when the shade is expanded. */
77     @Deprecated("No longer supported. Do not add new calls to this.")
shouldHideStatusBarIconsWhenExpandednull78     fun shouldHideStatusBarIconsWhenExpanded(): Boolean
79 }
80