• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.wm.shell.bubbles
18 
19 /** Manager interface for bubble expanded views. */
20 interface BubbleExpandedViewManager {
21 
22     val overflowBubbles: List<Bubble>
setOverflowListenernull23     fun setOverflowListener(listener: BubbleData.Listener)
24     fun collapseStack()
25     fun updateWindowFlagsForBackpress(intercept: Boolean)
26     fun promoteBubbleFromOverflow(bubble: Bubble)
27     fun removeBubble(key: String, reason: Int)
28     fun dismissBubble(bubble: Bubble, reason: Int)
29     fun setAppBubbleTaskId(key: String, taskId: Int)
30     fun isStackExpanded(): Boolean
31     fun isShowingAsBubbleBar(): Boolean
32     fun hideCurrentInputMethod()
33 
34     companion object {
35         /**
36          * Convenience function for creating a [BubbleExpandedViewManager] that delegates to the
37          * given `controller`.
38          */
39         @JvmStatic
40         fun fromBubbleController(controller: BubbleController): BubbleExpandedViewManager {
41             return object : BubbleExpandedViewManager {
42 
43                 override val overflowBubbles: List<Bubble>
44                     get() = controller.overflowBubbles
45 
46                 override fun setOverflowListener(listener: BubbleData.Listener) {
47                     controller.setOverflowListener(listener)
48                 }
49 
50                 override fun collapseStack() {
51                     controller.collapseStack()
52                 }
53 
54                 override fun updateWindowFlagsForBackpress(intercept: Boolean) {
55                     controller.updateWindowFlagsForBackpress(intercept)
56                 }
57 
58                 override fun promoteBubbleFromOverflow(bubble: Bubble) {
59                     controller.promoteBubbleFromOverflow(bubble)
60                 }
61 
62                 override fun removeBubble(key: String, reason: Int) {
63                     controller.removeBubble(key, reason)
64                 }
65 
66                 override fun dismissBubble(bubble: Bubble, reason: Int) {
67                     controller.dismissBubble(bubble, reason)
68                 }
69 
70                 override fun setAppBubbleTaskId(key: String, taskId: Int) {
71                     controller.setAppBubbleTaskId(key, taskId)
72                 }
73 
74                 override fun isStackExpanded(): Boolean = controller.isStackExpanded
75 
76                 override fun isShowingAsBubbleBar(): Boolean = controller.isShowingAsBubbleBar
77 
78                 override fun hideCurrentInputMethod() {
79                     controller.hideCurrentInputMethod()
80                 }
81             }
82         }
83     }
84 }
85