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