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 package com.android.systemui.shade
17 
18 import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor
19 import com.android.systemui.shade.domain.interactor.ShadeBackActionInteractor
20 import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractor
21 import com.android.systemui.statusbar.GestureRecorder
22 import com.android.systemui.statusbar.phone.CentralSurfaces
23 import com.android.systemui.statusbar.policy.HeadsUpManager
24 
25 /**
26  * Allows CentralSurfacesImpl to interact with the shade. Only CentralSurfacesImpl should reference
27  * this class. If any method in this class is needed outside of CentralSurfacesImpl, it must be
28  * pulled up into ShadeViewController.
29  */
30 interface ShadeSurface :
31     ShadeViewController,
32     ShadeBackActionInteractor,
33     ShadeLockscreenInteractor,
34     PanelExpansionInteractor {
35     /** Initialize objects instead of injecting to avoid circular dependencies. */
initDependenciesnull36     fun initDependencies(
37         centralSurfaces: CentralSurfaces,
38         recorder: GestureRecorder,
39         hideExpandedRunnable: Runnable,
40         headsUpManager: HeadsUpManager
41     )
42 
43     /** Cancels any pending collapses. */
44     fun cancelPendingCollapse()
45 
46     /** Cancels the views current animation. */
47     fun cancelAnimation()
48 
49     /** Animates the view from its current alpha to zero then runs the runnable. */
50     fun fadeOut(startDelayMs: Long, durationMs: Long, endAction: Runnable)
51 
52     /** Set whether the bouncer is showing. */
53     fun setBouncerShowing(bouncerShowing: Boolean)
54 
55     /**
56      * Sets whether the shade can handle touches and/or animate, canceling any touch handling or
57      * animations in progress.
58      */
59     fun setTouchAndAnimationDisabled(disabled: Boolean)
60 
61     /**
62      * Notify us that {@link NotificationWakeUpCoordinator} is going to play the doze wakeup
63      * animation after a delay. If so, we'll keep the clock centered until that animation starts.
64      */
65     fun setWillPlayDelayedDozeAmountAnimation(willPlay: Boolean)
66 
67     /**
68      * Sets the dozing state.
69      *
70      * @param dozing `true` when dozing.
71      * @param animate if transition should be animated.
72      */
73     fun setDozing(dozing: Boolean, animate: Boolean)
74 
75     /** @see view.setImportantForAccessibility */
76     fun setImportantForAccessibility(mode: Int)
77 
78     /** Sets the view's X translation to zero. */
79     fun resetTranslation()
80 
81     /** Sets the view's alpha to max. */
82     fun resetAlpha()
83 
84     /** @see com.android.systemui.keyguard.ScreenLifecycle.Observer.onScreenTurningOn */
85     fun onScreenTurningOn()
86 
87     /**
88      * Called when the device's theme changes.
89      *
90      * TODO(b/274655539) delete?
91      */
92     fun onThemeChanged()
93 
94     /** Updates the shade expansion and [NotificationPanelView] visibility if necessary. */
95     fun updateExpansionAndVisibility()
96 
97     /** Updates all field values drawn from Resources. */
98     fun updateResources()
99 }
100