Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.systemui.bubbles; |
| 18 | |
Mady Mellor | 3a0a1b4 | 2019-05-23 06:40:21 -0700 | [diff] [blame] | 19 | import static android.app.Notification.FLAG_BUBBLE; |
Mady Mellor | ca0c24c | 2019-05-16 16:14:32 -0700 | [diff] [blame] | 20 | import static android.content.pm.ActivityInfo.DOCUMENT_LAUNCH_ALWAYS; |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 21 | import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; |
| 22 | import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL_ALL; |
| 23 | import static android.service.notification.NotificationListenerService.REASON_CANCEL; |
| 24 | import static android.service.notification.NotificationListenerService.REASON_CANCEL_ALL; |
Mady Mellor | 390bff4 | 2019-04-05 15:09:01 -0700 | [diff] [blame] | 25 | import static android.view.Display.DEFAULT_DISPLAY; |
| 26 | import static android.view.Display.INVALID_DISPLAY; |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 27 | import static android.view.View.INVISIBLE; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 28 | import static android.view.View.VISIBLE; |
Joshua Tsuji | b1a796b | 2019-01-16 15:43:12 -0800 | [diff] [blame] | 29 | import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 30 | |
Issei Suzuki | a8d0731 | 2019-06-07 12:56:19 +0200 | [diff] [blame] | 31 | import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_CONTROLLER; |
| 32 | import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; |
| 33 | import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 34 | import static com.android.systemui.statusbar.StatusBarState.SHADE; |
Mady Mellor | 1a4e86f | 2019-05-03 16:07:23 -0700 | [diff] [blame] | 35 | import static com.android.systemui.statusbar.notification.NotificationEntryManager.UNDEFINED_DISMISS_REASON; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 36 | |
Mark Renouf | ba5ab51 | 2019-05-02 15:21:01 -0400 | [diff] [blame] | 37 | import static java.lang.annotation.ElementType.FIELD; |
| 38 | import static java.lang.annotation.ElementType.LOCAL_VARIABLE; |
| 39 | import static java.lang.annotation.ElementType.PARAMETER; |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 40 | import static java.lang.annotation.RetentionPolicy.SOURCE; |
| 41 | |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 42 | import android.annotation.UserIdInt; |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 43 | import android.app.ActivityManager.RunningTaskInfo; |
Mady Mellor | 66efd5e | 2019-05-15 13:38:11 -0700 | [diff] [blame] | 44 | import android.app.NotificationManager; |
Mady Mellor | ca0c24c | 2019-05-16 16:14:32 -0700 | [diff] [blame] | 45 | import android.app.PendingIntent; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 46 | import android.content.Context; |
Mady Mellor | ca0c24c | 2019-05-16 16:14:32 -0700 | [diff] [blame] | 47 | import android.content.pm.ActivityInfo; |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 48 | import android.content.pm.ParceledListSlice; |
Joshua Tsuji | f418f9e | 2019-04-04 17:09:53 -0400 | [diff] [blame] | 49 | import android.content.res.Configuration; |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 50 | import android.graphics.Rect; |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 51 | import android.os.RemoteException; |
Mady Mellor | b4991e6 | 2019-01-10 15:14:51 -0800 | [diff] [blame] | 52 | import android.os.ServiceManager; |
Mady Mellor | ceced17 | 2018-11-27 11:18:39 -0800 | [diff] [blame] | 53 | import android.provider.Settings; |
Mark Renouf | bbcf07f | 2019-05-09 10:42:43 -0400 | [diff] [blame] | 54 | import android.service.notification.NotificationListenerService.RankingMap; |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 55 | import android.service.notification.ZenModeConfig; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 56 | import android.util.ArraySet; |
Mark Renouf | 9ba6cea | 2019-04-17 11:53:50 -0400 | [diff] [blame] | 57 | import android.util.Log; |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 58 | import android.util.Pair; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 59 | import android.util.SparseSetArray; |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 60 | import android.view.Display; |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 61 | import android.view.IPinnedStackController; |
| 62 | import android.view.IPinnedStackListener; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 63 | import android.view.ViewGroup; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 64 | import android.widget.FrameLayout; |
| 65 | |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 66 | import androidx.annotation.IntDef; |
Mark Renouf | 658c6bc | 2019-01-30 10:26:54 -0500 | [diff] [blame] | 67 | import androidx.annotation.MainThread; |
Joshua Tsuji | c650a14 | 2019-05-22 11:31:19 -0400 | [diff] [blame] | 68 | import androidx.annotation.Nullable; |
Mark Renouf | 658c6bc | 2019-01-30 10:26:54 -0500 | [diff] [blame] | 69 | |
Mady Mellor | ebdbbb9 | 2018-11-15 14:36:48 -0800 | [diff] [blame] | 70 | import com.android.internal.annotations.VisibleForTesting; |
Mady Mellor | a54e9fa | 2019-04-18 13:26:18 -0700 | [diff] [blame] | 71 | import com.android.internal.statusbar.IStatusBarService; |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 72 | import com.android.systemui.Dependency; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 73 | import com.android.systemui.R; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 74 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 75 | import com.android.systemui.shared.system.ActivityManagerWrapper; |
| 76 | import com.android.systemui.shared.system.TaskStackChangeListener; |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 77 | import com.android.systemui.shared.system.WindowManagerWrapper; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 78 | import com.android.systemui.statusbar.NotificationLockscreenUserManager; |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 79 | import com.android.systemui.statusbar.NotificationRemoveInterceptor; |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 80 | import com.android.systemui.statusbar.notification.NotificationEntryListener; |
| 81 | import com.android.systemui.statusbar.notification.NotificationEntryManager; |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 82 | import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 83 | import com.android.systemui.statusbar.notification.collection.NotificationData; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 84 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 85 | import com.android.systemui.statusbar.phone.StatusBarWindowController; |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 86 | import com.android.systemui.statusbar.policy.ConfigurationController; |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 87 | import com.android.systemui.statusbar.policy.ZenModeController; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 88 | |
Mady Mellor | 70cba7bb | 2019-07-02 15:06:07 -0700 | [diff] [blame] | 89 | import java.io.FileDescriptor; |
| 90 | import java.io.PrintWriter; |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 91 | import java.lang.annotation.Retention; |
Mark Renouf | ba5ab51 | 2019-05-02 15:21:01 -0400 | [diff] [blame] | 92 | import java.lang.annotation.Target; |
Mady Mellor | e80930e | 2019-03-21 16:00:45 -0700 | [diff] [blame] | 93 | import java.util.List; |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 94 | |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 95 | import javax.inject.Inject; |
| 96 | import javax.inject.Singleton; |
| 97 | |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 98 | /** |
| 99 | * Bubbles are a special type of content that can "float" on top of other apps or System UI. |
| 100 | * Bubbles can be expanded to show more content. |
| 101 | * |
| 102 | * The controller manages addition, removal, and visible state of bubbles on screen. |
| 103 | */ |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 104 | @Singleton |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 105 | public class BubbleController implements ConfigurationController.ConfigurationListener { |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 106 | |
Issei Suzuki | a8d0731 | 2019-06-07 12:56:19 +0200 | [diff] [blame] | 107 | private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 108 | |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 109 | @Retention(SOURCE) |
| 110 | @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED, |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 111 | DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION, DISMISS_NO_LONGER_BUBBLE, |
| 112 | DISMISS_USER_CHANGED}) |
Mark Renouf | ba5ab51 | 2019-05-02 15:21:01 -0400 | [diff] [blame] | 113 | @Target({FIELD, LOCAL_VARIABLE, PARAMETER}) |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 114 | @interface DismissReason {} |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 115 | |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 116 | static final int DISMISS_USER_GESTURE = 1; |
| 117 | static final int DISMISS_AGED = 2; |
| 118 | static final int DISMISS_TASK_FINISHED = 3; |
| 119 | static final int DISMISS_BLOCKED = 4; |
| 120 | static final int DISMISS_NOTIF_CANCEL = 5; |
| 121 | static final int DISMISS_ACCESSIBILITY_ACTION = 6; |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 122 | static final int DISMISS_NO_LONGER_BUBBLE = 7; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 123 | static final int DISMISS_USER_CHANGED = 8; |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 124 | |
Joshua Tsuji | 4accf598 | 2019-04-22 17:36:11 -0400 | [diff] [blame] | 125 | public static final int MAX_BUBBLES = 5; // TODO: actually enforce this |
Joshua Tsuji | 25a4b7b | 2019-03-22 14:11:06 -0400 | [diff] [blame] | 126 | |
Mady Mellor | 44ee2fe | 2019-01-30 17:51:16 -0800 | [diff] [blame] | 127 | /** Flag to enable or disable the entire feature */ |
Mady Mellor | f6e3ac0 | 2019-01-29 10:37:52 -0800 | [diff] [blame] | 128 | private static final String ENABLE_BUBBLES = "experiment_enable_bubbles"; |
Joshua Tsuji | 010c2b1 | 2019-02-25 18:11:25 -0500 | [diff] [blame] | 129 | |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 130 | private final Context mContext; |
| 131 | private final NotificationEntryManager mNotificationEntryManager; |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 132 | private final BubbleTaskStackListener mTaskStackListener; |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 133 | private BubbleStateChangeListener mStateChangeListener; |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 134 | private BubbleExpandListener mExpandListener; |
Issei Suzuki | c038754 | 2019-03-08 17:31:14 +0100 | [diff] [blame] | 135 | @Nullable private BubbleStackView.SurfaceSynchronizer mSurfaceSynchronizer; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 136 | |
Mady Mellor | 3dff9e6 | 2019-02-05 18:12:53 -0800 | [diff] [blame] | 137 | private BubbleData mBubbleData; |
Joshua Tsuji | c650a14 | 2019-05-22 11:31:19 -0400 | [diff] [blame] | 138 | @Nullable private BubbleStackView mStackView; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 139 | |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 140 | // Tracks the id of the current (foreground) user. |
| 141 | private int mCurrentUserId; |
| 142 | // Saves notification keys of active bubbles when users are switched. |
| 143 | private final SparseSetArray<String> mSavedBubbleKeysPerUser; |
| 144 | |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 145 | // Bubbles get added to the status bar view |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 146 | private final StatusBarWindowController mStatusBarWindowController; |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 147 | private final ZenModeController mZenModeController; |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 148 | private StatusBarStateListener mStatusBarStateListener; |
| 149 | |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 150 | private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider; |
Mady Mellor | a54e9fa | 2019-04-18 13:26:18 -0700 | [diff] [blame] | 151 | private IStatusBarService mBarService; |
Mady Mellor | b4991e6 | 2019-01-10 15:14:51 -0800 | [diff] [blame] | 152 | |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 153 | // Used for determining view rect for touch interaction |
| 154 | private Rect mTempRect = new Rect(); |
| 155 | |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 156 | // Listens to user switch so bubbles can be saved and restored. |
| 157 | private final NotificationLockscreenUserManager mNotifUserManager; |
| 158 | |
Joshua Tsuji | f418f9e | 2019-04-04 17:09:53 -0400 | [diff] [blame] | 159 | /** Last known orientation, used to detect orientation changes in {@link #onConfigChanged}. */ |
| 160 | private int mOrientation = Configuration.ORIENTATION_UNDEFINED; |
| 161 | |
Mady Mellor | 5549dd2 | 2018-11-06 18:07:34 -0800 | [diff] [blame] | 162 | /** |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 163 | * Listener to be notified when some states of the bubbles change. |
| 164 | */ |
| 165 | public interface BubbleStateChangeListener { |
| 166 | /** |
| 167 | * Called when the stack has bubbles or no longer has bubbles. |
| 168 | */ |
| 169 | void onHasBubblesChanged(boolean hasBubbles); |
| 170 | } |
| 171 | |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 172 | /** |
| 173 | * Listener to find out about stack expansion / collapse events. |
| 174 | */ |
| 175 | public interface BubbleExpandListener { |
| 176 | /** |
| 177 | * Called when the expansion state of the bubble stack changes. |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 178 | * |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 179 | * @param isExpanding whether it's expanding or collapsing |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 180 | * @param key the notification key associated with bubble being expanded |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 181 | */ |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 182 | void onBubbleExpandChanged(boolean isExpanding, String key); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Listens for the current state of the status bar and updates the visibility state |
| 187 | * of bubbles as needed. |
| 188 | */ |
| 189 | private class StatusBarStateListener implements StatusBarStateController.StateListener { |
| 190 | private int mState; |
| 191 | /** |
| 192 | * Returns the current status bar state. |
| 193 | */ |
| 194 | public int getCurrentState() { |
| 195 | return mState; |
| 196 | } |
| 197 | |
| 198 | @Override |
| 199 | public void onStateChanged(int newState) { |
| 200 | mState = newState; |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 201 | boolean shouldCollapse = (mState != SHADE); |
| 202 | if (shouldCollapse) { |
| 203 | collapseStack(); |
| 204 | } |
Lyn Han | 6c40fe7 | 2019-05-08 14:06:33 -0700 | [diff] [blame] | 205 | updateStack(); |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 206 | } |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 207 | } |
| 208 | |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 209 | @Inject |
Mady Mellor | cfd06c1 | 2019-02-13 14:32:12 -0800 | [diff] [blame] | 210 | public BubbleController(Context context, StatusBarWindowController statusBarWindowController, |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 211 | BubbleData data, ConfigurationController configurationController, |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 212 | NotificationInterruptionStateProvider interruptionStateProvider, |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 213 | ZenModeController zenModeController, |
| 214 | NotificationLockscreenUserManager notifUserManager) { |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 215 | this(context, statusBarWindowController, data, null /* synchronizer */, |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 216 | configurationController, interruptionStateProvider, zenModeController, |
| 217 | notifUserManager); |
Issei Suzuki | c038754 | 2019-03-08 17:31:14 +0100 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | public BubbleController(Context context, StatusBarWindowController statusBarWindowController, |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 221 | BubbleData data, @Nullable BubbleStackView.SurfaceSynchronizer synchronizer, |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 222 | ConfigurationController configurationController, |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 223 | NotificationInterruptionStateProvider interruptionStateProvider, |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 224 | ZenModeController zenModeController, |
| 225 | NotificationLockscreenUserManager notifUserManager) { |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 226 | mContext = context; |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 227 | mNotificationInterruptionStateProvider = interruptionStateProvider; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 228 | mNotifUserManager = notifUserManager; |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 229 | mZenModeController = zenModeController; |
| 230 | mZenModeController.addCallback(new ZenModeController.Callback() { |
| 231 | @Override |
| 232 | public void onZenChanged(int zen) { |
Mady Mellor | df48d0a | 2019-06-25 18:26:46 -0700 | [diff] [blame] | 233 | if (mStackView != null) { |
| 234 | mStackView.updateDots(); |
| 235 | } |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | @Override |
| 239 | public void onConfigChanged(ZenModeConfig config) { |
Mady Mellor | df48d0a | 2019-06-25 18:26:46 -0700 | [diff] [blame] | 240 | if (mStackView != null) { |
| 241 | mStackView.updateDots(); |
| 242 | } |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 243 | } |
| 244 | }); |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 245 | |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 246 | configurationController.addCallback(this /* configurationListener */); |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 247 | |
Mark Renouf | 9ba6cea | 2019-04-17 11:53:50 -0400 | [diff] [blame] | 248 | mBubbleData = data; |
| 249 | mBubbleData.setListener(mBubbleDataListener); |
| 250 | |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 251 | mNotificationEntryManager = Dependency.get(NotificationEntryManager.class); |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 252 | mNotificationEntryManager.addNotificationEntryListener(mEntryListener); |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 253 | mNotificationEntryManager.setNotificationRemoveInterceptor(mRemoveInterceptor); |
Mady Mellor | b4991e6 | 2019-01-10 15:14:51 -0800 | [diff] [blame] | 254 | |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 255 | mStatusBarWindowController = statusBarWindowController; |
| 256 | mStatusBarStateListener = new StatusBarStateListener(); |
| 257 | Dependency.get(StatusBarStateController.class).addCallback(mStatusBarStateListener); |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 258 | |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 259 | mTaskStackListener = new BubbleTaskStackListener(); |
| 260 | ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener); |
Mady Mellor | 3dff9e6 | 2019-02-05 18:12:53 -0800 | [diff] [blame] | 261 | |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 262 | try { |
| 263 | WindowManagerWrapper.getInstance().addPinnedStackListener(new BubblesImeListener()); |
| 264 | } catch (RemoteException e) { |
| 265 | e.printStackTrace(); |
| 266 | } |
Issei Suzuki | c038754 | 2019-03-08 17:31:14 +0100 | [diff] [blame] | 267 | mSurfaceSynchronizer = synchronizer; |
Mady Mellor | a54e9fa | 2019-04-18 13:26:18 -0700 | [diff] [blame] | 268 | |
| 269 | mBarService = IStatusBarService.Stub.asInterface( |
| 270 | ServiceManager.getService(Context.STATUS_BAR_SERVICE)); |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 271 | |
| 272 | mSavedBubbleKeysPerUser = new SparseSetArray<>(); |
| 273 | mCurrentUserId = mNotifUserManager.getCurrentUserId(); |
| 274 | mNotifUserManager.addUserChangedListener( |
| 275 | newUserId -> { |
| 276 | saveBubbles(mCurrentUserId); |
| 277 | mBubbleData.dismissAll(DISMISS_USER_CHANGED); |
| 278 | restoreBubbles(newUserId); |
| 279 | mCurrentUserId = newUserId; |
| 280 | }); |
Mady Mellor | 5549dd2 | 2018-11-06 18:07:34 -0800 | [diff] [blame] | 281 | } |
| 282 | |
Mark Renouf | 8b6a3c6 | 2019-04-09 10:17:40 -0400 | [diff] [blame] | 283 | /** |
| 284 | * BubbleStackView is lazily created by this method the first time a Bubble is added. This |
| 285 | * method initializes the stack view and adds it to the StatusBar just above the scrim. |
| 286 | */ |
| 287 | private void ensureStackViewCreated() { |
| 288 | if (mStackView == null) { |
| 289 | mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer); |
| 290 | ViewGroup sbv = mStatusBarWindowController.getStatusBarView(); |
Lyn Han | bde4820 | 2019-05-29 19:18:29 -0700 | [diff] [blame] | 291 | int bubbleScrimIndex = sbv.indexOfChild(sbv.findViewById(R.id.scrim_for_bubble)); |
| 292 | int stackIndex = bubbleScrimIndex + 1; // Show stack above bubble scrim. |
| 293 | sbv.addView(mStackView, stackIndex, |
Mark Renouf | 8b6a3c6 | 2019-04-09 10:17:40 -0400 | [diff] [blame] | 294 | new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); |
| 295 | if (mExpandListener != null) { |
| 296 | mStackView.setExpandListener(mExpandListener); |
| 297 | } |
Mark Renouf | 8b6a3c6 | 2019-04-09 10:17:40 -0400 | [diff] [blame] | 298 | } |
| 299 | } |
| 300 | |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 301 | /** |
| 302 | * Records the notification key for any active bubbles. These are used to restore active |
| 303 | * bubbles when the user returns to the foreground. |
| 304 | * |
| 305 | * @param userId the id of the user |
| 306 | */ |
| 307 | private void saveBubbles(@UserIdInt int userId) { |
| 308 | // First clear any existing keys that might be stored. |
| 309 | mSavedBubbleKeysPerUser.remove(userId); |
| 310 | // Add in all active bubbles for the current user. |
| 311 | for (Bubble bubble: mBubbleData.getBubbles()) { |
| 312 | mSavedBubbleKeysPerUser.add(userId, bubble.getKey()); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Promotes existing notifications to Bubbles if they were previously bubbles. |
| 318 | * |
| 319 | * @param userId the id of the user |
| 320 | */ |
| 321 | private void restoreBubbles(@UserIdInt int userId) { |
| 322 | NotificationData notificationData = |
| 323 | mNotificationEntryManager.getNotificationData(); |
| 324 | ArraySet<String> savedBubbleKeys = mSavedBubbleKeysPerUser.get(userId); |
| 325 | if (savedBubbleKeys == null) { |
| 326 | // There were no bubbles saved for this used. |
| 327 | return; |
| 328 | } |
| 329 | for (NotificationEntry e : notificationData.getNotificationsForCurrentUser()) { |
| 330 | if (savedBubbleKeys.contains(e.key) |
| 331 | && mNotificationInterruptionStateProvider.shouldBubbleUp(e) |
| 332 | && canLaunchInActivityView(mContext, e)) { |
| 333 | updateBubble(e, /* suppressFlyout= */ true); |
| 334 | } |
| 335 | } |
| 336 | // Finally, remove the entries for this user now that bubbles are restored. |
| 337 | mSavedBubbleKeysPerUser.remove(mCurrentUserId); |
| 338 | } |
| 339 | |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 340 | @Override |
| 341 | public void onUiModeChanged() { |
| 342 | if (mStackView != null) { |
Lyn Han | 02cca81 | 2019-04-02 16:27:32 -0700 | [diff] [blame] | 343 | mStackView.onThemeChanged(); |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 344 | } |
| 345 | } |
| 346 | |
| 347 | @Override |
| 348 | public void onOverlayChanged() { |
| 349 | if (mStackView != null) { |
Lyn Han | 02cca81 | 2019-04-02 16:27:32 -0700 | [diff] [blame] | 350 | mStackView.onThemeChanged(); |
Lyn Han | f1c9b8b | 2019-03-14 16:49:48 -0700 | [diff] [blame] | 351 | } |
| 352 | } |
| 353 | |
Joshua Tsuji | f418f9e | 2019-04-04 17:09:53 -0400 | [diff] [blame] | 354 | @Override |
| 355 | public void onConfigChanged(Configuration newConfig) { |
| 356 | if (mStackView != null && newConfig != null && newConfig.orientation != mOrientation) { |
Joshua Tsuji | f418f9e | 2019-04-04 17:09:53 -0400 | [diff] [blame] | 357 | mOrientation = newConfig.orientation; |
Lyn Han | f473031 | 2019-06-18 11:18:58 -0700 | [diff] [blame] | 358 | mStackView.onOrientationChanged(newConfig.orientation); |
Joshua Tsuji | f418f9e | 2019-04-04 17:09:53 -0400 | [diff] [blame] | 359 | } |
| 360 | } |
| 361 | |
Mady Mellor | 5549dd2 | 2018-11-06 18:07:34 -0800 | [diff] [blame] | 362 | /** |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 363 | * Set a listener to be notified when some states of the bubbles change. |
| 364 | */ |
| 365 | public void setBubbleStateChangeListener(BubbleStateChangeListener listener) { |
| 366 | mStateChangeListener = listener; |
| 367 | } |
| 368 | |
| 369 | /** |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 370 | * Set a listener to be notified of bubble expand events. |
| 371 | */ |
| 372 | public void setExpandListener(BubbleExpandListener listener) { |
Issei Suzuki | ac9fcb7 | 2019-02-04 17:45:57 +0100 | [diff] [blame] | 373 | mExpandListener = ((isExpanding, key) -> { |
| 374 | if (listener != null) { |
| 375 | listener.onBubbleExpandChanged(isExpanding, key); |
| 376 | } |
| 377 | mStatusBarWindowController.setBubbleExpanded(isExpanding); |
| 378 | }); |
Mady Mellor | cd9b130 | 2018-11-06 18:08:04 -0800 | [diff] [blame] | 379 | if (mStackView != null) { |
| 380 | mStackView.setExpandListener(mExpandListener); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | /** |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 385 | * Whether or not there are bubbles present, regardless of them being visible on the |
| 386 | * screen (e.g. if on AOD). |
| 387 | */ |
| 388 | public boolean hasBubbles() { |
Mady Mellor | 3dff9e6 | 2019-02-05 18:12:53 -0800 | [diff] [blame] | 389 | if (mStackView == null) { |
| 390 | return false; |
| 391 | } |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 392 | return mBubbleData.hasBubbles(); |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Whether the stack of bubbles is expanded or not. |
| 397 | */ |
| 398 | public boolean isStackExpanded() { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 399 | return mBubbleData.isExpanded(); |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * Tell the stack of bubbles to expand. |
| 404 | */ |
| 405 | public void expandStack() { |
| 406 | mBubbleData.setExpanded(true); |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Tell the stack of bubbles to collapse. |
| 411 | */ |
| 412 | public void collapseStack() { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 413 | mBubbleData.setExpanded(false /* expanded */); |
| 414 | } |
| 415 | |
Mady Mellor | ce23c46 | 2019-06-17 17:30:07 -0700 | [diff] [blame] | 416 | /** |
| 417 | * Whether (1) there is a bubble associated with the provided key and |
| 418 | * (2) if the notification for that bubble is hidden from the shade. |
| 419 | * |
| 420 | * False if there isn't a bubble or if the notification for that bubble appears in the shade. |
| 421 | */ |
| 422 | public boolean isBubbleNotificationSuppressedFromShade(String key) { |
| 423 | return mBubbleData.hasBubbleWithKey(key) |
| 424 | && !mBubbleData.getBubbleWithKey(key).showInShadeWhenBubble(); |
| 425 | } |
| 426 | |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 427 | void selectBubble(Bubble bubble) { |
| 428 | mBubbleData.setSelectedBubble(bubble); |
| 429 | } |
| 430 | |
| 431 | @VisibleForTesting |
| 432 | void selectBubble(String key) { |
| 433 | Bubble bubble = mBubbleData.getBubbleWithKey(key); |
| 434 | selectBubble(bubble); |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | /** |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 438 | * Request the stack expand if needed, then select the specified Bubble as current. |
| 439 | * |
| 440 | * @param notificationKey the notification key for the bubble to be selected |
| 441 | */ |
| 442 | public void expandStackAndSelectBubble(String notificationKey) { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 443 | Bubble bubble = mBubbleData.getBubbleWithKey(notificationKey); |
| 444 | if (bubble != null) { |
| 445 | mBubbleData.setSelectedBubble(bubble); |
| 446 | mBubbleData.setExpanded(true); |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 447 | } |
| 448 | } |
| 449 | |
| 450 | /** |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 451 | * Tell the stack of bubbles to be dismissed, this will remove all of the bubbles in the stack. |
| 452 | */ |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 453 | void dismissStack(@DismissReason int reason) { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 454 | mBubbleData.dismissAll(reason); |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 455 | } |
| 456 | |
| 457 | /** |
Mark Renouf | 041d726 | 2019-02-06 12:09:41 -0500 | [diff] [blame] | 458 | * Directs a back gesture at the bubble stack. When opened, the current expanded bubble |
| 459 | * is forwarded a back key down/up pair. |
| 460 | */ |
| 461 | public void performBackPressIfNeeded() { |
| 462 | if (mStackView != null) { |
| 463 | mStackView.performBackPressIfNeeded(); |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | /** |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 468 | * Adds or updates a bubble associated with the provided notification entry. |
| 469 | * |
Mark Renouf | 8b6a3c6 | 2019-04-09 10:17:40 -0400 | [diff] [blame] | 470 | * @param notif the notification associated with this bubble. |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 471 | */ |
Mark Renouf | f97ed46 | 2019-04-05 13:46:24 -0400 | [diff] [blame] | 472 | void updateBubble(NotificationEntry notif) { |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 473 | updateBubble(notif, /* supressFlyout */ false); |
| 474 | } |
| 475 | |
| 476 | void updateBubble(NotificationEntry notif, boolean suppressFlyout) { |
Mady Mellor | 66efd5e | 2019-05-15 13:38:11 -0700 | [diff] [blame] | 477 | // If this is an interruptive notif, mark that it's interrupted |
| 478 | if (notif.importance >= NotificationManager.IMPORTANCE_HIGH) { |
| 479 | notif.setInterruption(); |
| 480 | } |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 481 | mBubbleData.notificationEntryUpdated(notif, suppressFlyout); |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Removes the bubble associated with the {@param uri}. |
Mark Renouf | 658c6bc | 2019-01-30 10:26:54 -0500 | [diff] [blame] | 486 | * <p> |
| 487 | * Must be called from the main thread. |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 488 | */ |
Mark Renouf | 658c6bc | 2019-01-30 10:26:54 -0500 | [diff] [blame] | 489 | @MainThread |
Mark Renouf | 08bc42a | 2019-03-07 13:01:59 -0500 | [diff] [blame] | 490 | void removeBubble(String key, int reason) { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 491 | // TEMP: refactor to change this to pass entry |
| 492 | Bubble bubble = mBubbleData.getBubbleWithKey(key); |
| 493 | if (bubble != null) { |
Mady Mellor | ed99c27 | 2019-06-13 15:58:30 -0700 | [diff] [blame] | 494 | mBubbleData.notificationEntryRemoved(bubble.getEntry(), reason); |
Mady Mellor | e8e0771 | 2019-01-23 12:45:33 -0800 | [diff] [blame] | 495 | } |
| 496 | } |
| 497 | |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 498 | @SuppressWarnings("FieldCanBeLocal") |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 499 | private final NotificationRemoveInterceptor mRemoveInterceptor = |
| 500 | new NotificationRemoveInterceptor() { |
| 501 | @Override |
| 502 | public boolean onNotificationRemoveRequested(String key, int reason) { |
| 503 | if (!mBubbleData.hasBubbleWithKey(key)) { |
| 504 | return false; |
| 505 | } |
Mady Mellor | ed99c27 | 2019-06-13 15:58:30 -0700 | [diff] [blame] | 506 | Bubble bubble = mBubbleData.getBubbleWithKey(key); |
| 507 | NotificationEntry entry = bubble.getEntry(); |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 508 | |
| 509 | final boolean isClearAll = reason == REASON_CANCEL_ALL; |
| 510 | final boolean isUserDimiss = reason == REASON_CANCEL; |
| 511 | final boolean isAppCancel = reason == REASON_APP_CANCEL |
| 512 | || reason == REASON_APP_CANCEL_ALL; |
| 513 | |
| 514 | // Need to check for !appCancel here because the notification may have |
| 515 | // previously been dismissed & entry.isRowDismissed would still be true |
| 516 | boolean userRemovedNotif = (entry.isRowDismissed() && !isAppCancel) |
| 517 | || isClearAll || isUserDimiss; |
| 518 | |
| 519 | // The bubble notification sticks around in the data as long as the bubble is |
| 520 | // not dismissed and the app hasn't cancelled the notification. |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 521 | boolean bubbleExtended = entry.isBubble() && userRemovedNotif; |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 522 | if (bubbleExtended) { |
Mady Mellor | ce23c46 | 2019-06-17 17:30:07 -0700 | [diff] [blame] | 523 | bubble.setShowInShadeWhenBubble(false); |
Mady Mellor | df48d0a | 2019-06-25 18:26:46 -0700 | [diff] [blame] | 524 | bubble.setShowBubbleDot(false); |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 525 | if (mStackView != null) { |
| 526 | mStackView.updateDotVisibility(entry.key); |
| 527 | } |
| 528 | mNotificationEntryManager.updateNotifications(); |
| 529 | return true; |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 530 | } else if (!userRemovedNotif) { |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 531 | // This wasn't a user removal so we should remove the bubble as well |
| 532 | mBubbleData.notificationEntryRemoved(entry, DISMISS_NOTIF_CANCEL); |
| 533 | return false; |
| 534 | } |
| 535 | return false; |
| 536 | } |
| 537 | }; |
| 538 | |
| 539 | @SuppressWarnings("FieldCanBeLocal") |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 540 | private final NotificationEntryListener mEntryListener = new NotificationEntryListener() { |
| 541 | @Override |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 542 | public void onPendingEntryAdded(NotificationEntry entry) { |
Mady Mellor | f6e3ac0 | 2019-01-29 10:37:52 -0800 | [diff] [blame] | 543 | if (!areBubblesEnabled(mContext)) { |
| 544 | return; |
| 545 | } |
Mady Mellor | ca0c24c | 2019-05-16 16:14:32 -0700 | [diff] [blame] | 546 | if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) |
| 547 | && canLaunchInActivityView(mContext, entry)) { |
Mark Renouf | f97ed46 | 2019-04-05 13:46:24 -0400 | [diff] [blame] | 548 | updateBubble(entry); |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 549 | } |
| 550 | } |
| 551 | |
| 552 | @Override |
| 553 | public void onPreEntryUpdated(NotificationEntry entry) { |
Mady Mellor | f6e3ac0 | 2019-01-29 10:37:52 -0800 | [diff] [blame] | 554 | if (!areBubblesEnabled(mContext)) { |
| 555 | return; |
| 556 | } |
Mady Mellor | ca0c24c | 2019-05-16 16:14:32 -0700 | [diff] [blame] | 557 | boolean shouldBubble = mNotificationInterruptionStateProvider.shouldBubbleUp(entry) |
| 558 | && canLaunchInActivityView(mContext, entry); |
Mady Mellor | aa8fef2 | 2019-04-11 13:36:40 -0700 | [diff] [blame] | 559 | if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.key)) { |
| 560 | // It was previously a bubble but no longer a bubble -- lets remove it |
| 561 | removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE); |
Mady Mellor | ff40e01 | 2019-05-03 15:34:41 -0700 | [diff] [blame] | 562 | } else if (shouldBubble) { |
Mady Mellor | ed99c27 | 2019-06-13 15:58:30 -0700 | [diff] [blame] | 563 | Bubble b = mBubbleData.getBubbleWithKey(entry.key); |
Mark Renouf | f97ed46 | 2019-04-05 13:46:24 -0400 | [diff] [blame] | 564 | updateBubble(entry); |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 565 | } |
| 566 | } |
Mark Renouf | bbcf07f | 2019-05-09 10:42:43 -0400 | [diff] [blame] | 567 | |
| 568 | @Override |
| 569 | public void onNotificationRankingUpdated(RankingMap rankingMap) { |
| 570 | // Forward to BubbleData to block any bubbles which should no longer be shown |
| 571 | mBubbleData.notificationRankingUpdated(rankingMap); |
| 572 | } |
Ned Burns | 01e3821 | 2019-01-03 16:32:52 -0500 | [diff] [blame] | 573 | }; |
| 574 | |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 575 | @SuppressWarnings("FieldCanBeLocal") |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 576 | private final BubbleData.Listener mBubbleDataListener = new BubbleData.Listener() { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 577 | |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 578 | @Override |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 579 | public void applyUpdate(BubbleData.Update update) { |
| 580 | if (mStackView == null && update.addedBubble != null) { |
| 581 | // Lazy init stack view when the first bubble is added. |
| 582 | ensureStackViewCreated(); |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 583 | } |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 584 | |
| 585 | // If not yet initialized, ignore all other changes. |
| 586 | if (mStackView == null) { |
| 587 | return; |
| 588 | } |
| 589 | |
| 590 | if (update.addedBubble != null) { |
| 591 | mStackView.addBubble(update.addedBubble); |
| 592 | } |
| 593 | |
| 594 | // Collapsing? Do this first before remaining steps. |
| 595 | if (update.expandedChanged && !update.expanded) { |
| 596 | mStackView.setExpanded(false); |
| 597 | } |
| 598 | |
| 599 | // Do removals, if any. |
| 600 | for (Pair<Bubble, Integer> removed : update.removedBubbles) { |
| 601 | final Bubble bubble = removed.first; |
| 602 | @DismissReason final int reason = removed.second; |
| 603 | mStackView.removeBubble(bubble); |
| 604 | |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 605 | // If the bubble is removed for user switching, leave the notification in place. |
| 606 | if (reason != DISMISS_USER_CHANGED) { |
| 607 | if (!mBubbleData.hasBubbleWithKey(bubble.getKey()) |
| 608 | && !bubble.showInShadeWhenBubble()) { |
| 609 | // The bubble is gone & the notification is gone, time to actually remove it |
| 610 | mNotificationEntryManager.performRemoveNotification( |
| 611 | bubble.getEntry().notification, UNDEFINED_DISMISS_REASON); |
| 612 | } else { |
| 613 | // Update the flag for SysUI |
| 614 | bubble.getEntry().notification.getNotification().flags &= ~FLAG_BUBBLE; |
Mady Mellor | 3a0a1b4 | 2019-05-23 06:40:21 -0700 | [diff] [blame] | 615 | |
Mark Renouf | c19b473 | 2019-06-26 12:08:33 -0400 | [diff] [blame] | 616 | // Make sure NoMan knows it's not a bubble anymore so anyone querying it |
| 617 | // will get right result back |
| 618 | try { |
| 619 | mBarService.onNotificationBubbleChanged(bubble.getKey(), |
| 620 | false /* isBubble */); |
| 621 | } catch (RemoteException e) { |
| 622 | // Bad things have happened |
| 623 | } |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 624 | } |
Mady Mellor | a54e9fa | 2019-04-18 13:26:18 -0700 | [diff] [blame] | 625 | } |
| 626 | } |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 627 | |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 628 | if (update.updatedBubble != null) { |
| 629 | mStackView.updateBubble(update.updatedBubble); |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 630 | } |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 631 | |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 632 | if (update.orderChanged) { |
| 633 | mStackView.updateBubbleOrder(update.bubbles); |
Mark Renouf | ba5ab51 | 2019-05-02 15:21:01 -0400 | [diff] [blame] | 634 | } |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 635 | |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 636 | if (update.selectionChanged) { |
| 637 | mStackView.setSelectedBubble(update.selectedBubble); |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 638 | } |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 639 | |
Mark Renouf | 82a40e6 | 2019-05-23 16:16:24 -0400 | [diff] [blame] | 640 | // Expanding? Apply this last. |
| 641 | if (update.expandedChanged && update.expanded) { |
| 642 | mStackView.setExpanded(true); |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 643 | } |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 644 | |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 645 | mNotificationEntryManager.updateNotifications(); |
Lyn Han | 6c40fe7 | 2019-05-08 14:06:33 -0700 | [diff] [blame] | 646 | updateStack(); |
Mark Renouf | 9ba6cea | 2019-04-17 11:53:50 -0400 | [diff] [blame] | 647 | |
Issei Suzuki | a8d0731 | 2019-06-07 12:56:19 +0200 | [diff] [blame] | 648 | if (DEBUG_BUBBLE_CONTROLLER) { |
Mark Renouf | 9ba6cea | 2019-04-17 11:53:50 -0400 | [diff] [blame] | 649 | Log.d(TAG, "[BubbleData]"); |
| 650 | Log.d(TAG, formatBubblesString(mBubbleData.getBubbles(), |
| 651 | mBubbleData.getSelectedBubble())); |
| 652 | |
| 653 | if (mStackView != null) { |
| 654 | Log.d(TAG, "[BubbleStackView]"); |
| 655 | Log.d(TAG, formatBubblesString(mStackView.getBubblesOnScreen(), |
| 656 | mStackView.getExpandedBubble())); |
| 657 | } |
| 658 | } |
Mark Renouf | 3bc5b36 | 2019-04-05 14:37:59 -0400 | [diff] [blame] | 659 | } |
| 660 | }; |
| 661 | |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 662 | /** |
Joshua Tsuji | dd4d9f9 | 2019-05-13 13:57:38 -0400 | [diff] [blame] | 663 | * Lets any listeners know if bubble state has changed. |
Lyn Han | 6c40fe7 | 2019-05-08 14:06:33 -0700 | [diff] [blame] | 664 | * Updates the visibility of the bubbles based on current state. |
| 665 | * Does not un-bubble, just hides or un-hides. Notifies any |
| 666 | * {@link BubbleStateChangeListener}s of visibility changes. |
| 667 | * Updates stack description for TalkBack focus. |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 668 | */ |
Lyn Han | 6c40fe7 | 2019-05-08 14:06:33 -0700 | [diff] [blame] | 669 | public void updateStack() { |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 670 | if (mStackView == null) { |
| 671 | return; |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 672 | } |
Mady Mellor | 3f2efdb | 2018-11-21 11:30:45 -0800 | [diff] [blame] | 673 | if (mStatusBarStateListener.getCurrentState() == SHADE && hasBubbles()) { |
| 674 | // Bubbles only appear in unlocked shade |
| 675 | mStackView.setVisibility(hasBubbles() ? VISIBLE : INVISIBLE); |
| 676 | } else if (mStackView != null) { |
| 677 | mStackView.setVisibility(INVISIBLE); |
Mady Mellor | 5549dd2 | 2018-11-06 18:07:34 -0800 | [diff] [blame] | 678 | } |
Lyn Han | 6c40fe7 | 2019-05-08 14:06:33 -0700 | [diff] [blame] | 679 | |
| 680 | // Let listeners know if bubble state changed. |
| 681 | boolean hadBubbles = mStatusBarWindowController.getBubblesShowing(); |
| 682 | boolean hasBubblesShowing = hasBubbles() && mStackView.getVisibility() == VISIBLE; |
| 683 | mStatusBarWindowController.setBubblesShowing(hasBubblesShowing); |
| 684 | if (mStateChangeListener != null && hadBubbles != hasBubblesShowing) { |
| 685 | mStateChangeListener.onHasBubblesChanged(hasBubblesShowing); |
| 686 | } |
| 687 | |
| 688 | mStackView.updateContentDescription(); |
Mady Mellor | d1c78b26 | 2018-11-06 18:04:40 -0800 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | /** |
| 692 | * Rect indicating the touchable region for the bubble stack / expanded stack. |
| 693 | */ |
| 694 | public Rect getTouchableRegion() { |
| 695 | if (mStackView == null || mStackView.getVisibility() != VISIBLE) { |
| 696 | return null; |
| 697 | } |
| 698 | mStackView.getBoundsOnScreen(mTempRect); |
| 699 | return mTempRect; |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 700 | } |
| 701 | |
Mady Mellor | 390bff4 | 2019-04-05 15:09:01 -0700 | [diff] [blame] | 702 | /** |
| 703 | * The display id of the expanded view, if the stack is expanded and not occluded by the |
| 704 | * status bar, otherwise returns {@link Display#INVALID_DISPLAY}. |
| 705 | */ |
| 706 | public int getExpandedDisplayId(Context context) { |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 707 | final Bubble bubble = getExpandedBubble(context); |
| 708 | return bubble != null ? bubble.getDisplayId() : INVALID_DISPLAY; |
| 709 | } |
| 710 | |
| 711 | @Nullable |
| 712 | private Bubble getExpandedBubble(Context context) { |
Joel Galenson | 4071ddb | 2019-04-18 13:30:45 -0700 | [diff] [blame] | 713 | if (mStackView == null) { |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 714 | return null; |
Joel Galenson | 4071ddb | 2019-04-18 13:30:45 -0700 | [diff] [blame] | 715 | } |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 716 | final boolean defaultDisplay = context.getDisplay() != null |
Mady Mellor | 390bff4 | 2019-04-05 15:09:01 -0700 | [diff] [blame] | 717 | && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY; |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 718 | final Bubble expandedBubble = mStackView.getExpandedBubble(); |
| 719 | if (defaultDisplay && expandedBubble != null && isStackExpanded() |
Mady Mellor | 390bff4 | 2019-04-05 15:09:01 -0700 | [diff] [blame] | 720 | && !mStatusBarWindowController.getPanelExpanded()) { |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 721 | return expandedBubble; |
Mady Mellor | 390bff4 | 2019-04-05 15:09:01 -0700 | [diff] [blame] | 722 | } |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 723 | return null; |
Mady Mellor | 390bff4 | 2019-04-05 15:09:01 -0700 | [diff] [blame] | 724 | } |
| 725 | |
Mady Mellor | f6e3ac0 | 2019-01-29 10:37:52 -0800 | [diff] [blame] | 726 | @VisibleForTesting |
| 727 | BubbleStackView getStackView() { |
| 728 | return mStackView; |
| 729 | } |
| 730 | |
Mady Mellor | 70cba7bb | 2019-07-02 15:06:07 -0700 | [diff] [blame] | 731 | /** |
| 732 | * Description of current bubble state. |
| 733 | */ |
| 734 | public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 735 | pw.println("BubbleController state:"); |
| 736 | mBubbleData.dump(fd, pw, args); |
| 737 | pw.println(); |
Joshua Tsuji | 395bcfe | 2019-07-02 19:23:23 -0400 | [diff] [blame] | 738 | if (mStackView != null) { |
| 739 | mStackView.dump(fd, pw, args); |
| 740 | } |
| 741 | pw.println(); |
Mady Mellor | 70cba7bb | 2019-07-02 15:06:07 -0700 | [diff] [blame] | 742 | } |
| 743 | |
Mark Renouf | 9ba6cea | 2019-04-17 11:53:50 -0400 | [diff] [blame] | 744 | static String formatBubblesString(List<Bubble> bubbles, Bubble selected) { |
| 745 | StringBuilder sb = new StringBuilder(); |
| 746 | for (Bubble bubble : bubbles) { |
| 747 | if (bubble == null) { |
| 748 | sb.append(" <null> !!!!!\n"); |
| 749 | } else { |
| 750 | boolean isSelected = (bubble == selected); |
| 751 | sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n", |
| 752 | ((isSelected) ? "->" : " "), |
| 753 | bubble.getLastActivity(), |
| 754 | (bubble.isOngoing() ? 1 : 0), |
| 755 | bubble.getKey())); |
| 756 | } |
| 757 | } |
| 758 | return sb.toString(); |
| 759 | } |
| 760 | |
Mady Mellor | e80930e | 2019-03-21 16:00:45 -0700 | [diff] [blame] | 761 | /** |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 762 | * This task stack listener is responsible for responding to tasks moved to the front |
| 763 | * which are on the default (main) display. When this happens, expanded bubbles must be |
| 764 | * collapsed so the user may interact with the app which was just moved to the front. |
| 765 | * <p> |
| 766 | * This listener is registered with SystemUI's ActivityManagerWrapper which dispatches |
| 767 | * these calls via a main thread Handler. |
| 768 | */ |
| 769 | @MainThread |
| 770 | private class BubbleTaskStackListener extends TaskStackChangeListener { |
| 771 | |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 772 | @Override |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 773 | public void onTaskMovedToFront(RunningTaskInfo taskInfo) { |
| 774 | if (mStackView != null && taskInfo.displayId == Display.DEFAULT_DISPLAY) { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 775 | mBubbleData.setExpanded(false); |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 776 | } |
| 777 | } |
| 778 | |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 779 | @Override |
Mark Renouf | a12e876 | 2019-03-07 15:43:01 -0500 | [diff] [blame] | 780 | public void onActivityLaunchOnSecondaryDisplayRerouted() { |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 781 | if (mStackView != null) { |
Mark Renouf | 71a3af6 | 2019-04-08 15:02:54 -0400 | [diff] [blame] | 782 | mBubbleData.setExpanded(false); |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 783 | } |
| 784 | } |
Mark Renouf | 446251d | 2019-04-26 10:22:41 -0400 | [diff] [blame] | 785 | |
| 786 | @Override |
| 787 | public void onBackPressedOnTaskRoot(RunningTaskInfo taskInfo) { |
| 788 | if (mStackView != null && taskInfo.displayId == getExpandedDisplayId(mContext)) { |
| 789 | mBubbleData.setExpanded(false); |
| 790 | } |
| 791 | } |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 792 | |
| 793 | @Override |
| 794 | public void onSingleTaskDisplayDrawn(int displayId) { |
| 795 | final Bubble expandedBubble = getExpandedBubble(mContext); |
| 796 | if (expandedBubble != null && expandedBubble.getDisplayId() == displayId) { |
| 797 | expandedBubble.setContentVisibility(true); |
| 798 | } |
| 799 | } |
Issei Suzuki | 734bc94 | 2019-06-05 13:59:52 +0200 | [diff] [blame] | 800 | |
| 801 | @Override |
| 802 | public void onSingleTaskDisplayEmpty(int displayId) { |
| 803 | final Bubble expandedBubble = getExpandedBubble(mContext); |
| 804 | if (expandedBubble == null) { |
| 805 | return; |
| 806 | } |
| 807 | if (expandedBubble.getDisplayId() == displayId) { |
| 808 | mBubbleData.setExpanded(false); |
| 809 | } |
Mady Mellor | ed99c27 | 2019-06-13 15:58:30 -0700 | [diff] [blame] | 810 | if (expandedBubble.getExpandedView() != null) { |
| 811 | expandedBubble.getExpandedView().notifyDisplayEmpty(); |
Issei Suzuki | 734bc94 | 2019-06-05 13:59:52 +0200 | [diff] [blame] | 812 | } |
| 813 | } |
Mark Renouf | cecc77b | 2019-01-30 16:32:24 -0500 | [diff] [blame] | 814 | } |
| 815 | |
Mady Mellor | f6e3ac0 | 2019-01-29 10:37:52 -0800 | [diff] [blame] | 816 | private static boolean areBubblesEnabled(Context context) { |
| 817 | return Settings.Secure.getInt(context.getContentResolver(), |
| 818 | ENABLE_BUBBLES, 1) != 0; |
| 819 | } |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 820 | |
Mady Mellor | ca0c24c | 2019-05-16 16:14:32 -0700 | [diff] [blame] | 821 | /** |
| 822 | * Whether an intent is properly configured to display in an {@link android.app.ActivityView}. |
| 823 | * |
| 824 | * Keep checks in sync with NotificationManagerService#canLaunchInActivityView. Typically |
| 825 | * that should filter out any invalid bubbles, but should protect SysUI side just in case. |
| 826 | * |
| 827 | * @param context the context to use. |
| 828 | * @param entry the entry to bubble. |
| 829 | */ |
| 830 | static boolean canLaunchInActivityView(Context context, NotificationEntry entry) { |
| 831 | PendingIntent intent = entry.getBubbleMetadata() != null |
| 832 | ? entry.getBubbleMetadata().getIntent() |
| 833 | : null; |
| 834 | if (intent == null) { |
| 835 | Log.w(TAG, "Unable to create bubble -- no intent"); |
| 836 | return false; |
| 837 | } |
| 838 | ActivityInfo info = |
| 839 | intent.getIntent().resolveActivityInfo(context.getPackageManager(), 0); |
| 840 | if (info == null) { |
| 841 | Log.w(TAG, "Unable to send as bubble -- couldn't find activity info for intent: " |
| 842 | + intent); |
| 843 | return false; |
| 844 | } |
| 845 | if (!ActivityInfo.isResizeableMode(info.resizeMode)) { |
| 846 | Log.w(TAG, "Unable to send as bubble -- activity is not resizable for intent: " |
| 847 | + intent); |
| 848 | return false; |
| 849 | } |
| 850 | if (info.documentLaunchMode != DOCUMENT_LAUNCH_ALWAYS) { |
| 851 | Log.w(TAG, "Unable to send as bubble -- activity is not documentLaunchMode=always " |
| 852 | + "for intent: " + intent); |
| 853 | return false; |
| 854 | } |
| 855 | if ((info.flags & ActivityInfo.FLAG_ALLOW_EMBEDDED) == 0) { |
| 856 | Log.w(TAG, "Unable to send as bubble -- activity is not embeddable for intent: " |
| 857 | + intent); |
| 858 | return false; |
| 859 | } |
| 860 | return true; |
| 861 | } |
| 862 | |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 863 | /** PinnedStackListener that dispatches IME visibility updates to the stack. */ |
| 864 | private class BubblesImeListener extends IPinnedStackListener.Stub { |
| 865 | |
| 866 | @Override |
| 867 | public void onListenerRegistered(IPinnedStackController controller) throws RemoteException { |
| 868 | } |
| 869 | |
| 870 | @Override |
| 871 | public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, |
| 872 | Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment, |
| 873 | int displayRotation) throws RemoteException {} |
| 874 | |
| 875 | @Override |
Joshua Tsuji | d942283 | 2019-03-05 13:32:37 -0500 | [diff] [blame] | 876 | public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) { |
| 877 | if (mStackView != null && mStackView.getBubbleCount() > 0) { |
| 878 | mStackView.post(() -> mStackView.onImeVisibilityChanged(imeVisible, imeHeight)); |
Joshua Tsuji | a19515f | 2019-02-13 18:02:29 -0500 | [diff] [blame] | 879 | } |
| 880 | } |
| 881 | |
| 882 | @Override |
| 883 | public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) |
| 884 | throws RemoteException {} |
| 885 | |
| 886 | @Override |
| 887 | public void onMinimizedStateChanged(boolean isMinimized) throws RemoteException {} |
| 888 | |
| 889 | @Override |
| 890 | public void onActionsChanged(ParceledListSlice actions) throws RemoteException {} |
| 891 | } |
Mady Mellor | c3d6f7d | 2018-11-07 09:36:56 -0800 | [diff] [blame] | 892 | } |