blob: 2d0944ad246f53a754e9f96ae64c63deb70f23b3 [file] [log] [blame]
Mady Mellorc3d6f7d2018-11-07 09:36:56 -08001/*
2 * Copyright (C) 2018 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
17package com.android.systemui.bubbles;
18
Mady Mellorc2ff0112019-03-28 14:18:06 -070019import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL;
20import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL_ALL;
21import static android.service.notification.NotificationListenerService.REASON_CANCEL;
22import static android.service.notification.NotificationListenerService.REASON_CANCEL_ALL;
Mady Mellor390bff42019-04-05 15:09:01 -070023import static android.view.Display.DEFAULT_DISPLAY;
24import static android.view.Display.INVALID_DISPLAY;
Mady Mellord1c78b262018-11-06 18:04:40 -080025import static android.view.View.INVISIBLE;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080026import static android.view.View.VISIBLE;
Joshua Tsujib1a796b2019-01-16 15:43:12 -080027import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080028
Mady Mellor3f2efdb2018-11-21 11:30:45 -080029import static com.android.systemui.statusbar.StatusBarState.SHADE;
Mady Mellor1a4e86f2019-05-03 16:07:23 -070030import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080031
Mark Renoufba5ab512019-05-02 15:21:01 -040032import static java.lang.annotation.ElementType.FIELD;
33import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
34import static java.lang.annotation.ElementType.PARAMETER;
Mark Renouf08bc42a2019-03-07 13:01:59 -050035import static java.lang.annotation.RetentionPolicy.SOURCE;
36
Mady Mellorb4991e62019-01-10 15:14:51 -080037import android.annotation.Nullable;
Mady Mellore80930e2019-03-21 16:00:45 -070038import android.app.ActivityManager;
Mark Renoufc808f062019-02-07 15:20:37 -050039import android.app.ActivityManager.RunningTaskInfo;
Mark Renoufcecc77b2019-01-30 16:32:24 -050040import android.app.ActivityTaskManager;
41import android.app.IActivityTaskManager;
Mady Mellor5549dd22018-11-06 18:07:34 -080042import android.app.Notification;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080043import android.content.Context;
Joshua Tsujia19515f2019-02-13 18:02:29 -050044import android.content.pm.ParceledListSlice;
Joshua Tsujif418f9e2019-04-04 17:09:53 -040045import android.content.res.Configuration;
Mady Mellord1c78b262018-11-06 18:04:40 -080046import android.graphics.Rect;
Mark Renoufcecc77b2019-01-30 16:32:24 -050047import android.os.RemoteException;
Mady Mellorb4991e62019-01-10 15:14:51 -080048import android.os.ServiceManager;
Mady Mellorceced172018-11-27 11:18:39 -080049import android.provider.Settings;
Mady Mellor5549dd22018-11-06 18:07:34 -080050import android.service.notification.StatusBarNotification;
Mark Renouf9ba6cea2019-04-17 11:53:50 -040051import android.util.Log;
Mark Renoufcecc77b2019-01-30 16:32:24 -050052import android.view.Display;
Joshua Tsujia19515f2019-02-13 18:02:29 -050053import android.view.IPinnedStackController;
54import android.view.IPinnedStackListener;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080055import android.view.ViewGroup;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080056import android.widget.FrameLayout;
57
Mark Renouf08bc42a2019-03-07 13:01:59 -050058import androidx.annotation.IntDef;
Mark Renouf658c6bc2019-01-30 10:26:54 -050059import androidx.annotation.MainThread;
60
Mady Mellorebdbbb92018-11-15 14:36:48 -080061import com.android.internal.annotations.VisibleForTesting;
Mady Mellora54e9fa2019-04-18 13:26:18 -070062import com.android.internal.statusbar.IStatusBarService;
Ned Burns01e38212019-01-03 16:32:52 -050063import com.android.systemui.Dependency;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080064import com.android.systemui.R;
Beverly8fdb5332019-02-04 14:29:49 -050065import com.android.systemui.plugins.statusbar.StatusBarStateController;
Mark Renoufcecc77b2019-01-30 16:32:24 -050066import com.android.systemui.shared.system.ActivityManagerWrapper;
67import com.android.systemui.shared.system.TaskStackChangeListener;
Joshua Tsujia19515f2019-02-13 18:02:29 -050068import com.android.systemui.shared.system.WindowManagerWrapper;
Mady Mellorc2ff0112019-03-28 14:18:06 -070069import com.android.systemui.statusbar.NotificationRemoveInterceptor;
Ned Burns01e38212019-01-03 16:32:52 -050070import com.android.systemui.statusbar.notification.NotificationEntryListener;
71import com.android.systemui.statusbar.notification.NotificationEntryManager;
Mady Mellor3f2efdb2018-11-21 11:30:45 -080072import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
Ned Burnsf81c4c42019-01-07 14:10:43 -050073import com.android.systemui.statusbar.notification.collection.NotificationEntry;
Ned Burns1a5e22f2019-02-14 15:11:52 -050074import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080075import com.android.systemui.statusbar.phone.StatusBarWindowController;
Lyn Hanf1c9b8b2019-03-14 16:49:48 -070076import com.android.systemui.statusbar.policy.ConfigurationController;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080077
Mark Renouf08bc42a2019-03-07 13:01:59 -050078import java.lang.annotation.Retention;
Mark Renoufba5ab512019-05-02 15:21:01 -040079import java.lang.annotation.Target;
Mady Mellore80930e2019-03-21 16:00:45 -070080import java.util.List;
Mark Renouf08bc42a2019-03-07 13:01:59 -050081
Jason Monk27d01a622018-12-10 15:57:09 -050082import javax.inject.Inject;
83import javax.inject.Singleton;
84
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080085/**
86 * Bubbles are a special type of content that can "float" on top of other apps or System UI.
87 * Bubbles can be expanded to show more content.
88 *
89 * The controller manages addition, removal, and visible state of bubbles on screen.
90 */
Jason Monk27d01a622018-12-10 15:57:09 -050091@Singleton
Mark Renouf71a3af62019-04-08 15:02:54 -040092public class BubbleController implements ConfigurationController.ConfigurationListener {
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080093
94 private static final String TAG = "BubbleController";
Mark Renoufba5ab512019-05-02 15:21:01 -040095 private static final boolean DEBUG = false;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -080096
Mark Renouf08bc42a2019-03-07 13:01:59 -050097 @Retention(SOURCE)
98 @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED,
Mady Melloraa8fef22019-04-11 13:36:40 -070099 DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION, DISMISS_NO_LONGER_BUBBLE})
Mark Renoufba5ab512019-05-02 15:21:01 -0400100 @Target({FIELD, LOCAL_VARIABLE, PARAMETER})
Mark Renouf08bc42a2019-03-07 13:01:59 -0500101 @interface DismissReason {}
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700102
Mark Renouf08bc42a2019-03-07 13:01:59 -0500103 static final int DISMISS_USER_GESTURE = 1;
104 static final int DISMISS_AGED = 2;
105 static final int DISMISS_TASK_FINISHED = 3;
106 static final int DISMISS_BLOCKED = 4;
107 static final int DISMISS_NOTIF_CANCEL = 5;
108 static final int DISMISS_ACCESSIBILITY_ACTION = 6;
Mady Melloraa8fef22019-04-11 13:36:40 -0700109 static final int DISMISS_NO_LONGER_BUBBLE = 7;
Mark Renouf08bc42a2019-03-07 13:01:59 -0500110
Joshua Tsuji25a4b7b2019-03-22 14:11:06 -0400111 static final int MAX_BUBBLES = 5; // TODO: actually enforce this
112
Mady Mellor5549dd22018-11-06 18:07:34 -0800113 // Enables some subset of notifs to automatically become bubbles
Ned Burns01e38212019-01-03 16:32:52 -0500114 private static final boolean DEBUG_ENABLE_AUTO_BUBBLE = false;
Mady Mellor5549dd22018-11-06 18:07:34 -0800115
Mady Mellor44ee2fe2019-01-30 17:51:16 -0800116 /** Flag to enable or disable the entire feature */
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800117 private static final String ENABLE_BUBBLES = "experiment_enable_bubbles";
Mady Mellor44ee2fe2019-01-30 17:51:16 -0800118 /** Auto bubble flags set whether different notif types should be presented as a bubble */
Mady Mellorceced172018-11-27 11:18:39 -0800119 private static final String ENABLE_AUTO_BUBBLE_MESSAGES = "experiment_autobubble_messaging";
120 private static final String ENABLE_AUTO_BUBBLE_ONGOING = "experiment_autobubble_ongoing";
121 private static final String ENABLE_AUTO_BUBBLE_ALL = "experiment_autobubble_all";
Mady Mellor44ee2fe2019-01-30 17:51:16 -0800122
123 /** Use an activityView for an auto-bubbled notifs if it has an appropriate content intent */
Mark Renouf89b1a4a2018-12-04 14:59:45 -0500124 private static final String ENABLE_BUBBLE_CONTENT_INTENT = "experiment_bubble_content_intent";
Mady Mellorceced172018-11-27 11:18:39 -0800125
Joshua Tsuji010c2b12019-02-25 18:11:25 -0500126 private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness";
127 private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness";
128
Ned Burns01e38212019-01-03 16:32:52 -0500129 private final Context mContext;
130 private final NotificationEntryManager mNotificationEntryManager;
Mark Renoufcecc77b2019-01-30 16:32:24 -0500131 private final IActivityTaskManager mActivityTaskManager;
132 private final BubbleTaskStackListener mTaskStackListener;
Mady Mellord1c78b262018-11-06 18:04:40 -0800133 private BubbleStateChangeListener mStateChangeListener;
Mady Mellorcd9b1302018-11-06 18:08:04 -0800134 private BubbleExpandListener mExpandListener;
Issei Suzukic0387542019-03-08 17:31:14 +0100135 @Nullable private BubbleStackView.SurfaceSynchronizer mSurfaceSynchronizer;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800136
Mady Mellor3dff9e62019-02-05 18:12:53 -0800137 private BubbleData mBubbleData;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800138 private BubbleStackView mStackView;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800139
140 // Bubbles get added to the status bar view
Ned Burns01e38212019-01-03 16:32:52 -0500141 private final StatusBarWindowController mStatusBarWindowController;
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800142 private StatusBarStateListener mStatusBarStateListener;
143
Mady Melloraa8fef22019-04-11 13:36:40 -0700144 private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider;
Mady Mellora54e9fa2019-04-18 13:26:18 -0700145 private IStatusBarService mBarService;
Mady Mellorb4991e62019-01-10 15:14:51 -0800146
Mady Mellord1c78b262018-11-06 18:04:40 -0800147 // Used for determining view rect for touch interaction
148 private Rect mTempRect = new Rect();
149
Joshua Tsujif418f9e2019-04-04 17:09:53 -0400150 /** Last known orientation, used to detect orientation changes in {@link #onConfigChanged}. */
151 private int mOrientation = Configuration.ORIENTATION_UNDEFINED;
152
Mady Mellor5549dd22018-11-06 18:07:34 -0800153 /**
Mady Mellord1c78b262018-11-06 18:04:40 -0800154 * Listener to be notified when some states of the bubbles change.
155 */
156 public interface BubbleStateChangeListener {
157 /**
158 * Called when the stack has bubbles or no longer has bubbles.
159 */
160 void onHasBubblesChanged(boolean hasBubbles);
161 }
162
Mady Mellorcd9b1302018-11-06 18:08:04 -0800163 /**
164 * Listener to find out about stack expansion / collapse events.
165 */
166 public interface BubbleExpandListener {
167 /**
168 * Called when the expansion state of the bubble stack changes.
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700169 *
Mady Mellorcd9b1302018-11-06 18:08:04 -0800170 * @param isExpanding whether it's expanding or collapsing
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800171 * @param key the notification key associated with bubble being expanded
Mady Mellorcd9b1302018-11-06 18:08:04 -0800172 */
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800173 void onBubbleExpandChanged(boolean isExpanding, String key);
174 }
175
176 /**
177 * Listens for the current state of the status bar and updates the visibility state
178 * of bubbles as needed.
179 */
180 private class StatusBarStateListener implements StatusBarStateController.StateListener {
181 private int mState;
182 /**
183 * Returns the current status bar state.
184 */
185 public int getCurrentState() {
186 return mState;
187 }
188
189 @Override
190 public void onStateChanged(int newState) {
191 mState = newState;
Mark Renouf71a3af62019-04-08 15:02:54 -0400192 boolean shouldCollapse = (mState != SHADE);
193 if (shouldCollapse) {
194 collapseStack();
195 }
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800196 updateVisibility();
197 }
Mady Mellorcd9b1302018-11-06 18:08:04 -0800198 }
199
Jason Monk27d01a622018-12-10 15:57:09 -0500200 @Inject
Mady Mellorcfd06c12019-02-13 14:32:12 -0800201 public BubbleController(Context context, StatusBarWindowController statusBarWindowController,
Mady Melloraa8fef22019-04-11 13:36:40 -0700202 BubbleData data, ConfigurationController configurationController,
203 NotificationInterruptionStateProvider interruptionStateProvider) {
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700204 this(context, statusBarWindowController, data, null /* synchronizer */,
Mady Melloraa8fef22019-04-11 13:36:40 -0700205 configurationController, interruptionStateProvider);
Issei Suzukic0387542019-03-08 17:31:14 +0100206 }
207
208 public BubbleController(Context context, StatusBarWindowController statusBarWindowController,
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700209 BubbleData data, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer,
Mady Melloraa8fef22019-04-11 13:36:40 -0700210 ConfigurationController configurationController,
211 NotificationInterruptionStateProvider interruptionStateProvider) {
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800212 mContext = context;
Mady Melloraa8fef22019-04-11 13:36:40 -0700213 mNotificationInterruptionStateProvider = interruptionStateProvider;
214
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700215 configurationController.addCallback(this /* configurationListener */);
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800216
Mark Renouf9ba6cea2019-04-17 11:53:50 -0400217 mBubbleData = data;
218 mBubbleData.setListener(mBubbleDataListener);
219
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800220 mNotificationEntryManager = Dependency.get(NotificationEntryManager.class);
Ned Burns01e38212019-01-03 16:32:52 -0500221 mNotificationEntryManager.addNotificationEntryListener(mEntryListener);
Mady Mellorc2ff0112019-03-28 14:18:06 -0700222 mNotificationEntryManager.setNotificationRemoveInterceptor(mRemoveInterceptor);
Mady Mellorb4991e62019-01-10 15:14:51 -0800223
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800224 mStatusBarWindowController = statusBarWindowController;
225 mStatusBarStateListener = new StatusBarStateListener();
226 Dependency.get(StatusBarStateController.class).addCallback(mStatusBarStateListener);
Mark Renoufcecc77b2019-01-30 16:32:24 -0500227
228 mActivityTaskManager = ActivityTaskManager.getService();
229 mTaskStackListener = new BubbleTaskStackListener();
230 ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
Mady Mellor3dff9e62019-02-05 18:12:53 -0800231
Joshua Tsujia19515f2019-02-13 18:02:29 -0500232 try {
233 WindowManagerWrapper.getInstance().addPinnedStackListener(new BubblesImeListener());
234 } catch (RemoteException e) {
235 e.printStackTrace();
236 }
Issei Suzukic0387542019-03-08 17:31:14 +0100237 mSurfaceSynchronizer = synchronizer;
Mady Mellora54e9fa2019-04-18 13:26:18 -0700238
239 mBarService = IStatusBarService.Stub.asInterface(
240 ServiceManager.getService(Context.STATUS_BAR_SERVICE));
Mady Mellor5549dd22018-11-06 18:07:34 -0800241 }
242
Mark Renouf8b6a3c62019-04-09 10:17:40 -0400243 /**
244 * BubbleStackView is lazily created by this method the first time a Bubble is added. This
245 * method initializes the stack view and adds it to the StatusBar just above the scrim.
246 */
247 private void ensureStackViewCreated() {
248 if (mStackView == null) {
249 mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
250 ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
251 // TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no
252 // scrim between bubble and the shade
253 int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1;
254 sbv.addView(mStackView, bubblePosition,
255 new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
256 if (mExpandListener != null) {
257 mStackView.setExpandListener(mExpandListener);
258 }
Mark Renouf8b6a3c62019-04-09 10:17:40 -0400259 }
260 }
261
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700262 @Override
263 public void onUiModeChanged() {
264 if (mStackView != null) {
Lyn Han02cca812019-04-02 16:27:32 -0700265 mStackView.onThemeChanged();
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700266 }
267 }
268
269 @Override
270 public void onOverlayChanged() {
271 if (mStackView != null) {
Lyn Han02cca812019-04-02 16:27:32 -0700272 mStackView.onThemeChanged();
Lyn Hanf1c9b8b2019-03-14 16:49:48 -0700273 }
274 }
275
Joshua Tsujif418f9e2019-04-04 17:09:53 -0400276 @Override
277 public void onConfigChanged(Configuration newConfig) {
278 if (mStackView != null && newConfig != null && newConfig.orientation != mOrientation) {
279 mStackView.onOrientationChanged();
280 mOrientation = newConfig.orientation;
281 }
282 }
283
Mady Mellor5549dd22018-11-06 18:07:34 -0800284 /**
Mady Mellord1c78b262018-11-06 18:04:40 -0800285 * Set a listener to be notified when some states of the bubbles change.
286 */
287 public void setBubbleStateChangeListener(BubbleStateChangeListener listener) {
288 mStateChangeListener = listener;
289 }
290
291 /**
Mady Mellorcd9b1302018-11-06 18:08:04 -0800292 * Set a listener to be notified of bubble expand events.
293 */
294 public void setExpandListener(BubbleExpandListener listener) {
Issei Suzukiac9fcb72019-02-04 17:45:57 +0100295 mExpandListener = ((isExpanding, key) -> {
296 if (listener != null) {
297 listener.onBubbleExpandChanged(isExpanding, key);
298 }
299 mStatusBarWindowController.setBubbleExpanded(isExpanding);
300 });
Mady Mellorcd9b1302018-11-06 18:08:04 -0800301 if (mStackView != null) {
302 mStackView.setExpandListener(mExpandListener);
303 }
304 }
305
306 /**
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800307 * Whether or not there are bubbles present, regardless of them being visible on the
308 * screen (e.g. if on AOD).
309 */
310 public boolean hasBubbles() {
Mady Mellor3dff9e62019-02-05 18:12:53 -0800311 if (mStackView == null) {
312 return false;
313 }
Mark Renouf71a3af62019-04-08 15:02:54 -0400314 return mBubbleData.hasBubbles();
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800315 }
316
317 /**
318 * Whether the stack of bubbles is expanded or not.
319 */
320 public boolean isStackExpanded() {
Mark Renouf71a3af62019-04-08 15:02:54 -0400321 return mBubbleData.isExpanded();
322 }
323
324 /**
325 * Tell the stack of bubbles to expand.
326 */
327 public void expandStack() {
328 mBubbleData.setExpanded(true);
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800329 }
330
331 /**
332 * Tell the stack of bubbles to collapse.
333 */
334 public void collapseStack() {
Mark Renouf71a3af62019-04-08 15:02:54 -0400335 mBubbleData.setExpanded(false /* expanded */);
336 }
337
338 void selectBubble(Bubble bubble) {
339 mBubbleData.setSelectedBubble(bubble);
340 }
341
342 @VisibleForTesting
343 void selectBubble(String key) {
344 Bubble bubble = mBubbleData.getBubbleWithKey(key);
345 selectBubble(bubble);
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800346 }
347
348 /**
Mark Renouffec45da2019-03-13 13:24:27 -0400349 * Request the stack expand if needed, then select the specified Bubble as current.
350 *
351 * @param notificationKey the notification key for the bubble to be selected
352 */
353 public void expandStackAndSelectBubble(String notificationKey) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400354 Bubble bubble = mBubbleData.getBubbleWithKey(notificationKey);
355 if (bubble != null) {
356 mBubbleData.setSelectedBubble(bubble);
357 mBubbleData.setExpanded(true);
Mark Renouffec45da2019-03-13 13:24:27 -0400358 }
359 }
360
361 /**
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800362 * Tell the stack of bubbles to be dismissed, this will remove all of the bubbles in the stack.
363 */
Mark Renouf08bc42a2019-03-07 13:01:59 -0500364 void dismissStack(@DismissReason int reason) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400365 mBubbleData.dismissAll(reason);
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800366 }
367
368 /**
Mark Renouf041d7262019-02-06 12:09:41 -0500369 * Directs a back gesture at the bubble stack. When opened, the current expanded bubble
370 * is forwarded a back key down/up pair.
371 */
372 public void performBackPressIfNeeded() {
373 if (mStackView != null) {
374 mStackView.performBackPressIfNeeded();
375 }
376 }
377
378 /**
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800379 * Adds or updates a bubble associated with the provided notification entry.
380 *
Mark Renouf8b6a3c62019-04-09 10:17:40 -0400381 * @param notif the notification associated with this bubble.
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800382 */
Mark Renouff97ed462019-04-05 13:46:24 -0400383 void updateBubble(NotificationEntry notif) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400384 mBubbleData.notificationEntryUpdated(notif);
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800385 }
386
387 /**
388 * Removes the bubble associated with the {@param uri}.
Mark Renouf658c6bc2019-01-30 10:26:54 -0500389 * <p>
390 * Must be called from the main thread.
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800391 */
Mark Renouf658c6bc2019-01-30 10:26:54 -0500392 @MainThread
Mark Renouf08bc42a2019-03-07 13:01:59 -0500393 void removeBubble(String key, int reason) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400394 // TEMP: refactor to change this to pass entry
395 Bubble bubble = mBubbleData.getBubbleWithKey(key);
396 if (bubble != null) {
397 mBubbleData.notificationEntryRemoved(bubble.entry, reason);
Mady Mellore8e07712019-01-23 12:45:33 -0800398 }
399 }
400
Ned Burns01e38212019-01-03 16:32:52 -0500401 @SuppressWarnings("FieldCanBeLocal")
Mady Mellorc2ff0112019-03-28 14:18:06 -0700402 private final NotificationRemoveInterceptor mRemoveInterceptor =
403 new NotificationRemoveInterceptor() {
404 @Override
405 public boolean onNotificationRemoveRequested(String key, int reason) {
406 if (!mBubbleData.hasBubbleWithKey(key)) {
407 return false;
408 }
409 NotificationEntry entry = mBubbleData.getBubbleWithKey(key).entry;
410
411 final boolean isClearAll = reason == REASON_CANCEL_ALL;
412 final boolean isUserDimiss = reason == REASON_CANCEL;
413 final boolean isAppCancel = reason == REASON_APP_CANCEL
414 || reason == REASON_APP_CANCEL_ALL;
415
416 // Need to check for !appCancel here because the notification may have
417 // previously been dismissed & entry.isRowDismissed would still be true
418 boolean userRemovedNotif = (entry.isRowDismissed() && !isAppCancel)
419 || isClearAll || isUserDimiss;
420
421 // The bubble notification sticks around in the data as long as the bubble is
422 // not dismissed and the app hasn't cancelled the notification.
423 boolean bubbleExtended = entry.isBubble() && !entry.isBubbleDismissed()
424 && userRemovedNotif;
425 if (bubbleExtended) {
426 entry.setShowInShadeWhenBubble(false);
427 if (mStackView != null) {
428 mStackView.updateDotVisibility(entry.key);
429 }
430 mNotificationEntryManager.updateNotifications();
431 return true;
432 } else if (!userRemovedNotif && !entry.isBubbleDismissed()) {
433 // This wasn't a user removal so we should remove the bubble as well
434 mBubbleData.notificationEntryRemoved(entry, DISMISS_NOTIF_CANCEL);
435 return false;
436 }
437 return false;
438 }
439 };
440
441 @SuppressWarnings("FieldCanBeLocal")
Ned Burns01e38212019-01-03 16:32:52 -0500442 private final NotificationEntryListener mEntryListener = new NotificationEntryListener() {
443 @Override
Ned Burnsf81c4c42019-01-07 14:10:43 -0500444 public void onPendingEntryAdded(NotificationEntry entry) {
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800445 if (!areBubblesEnabled(mContext)) {
446 return;
447 }
Mady Melloraa8fef22019-04-11 13:36:40 -0700448 if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)) {
Mady Mellor8a1f0252019-04-01 11:31:34 -0700449 updateShowInShadeForSuppressNotification(entry);
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800450 }
451 }
452
453 @Override
Ned Burns1a5e22f2019-02-14 15:11:52 -0500454 public void onEntryInflated(NotificationEntry entry, @InflationFlag int inflatedFlags) {
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800455 if (!areBubblesEnabled(mContext)) {
456 return;
457 }
Mady Melloraa8fef22019-04-11 13:36:40 -0700458 if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)) {
Mark Renouff97ed462019-04-05 13:46:24 -0400459 updateBubble(entry);
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800460 }
461 }
462
463 @Override
464 public void onPreEntryUpdated(NotificationEntry entry) {
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800465 if (!areBubblesEnabled(mContext)) {
466 return;
467 }
Mady Melloraa8fef22019-04-11 13:36:40 -0700468 boolean shouldBubble = mNotificationInterruptionStateProvider.shouldBubbleUp(entry);
469 if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.key)) {
470 // It was previously a bubble but no longer a bubble -- lets remove it
471 removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE);
Mady Mellorff40e012019-05-03 15:34:41 -0700472 } else if (shouldBubble) {
Mady Mellor8a1f0252019-04-01 11:31:34 -0700473 updateShowInShadeForSuppressNotification(entry);
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800474 entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed
Mark Renouff97ed462019-04-05 13:46:24 -0400475 updateBubble(entry);
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800476 }
477 }
Ned Burns01e38212019-01-03 16:32:52 -0500478 };
479
Mark Renouf71a3af62019-04-08 15:02:54 -0400480 @SuppressWarnings("FieldCanBeLocal")
Mark Renouf3bc5b362019-04-05 14:37:59 -0400481 private final BubbleData.Listener mBubbleDataListener = new BubbleData.Listener() {
Mark Renouf71a3af62019-04-08 15:02:54 -0400482
Mark Renouf3bc5b362019-04-05 14:37:59 -0400483 @Override
484 public void onBubbleAdded(Bubble bubble) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400485 ensureStackViewCreated();
486 mStackView.addBubble(bubble);
Mark Renouf3bc5b362019-04-05 14:37:59 -0400487 }
488
489 @Override
Mady Mellorc2ff0112019-03-28 14:18:06 -0700490 public void onBubbleRemoved(Bubble bubble, @DismissReason int reason) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400491 if (mStackView != null) {
492 mStackView.removeBubble(bubble);
493 }
Mady Mellorc2ff0112019-03-28 14:18:06 -0700494 if (!mBubbleData.hasBubbleWithKey(bubble.getKey())
495 && !bubble.entry.showInShadeWhenBubble()) {
496 // The bubble is gone & the notification is gone, time to actually remove it
497 mNotificationEntryManager.performRemoveNotification(bubble.entry.notification,
Mady Mellor1a4e86f2019-05-03 16:07:23 -0700498 UNDEFINED_DISMISS_REASON);
Mady Mellora54e9fa2019-04-18 13:26:18 -0700499 } else {
500 // The notification is still in the shade but we've removed the bubble so
501 // lets make sure NoMan knows it's not a bubble anymore
502 try {
503 mBarService.onNotificationBubbleChanged(bubble.getKey(), false /* isBubble */);
504 } catch (RemoteException e) {
505 // Bad things have happened
506 }
507 }
Mark Renouf3bc5b362019-04-05 14:37:59 -0400508 }
509
510 public void onBubbleUpdated(Bubble bubble) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400511 if (mStackView != null) {
512 mStackView.updateBubble(bubble);
513 }
Mark Renouf3bc5b362019-04-05 14:37:59 -0400514 }
515
516 @Override
517 public void onOrderChanged(List<Bubble> bubbles) {
Mark Renoufba5ab512019-05-02 15:21:01 -0400518 if (mStackView != null) {
519 mStackView.updateBubbleOrder(bubbles);
520 }
Mark Renouf3bc5b362019-04-05 14:37:59 -0400521 }
522
523 @Override
Mark Renouf9ba6cea2019-04-17 11:53:50 -0400524 public void onSelectionChanged(@Nullable Bubble selectedBubble) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400525 if (mStackView != null) {
526 mStackView.setSelectedBubble(selectedBubble);
527 }
Mark Renouf3bc5b362019-04-05 14:37:59 -0400528 }
529
530 @Override
531 public void onExpandedChanged(boolean expanded) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400532 if (mStackView != null) {
533 mStackView.setExpanded(expanded);
534 }
Mark Renouf3bc5b362019-04-05 14:37:59 -0400535 }
536
537 @Override
Mark Renouf3bc5b362019-04-05 14:37:59 -0400538 public void apply() {
Mark Renouf71a3af62019-04-08 15:02:54 -0400539 mNotificationEntryManager.updateNotifications();
540 updateVisibility();
Mark Renouf9ba6cea2019-04-17 11:53:50 -0400541
542 if (DEBUG) {
543 Log.d(TAG, "[BubbleData]");
544 Log.d(TAG, formatBubblesString(mBubbleData.getBubbles(),
545 mBubbleData.getSelectedBubble()));
546
547 if (mStackView != null) {
548 Log.d(TAG, "[BubbleStackView]");
549 Log.d(TAG, formatBubblesString(mStackView.getBubblesOnScreen(),
550 mStackView.getExpandedBubble()));
551 }
552 }
Mark Renouf3bc5b362019-04-05 14:37:59 -0400553 }
554 };
555
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800556 /**
557 * Lets any listeners know if bubble state has changed.
558 */
Mady Mellord1c78b262018-11-06 18:04:40 -0800559 private void updateBubblesShowing() {
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800560 if (mStackView == null) {
561 return;
Mady Mellord1c78b262018-11-06 18:04:40 -0800562 }
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800563
Mady Mellord1c78b262018-11-06 18:04:40 -0800564 boolean hadBubbles = mStatusBarWindowController.getBubblesShowing();
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800565 boolean hasBubblesShowing = hasBubbles() && mStackView.getVisibility() == VISIBLE;
Mady Mellord1c78b262018-11-06 18:04:40 -0800566 mStatusBarWindowController.setBubblesShowing(hasBubblesShowing);
Mady Mellord1c78b262018-11-06 18:04:40 -0800567 if (mStateChangeListener != null && hadBubbles != hasBubblesShowing) {
568 mStateChangeListener.onHasBubblesChanged(hasBubblesShowing);
569 }
Mady Mellor5549dd22018-11-06 18:07:34 -0800570 }
571
572 /**
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800573 * Updates the visibility of the bubbles based on current state.
574 * Does not un-bubble, just hides or un-hides. Will notify any
575 * {@link BubbleStateChangeListener}s if visibility changes.
Mady Mellor5549dd22018-11-06 18:07:34 -0800576 */
Mady Mellor3f2efdb2018-11-21 11:30:45 -0800577 public void updateVisibility() {
578 if (mStatusBarStateListener.getCurrentState() == SHADE && hasBubbles()) {
579 // Bubbles only appear in unlocked shade
580 mStackView.setVisibility(hasBubbles() ? VISIBLE : INVISIBLE);
581 } else if (mStackView != null) {
582 mStackView.setVisibility(INVISIBLE);
Mady Mellor5549dd22018-11-06 18:07:34 -0800583 }
Mady Mellord1c78b262018-11-06 18:04:40 -0800584 updateBubblesShowing();
585 }
586
587 /**
588 * Rect indicating the touchable region for the bubble stack / expanded stack.
589 */
590 public Rect getTouchableRegion() {
591 if (mStackView == null || mStackView.getVisibility() != VISIBLE) {
592 return null;
593 }
594 mStackView.getBoundsOnScreen(mTempRect);
595 return mTempRect;
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800596 }
597
Mady Mellor390bff42019-04-05 15:09:01 -0700598 /**
599 * The display id of the expanded view, if the stack is expanded and not occluded by the
600 * status bar, otherwise returns {@link Display#INVALID_DISPLAY}.
601 */
602 public int getExpandedDisplayId(Context context) {
Joel Galenson4071ddb2019-04-18 13:30:45 -0700603 if (mStackView == null) {
604 return INVALID_DISPLAY;
605 }
Mady Mellor390bff42019-04-05 15:09:01 -0700606 boolean defaultDisplay = context.getDisplay() != null
607 && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
608 Bubble b = mStackView.getExpandedBubble();
609 if (defaultDisplay && b != null && isStackExpanded()
610 && !mStatusBarWindowController.getPanelExpanded()) {
611 return b.expandedView.getVirtualDisplayId();
612 }
613 return INVALID_DISPLAY;
614 }
615
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800616 @VisibleForTesting
617 BubbleStackView getStackView() {
618 return mStackView;
619 }
620
Mady Mellor5549dd22018-11-06 18:07:34 -0800621 /**
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800622 * Whether the notification should automatically bubble or not. Gated by secure settings flags.
Mady Mellor5549dd22018-11-06 18:07:34 -0800623 */
Mady Mellor9bad2242019-01-28 11:21:51 -0800624 @VisibleForTesting
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800625 protected boolean shouldAutoBubbleForFlags(Context context, NotificationEntry entry) {
Mady Mellorceced172018-11-27 11:18:39 -0800626 if (entry.isBubbleDismissed()) {
Mady Mellor5549dd22018-11-06 18:07:34 -0800627 return false;
628 }
Mady Mellorb4991e62019-01-10 15:14:51 -0800629 StatusBarNotification n = entry.notification;
Mady Mellorceced172018-11-27 11:18:39 -0800630
631 boolean autoBubbleMessages = shouldAutoBubbleMessages(context) || DEBUG_ENABLE_AUTO_BUBBLE;
632 boolean autoBubbleOngoing = shouldAutoBubbleOngoing(context) || DEBUG_ENABLE_AUTO_BUBBLE;
633 boolean autoBubbleAll = shouldAutoBubbleAll(context) || DEBUG_ENABLE_AUTO_BUBBLE;
634
Mady Mellor5549dd22018-11-06 18:07:34 -0800635 boolean hasRemoteInput = false;
636 if (n.getNotification().actions != null) {
637 for (Notification.Action action : n.getNotification().actions) {
638 if (action.getRemoteInputs() != null) {
639 hasRemoteInput = true;
640 break;
641 }
642 }
643 }
Mady Mellor711f9562018-12-05 14:53:46 -0800644 boolean isCall = Notification.CATEGORY_CALL.equals(n.getNotification().category)
645 && n.isOngoing();
646 boolean isMusic = n.getNotification().hasMediaSession();
647 boolean isImportantOngoing = isMusic || isCall;
Mady Mellorceced172018-11-27 11:18:39 -0800648
Mady Mellor5549dd22018-11-06 18:07:34 -0800649 Class<? extends Notification.Style> style = n.getNotification().getNotificationStyle();
Mady Mellore3175372018-12-04 17:05:11 -0800650 boolean isMessageType = Notification.CATEGORY_MESSAGE.equals(n.getNotification().category);
651 boolean isMessageStyle = Notification.MessagingStyle.class.equals(style);
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800652 return (((isMessageType && hasRemoteInput) || isMessageStyle) && autoBubbleMessages)
Mady Mellor711f9562018-12-05 14:53:46 -0800653 || (isImportantOngoing && autoBubbleOngoing)
Mady Mellorceced172018-11-27 11:18:39 -0800654 || autoBubbleAll;
655 }
656
Mady Mellore80930e2019-03-21 16:00:45 -0700657 private boolean shouldAutoExpand(NotificationEntry entry) {
658 Notification.BubbleMetadata metadata = entry.getBubbleMetadata();
659 return metadata != null && metadata.getAutoExpandBubble()
Steven Wu8ba8ca92019-04-11 10:47:42 -0400660 && isForegroundApp(mContext, entry.notification.getPackageName());
Mady Mellore80930e2019-03-21 16:00:45 -0700661 }
662
Mady Mellor8a1f0252019-04-01 11:31:34 -0700663 private void updateShowInShadeForSuppressNotification(NotificationEntry entry) {
664 boolean suppressNotification = entry.getBubbleMetadata() != null
Mady Mellorc529d6d2019-04-16 14:22:52 -0700665 && entry.getBubbleMetadata().isNotificationSuppressed()
Steven Wu8ba8ca92019-04-11 10:47:42 -0400666 && isForegroundApp(mContext, entry.notification.getPackageName());
Mady Mellor8a1f0252019-04-01 11:31:34 -0700667 entry.setShowInShadeWhenBubble(!suppressNotification);
668 }
669
Mark Renouf9ba6cea2019-04-17 11:53:50 -0400670 static String formatBubblesString(List<Bubble> bubbles, Bubble selected) {
671 StringBuilder sb = new StringBuilder();
672 for (Bubble bubble : bubbles) {
673 if (bubble == null) {
674 sb.append(" <null> !!!!!\n");
675 } else {
676 boolean isSelected = (bubble == selected);
677 sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n",
678 ((isSelected) ? "->" : " "),
679 bubble.getLastActivity(),
680 (bubble.isOngoing() ? 1 : 0),
681 bubble.getKey()));
682 }
683 }
684 return sb.toString();
685 }
686
Mady Mellore80930e2019-03-21 16:00:45 -0700687 /**
688 * Return true if the applications with the package name is running in foreground.
689 *
Steven Wu8ba8ca92019-04-11 10:47:42 -0400690 * @param context application context.
Mady Mellore80930e2019-03-21 16:00:45 -0700691 * @param pkgName application package name.
692 */
Steven Wu8ba8ca92019-04-11 10:47:42 -0400693 public static boolean isForegroundApp(Context context, String pkgName) {
694 ActivityManager am = context.getSystemService(ActivityManager.class);
Mady Mellore80930e2019-03-21 16:00:45 -0700695 List<RunningTaskInfo> tasks = am.getRunningTasks(1 /* maxNum */);
696 return !tasks.isEmpty() && pkgName.equals(tasks.get(0).topActivity.getPackageName());
697 }
698
Mark Renoufcecc77b2019-01-30 16:32:24 -0500699 /**
700 * This task stack listener is responsible for responding to tasks moved to the front
701 * which are on the default (main) display. When this happens, expanded bubbles must be
702 * collapsed so the user may interact with the app which was just moved to the front.
703 * <p>
704 * This listener is registered with SystemUI's ActivityManagerWrapper which dispatches
705 * these calls via a main thread Handler.
706 */
707 @MainThread
708 private class BubbleTaskStackListener extends TaskStackChangeListener {
709
Mark Renoufcecc77b2019-01-30 16:32:24 -0500710 @Override
Mark Renoufc808f062019-02-07 15:20:37 -0500711 public void onTaskMovedToFront(RunningTaskInfo taskInfo) {
712 if (mStackView != null && taskInfo.displayId == Display.DEFAULT_DISPLAY) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400713 mBubbleData.setExpanded(false);
Mark Renoufcecc77b2019-01-30 16:32:24 -0500714 }
715 }
716
Mark Renoufcecc77b2019-01-30 16:32:24 -0500717 @Override
Mark Renoufa12e8762019-03-07 15:43:01 -0500718 public void onActivityLaunchOnSecondaryDisplayRerouted() {
Mark Renoufcecc77b2019-01-30 16:32:24 -0500719 if (mStackView != null) {
Mark Renouf71a3af62019-04-08 15:02:54 -0400720 mBubbleData.setExpanded(false);
Mark Renoufcecc77b2019-01-30 16:32:24 -0500721 }
722 }
Mark Renouf446251d2019-04-26 10:22:41 -0400723
724 @Override
725 public void onBackPressedOnTaskRoot(RunningTaskInfo taskInfo) {
726 if (mStackView != null && taskInfo.displayId == getExpandedDisplayId(mContext)) {
727 mBubbleData.setExpanded(false);
728 }
729 }
Mark Renoufcecc77b2019-01-30 16:32:24 -0500730 }
731
Mady Mellorceced172018-11-27 11:18:39 -0800732 private static boolean shouldAutoBubbleMessages(Context context) {
733 return Settings.Secure.getInt(context.getContentResolver(),
734 ENABLE_AUTO_BUBBLE_MESSAGES, 0) != 0;
735 }
736
737 private static boolean shouldAutoBubbleOngoing(Context context) {
738 return Settings.Secure.getInt(context.getContentResolver(),
739 ENABLE_AUTO_BUBBLE_ONGOING, 0) != 0;
740 }
741
742 private static boolean shouldAutoBubbleAll(Context context) {
743 return Settings.Secure.getInt(context.getContentResolver(),
744 ENABLE_AUTO_BUBBLE_ALL, 0) != 0;
Mady Mellor5549dd22018-11-06 18:07:34 -0800745 }
Mark Renouf89b1a4a2018-12-04 14:59:45 -0500746
Mady Mellor3dff9e62019-02-05 18:12:53 -0800747 static boolean shouldUseContentIntent(Context context) {
Mark Renouf89b1a4a2018-12-04 14:59:45 -0500748 return Settings.Secure.getInt(context.getContentResolver(),
749 ENABLE_BUBBLE_CONTENT_INTENT, 0) != 0;
750 }
Mady Mellorf6e3ac02019-01-29 10:37:52 -0800751
752 private static boolean areBubblesEnabled(Context context) {
753 return Settings.Secure.getInt(context.getContentResolver(),
754 ENABLE_BUBBLES, 1) != 0;
755 }
Joshua Tsujia19515f2019-02-13 18:02:29 -0500756
Joshua Tsuji010c2b12019-02-25 18:11:25 -0500757 /** Default stiffness to use for bubble physics animations. */
758 public static int getBubbleStiffness(Context context, int defaultStiffness) {
759 return Settings.Secure.getInt(
760 context.getContentResolver(), BUBBLE_STIFFNESS, defaultStiffness);
761 }
762
763 /** Default bounciness/damping ratio to use for bubble physics animations. */
764 public static float getBubbleBounciness(Context context, float defaultBounciness) {
765 return Settings.Secure.getInt(
766 context.getContentResolver(),
767 BUBBLE_BOUNCINESS,
768 (int) (defaultBounciness * 100)) / 100f;
769 }
770
Joshua Tsujia19515f2019-02-13 18:02:29 -0500771 /** PinnedStackListener that dispatches IME visibility updates to the stack. */
772 private class BubblesImeListener extends IPinnedStackListener.Stub {
773
774 @Override
775 public void onListenerRegistered(IPinnedStackController controller) throws RemoteException {
776 }
777
778 @Override
779 public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds,
780 Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment,
781 int displayRotation) throws RemoteException {}
782
783 @Override
Joshua Tsujid9422832019-03-05 13:32:37 -0500784 public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
785 if (mStackView != null && mStackView.getBubbleCount() > 0) {
786 mStackView.post(() -> mStackView.onImeVisibilityChanged(imeVisible, imeHeight));
Joshua Tsujia19515f2019-02-13 18:02:29 -0500787 }
788 }
789
790 @Override
791 public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight)
792 throws RemoteException {}
793
794 @Override
795 public void onMinimizedStateChanged(boolean isMinimized) throws RemoteException {}
796
797 @Override
798 public void onActionsChanged(ParceledListSlice actions) throws RemoteException {}
799 }
Mady Mellorc3d6f7d2018-11-07 09:36:56 -0800800}