Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [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.statusbar.phone; |
| 18 | |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 19 | import static android.service.notification.NotificationListenerService.REASON_CLICK; |
| 20 | |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 21 | import static com.android.systemui.statusbar.phone.StatusBar.getActivityOptions; |
| 22 | |
| 23 | import android.app.ActivityManager; |
| 24 | import android.app.ActivityTaskManager; |
| 25 | import android.app.KeyguardManager; |
| 26 | import android.app.Notification; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 27 | import android.app.NotificationManager; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 28 | import android.app.PendingIntent; |
| 29 | import android.app.TaskStackBuilder; |
| 30 | import android.content.Context; |
| 31 | import android.content.Intent; |
| 32 | import android.os.AsyncTask; |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 33 | import android.os.Handler; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 34 | import android.os.Looper; |
| 35 | import android.os.RemoteException; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 36 | import android.os.UserHandle; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 37 | import android.service.dreams.IDreamManager; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 38 | import android.service.notification.StatusBarNotification; |
| 39 | import android.text.TextUtils; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 40 | import android.util.EventLog; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 41 | import android.util.Log; |
| 42 | import android.view.RemoteAnimationAdapter; |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 43 | import android.view.View; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 44 | |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 45 | import com.android.internal.logging.MetricsLogger; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 46 | import com.android.internal.statusbar.IStatusBarService; |
| 47 | import com.android.internal.statusbar.NotificationVisibility; |
| 48 | import com.android.internal.widget.LockPatternUtils; |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 49 | import com.android.systemui.ActivityIntentHelper; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 50 | import com.android.systemui.EventLogTags; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 51 | import com.android.systemui.assist.AssistManager; |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 52 | import com.android.systemui.bubbles.BubbleController; |
Dave Mankoff | 00e8a2f | 2019-12-18 16:59:49 -0500 | [diff] [blame] | 53 | import com.android.systemui.dagger.qualifiers.Background; |
| 54 | import com.android.systemui.dagger.qualifiers.Main; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 55 | import com.android.systemui.dagger.qualifiers.UiBackground; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 56 | import com.android.systemui.plugins.ActivityStarter; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 57 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 58 | import com.android.systemui.statusbar.CommandQueue; |
| 59 | import com.android.systemui.statusbar.NotificationLockscreenUserManager; |
| 60 | import com.android.systemui.statusbar.NotificationPresenter; |
| 61 | import com.android.systemui.statusbar.NotificationRemoteInputManager; |
| 62 | import com.android.systemui.statusbar.RemoteInputController; |
| 63 | import com.android.systemui.statusbar.StatusBarState; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 64 | import com.android.systemui.statusbar.SuperStatusBarViewFactory; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 65 | import com.android.systemui.statusbar.notification.ActivityLaunchAnimator; |
| 66 | import com.android.systemui.statusbar.notification.NotificationActivityStarter; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 67 | import com.android.systemui.statusbar.notification.NotificationEntryListener; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 68 | import com.android.systemui.statusbar.notification.NotificationEntryManager; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 69 | import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 70 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Gustav Sennton | f892fe9 | 2019-01-22 15:31:42 +0000 | [diff] [blame] | 71 | import com.android.systemui.statusbar.notification.logging.NotificationLogger; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 72 | import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; |
| 73 | import com.android.systemui.statusbar.policy.HeadsUpUtil; |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 74 | import com.android.systemui.statusbar.policy.KeyguardStateController; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 75 | |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 76 | import java.util.concurrent.Executor; |
| 77 | |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 78 | import javax.inject.Inject; |
| 79 | import javax.inject.Singleton; |
| 80 | |
| 81 | import dagger.Lazy; |
| 82 | |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 83 | /** |
| 84 | * Status bar implementation of {@link NotificationActivityStarter}. |
| 85 | */ |
| 86 | public class StatusBarNotificationActivityStarter implements NotificationActivityStarter { |
| 87 | |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 88 | private static final String TAG = "NotifActivityStarter"; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 89 | protected static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 90 | |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 91 | private final Lazy<AssistManager> mAssistManagerLazy; |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 92 | private final NotificationGroupManager mGroupManager; |
| 93 | private final StatusBarRemoteInputCallback mStatusBarRemoteInputCallback; |
| 94 | private final NotificationRemoteInputManager mRemoteInputManager; |
| 95 | private final NotificationLockscreenUserManager mLockscreenUserManager; |
| 96 | private final ShadeController mShadeController; |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 97 | private final StatusBar mStatusBar; |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 98 | private final KeyguardStateController mKeyguardStateController; |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 99 | private final ActivityStarter mActivityStarter; |
| 100 | private final NotificationEntryManager mEntryManager; |
| 101 | private final StatusBarStateController mStatusBarStateController; |
| 102 | private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider; |
| 103 | private final MetricsLogger mMetricsLogger; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 104 | private final Context mContext; |
| 105 | private final NotificationPanelView mNotificationPanel; |
| 106 | private final NotificationPresenter mPresenter; |
| 107 | private final LockPatternUtils mLockPatternUtils; |
| 108 | private final HeadsUpManagerPhone mHeadsUpManager; |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 109 | private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 110 | private final KeyguardManager mKeyguardManager; |
| 111 | private final ActivityLaunchAnimator mActivityLaunchAnimator; |
| 112 | private final IStatusBarService mBarService; |
| 113 | private final CommandQueue mCommandQueue; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 114 | private final IDreamManager mDreamManager; |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 115 | private final Handler mMainThreadHandler; |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 116 | private final Handler mBackgroundHandler; |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 117 | private final ActivityIntentHelper mActivityIntentHelper; |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 118 | private final BubbleController mBubbleController; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 119 | private final Executor mUiBgExecutor; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 120 | |
| 121 | private boolean mIsCollapsingToShowActivityOverLockscreen; |
| 122 | |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 123 | private StatusBarNotificationActivityStarter(Context context, CommandQueue commandQueue, |
| 124 | Lazy<AssistManager> assistManagerLazy, NotificationPanelView panel, |
| 125 | NotificationPresenter presenter, NotificationEntryManager entryManager, |
| 126 | HeadsUpManagerPhone headsUpManager, ActivityStarter activityStarter, |
| 127 | ActivityLaunchAnimator activityLaunchAnimator, IStatusBarService statusBarService, |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 128 | StatusBarStateController statusBarStateController, |
| 129 | StatusBarKeyguardViewManager statusBarKeyguardViewManager, |
| 130 | KeyguardManager keyguardManager, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 131 | IDreamManager dreamManager, NotificationRemoteInputManager remoteInputManager, |
| 132 | StatusBarRemoteInputCallback remoteInputCallback, NotificationGroupManager groupManager, |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 133 | NotificationLockscreenUserManager lockscreenUserManager, |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 134 | ShadeController shadeController, StatusBar statusBar, |
| 135 | KeyguardStateController keyguardStateController, |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 136 | NotificationInterruptionStateProvider notificationInterruptionStateProvider, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 137 | MetricsLogger metricsLogger, LockPatternUtils lockPatternUtils, |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 138 | Handler mainThreadHandler, Handler backgroundHandler, Executor uiBgExecutor, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 139 | ActivityIntentHelper activityIntentHelper, BubbleController bubbleController) { |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 140 | mContext = context; |
| 141 | mNotificationPanel = panel; |
| 142 | mPresenter = presenter; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 143 | mHeadsUpManager = headsUpManager; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 144 | mActivityLaunchAnimator = activityLaunchAnimator; |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 145 | mBarService = statusBarService; |
| 146 | mCommandQueue = commandQueue; |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 147 | mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 148 | mKeyguardManager = keyguardManager; |
| 149 | mDreamManager = dreamManager; |
| 150 | mRemoteInputManager = remoteInputManager; |
| 151 | mLockscreenUserManager = lockscreenUserManager; |
| 152 | mShadeController = shadeController; |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 153 | // TODO: use KeyguardStateController#isOccluded to remove this dependency |
| 154 | mStatusBar = statusBar; |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 155 | mKeyguardStateController = keyguardStateController; |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 156 | mActivityStarter = activityStarter; |
| 157 | mEntryManager = entryManager; |
| 158 | mStatusBarStateController = statusBarStateController; |
| 159 | mNotificationInterruptionStateProvider = notificationInterruptionStateProvider; |
| 160 | mMetricsLogger = metricsLogger; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 161 | mAssistManagerLazy = assistManagerLazy; |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 162 | mGroupManager = groupManager; |
| 163 | mLockPatternUtils = lockPatternUtils; |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 164 | mBackgroundHandler = backgroundHandler; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 165 | mUiBgExecutor = uiBgExecutor; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 166 | mEntryManager.addNotificationEntryListener(new NotificationEntryListener() { |
| 167 | @Override |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 168 | public void onPendingEntryAdded(NotificationEntry entry) { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 169 | handleFullScreenIntent(entry); |
| 170 | } |
| 171 | }); |
Mark Renouf | 906a93f | 2019-03-15 16:04:58 -0400 | [diff] [blame] | 172 | mStatusBarRemoteInputCallback = remoteInputCallback; |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 173 | mMainThreadHandler = mainThreadHandler; |
| 174 | mActivityIntentHelper = activityIntentHelper; |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 175 | mBubbleController = bubbleController; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Called when a notification is clicked. |
| 180 | * |
| 181 | * @param sbn notification that was clicked |
| 182 | * @param row row for that notification |
| 183 | */ |
| 184 | @Override |
| 185 | public void onNotificationClicked(StatusBarNotification sbn, ExpandableNotificationRow row) { |
| 186 | RemoteInputController controller = mRemoteInputManager.getController(); |
| 187 | if (controller.isRemoteInputActive(row.getEntry()) |
| 188 | && !TextUtils.isEmpty(row.getActiveRemoteInputText())) { |
| 189 | // We have an active remote input typed and the user clicked on the notification. |
| 190 | // this was probably unintentional, so we're closing the edit text instead. |
| 191 | controller.closeRemoteInputs(); |
| 192 | return; |
| 193 | } |
| 194 | Notification notification = sbn.getNotification(); |
| 195 | final PendingIntent intent = notification.contentIntent != null |
| 196 | ? notification.contentIntent |
| 197 | : notification.fullScreenIntent; |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 198 | final boolean isBubble = row.getEntry().isBubble(); |
| 199 | |
| 200 | // This code path is now executed for notification without a contentIntent. |
| 201 | // The only valid case is Bubble notifications. Guard against other cases |
| 202 | // entering here. |
| 203 | if (intent == null && !isBubble) { |
| 204 | Log.e(TAG, "onNotificationClicked called for non-clickable notification!"); |
| 205 | return; |
| 206 | } |
| 207 | |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 208 | boolean isActivityIntent = intent != null && intent.isActivity() && !isBubble; |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 209 | final boolean afterKeyguardGone = isActivityIntent |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 210 | && mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(), |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 211 | mLockscreenUserManager.getCurrentUserId()); |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 212 | final boolean wasOccluded = mStatusBar.isOccluded(); |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 213 | boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 214 | && mActivityIntentHelper.wouldShowOverLockscreen(intent.getIntent(), |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 215 | mLockscreenUserManager.getCurrentUserId()); |
| 216 | ActivityStarter.OnDismissAction postKeyguardAction = |
| 217 | () -> handleNotificationClickAfterKeyguardDismissed( |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 218 | sbn, row, controller, intent, |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 219 | isActivityIntent, wasOccluded, showOverLockscreen); |
| 220 | if (showOverLockscreen) { |
| 221 | mIsCollapsingToShowActivityOverLockscreen = true; |
| 222 | postKeyguardAction.onDismiss(); |
| 223 | } else { |
| 224 | mActivityStarter.dismissKeyguardThenExecute( |
| 225 | postKeyguardAction, null /* cancel */, afterKeyguardGone); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | private boolean handleNotificationClickAfterKeyguardDismissed( |
| 230 | StatusBarNotification sbn, |
| 231 | ExpandableNotificationRow row, |
| 232 | RemoteInputController controller, |
| 233 | PendingIntent intent, |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 234 | boolean isActivityIntent, |
| 235 | boolean wasOccluded, |
| 236 | boolean showOverLockscreen) { |
| 237 | // TODO: Some of this code may be able to move to NotificationEntryManager. |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 238 | if (mHeadsUpManager != null && mHeadsUpManager.isAlerting(sbn.getKey())) { |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 239 | // Release the HUN notification to the shade. |
| 240 | |
| 241 | if (mPresenter.isPresenterFullyCollapsed()) { |
| 242 | HeadsUpUtil.setIsClickedHeadsUpNotification(row, true); |
| 243 | } |
| 244 | // |
| 245 | // In most cases, when FLAG_AUTO_CANCEL is set, the notification will |
| 246 | // become canceled shortly by NoMan, but we can't assume that. |
| 247 | mHeadsUpManager.removeNotification(sbn.getKey(), |
| 248 | true /* releaseImmediately */); |
| 249 | } |
| 250 | StatusBarNotification parentToCancel = null; |
| 251 | if (shouldAutoCancel(sbn) && mGroupManager.isOnlyChildInGroup(sbn)) { |
| 252 | StatusBarNotification summarySbn = |
Ned Burns | 00b4b2d | 2019-10-17 22:09:27 -0400 | [diff] [blame] | 253 | mGroupManager.getLogicalGroupSummary(sbn).getSbn(); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 254 | if (shouldAutoCancel(summarySbn)) { |
| 255 | parentToCancel = summarySbn; |
| 256 | } |
| 257 | } |
| 258 | final StatusBarNotification parentToCancelFinal = parentToCancel; |
| 259 | final Runnable runnable = () -> handleNotificationClickAfterPanelCollapsed( |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 260 | sbn, row, controller, intent, |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 261 | isActivityIntent, wasOccluded, parentToCancelFinal); |
| 262 | |
| 263 | if (showOverLockscreen) { |
| 264 | mShadeController.addPostCollapseAction(runnable); |
| 265 | mShadeController.collapsePanel(true /* animate */); |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 266 | } else if (mKeyguardStateController.isShowing() |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 267 | && mStatusBar.isOccluded()) { |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 268 | mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 269 | mShadeController.collapsePanel(); |
| 270 | } else { |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 271 | mBackgroundHandler.postAtFrontOfQueue(runnable); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 272 | } |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 273 | return !mNotificationPanel.isFullyCollapsed(); |
| 274 | } |
| 275 | |
| 276 | private void handleNotificationClickAfterPanelCollapsed( |
| 277 | StatusBarNotification sbn, |
| 278 | ExpandableNotificationRow row, |
| 279 | RemoteInputController controller, |
| 280 | PendingIntent intent, |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 281 | boolean isActivityIntent, |
| 282 | boolean wasOccluded, |
| 283 | StatusBarNotification parentToCancelFinal) { |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 284 | String notificationKey = sbn.getKey(); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 285 | try { |
| 286 | // The intent we are sending is for the application, which |
| 287 | // won't have permission to immediately start an activity after |
| 288 | // the user switches to home. We know it is safe to do at this |
| 289 | // point, so make sure new activity switches are now allowed. |
| 290 | ActivityManager.getService().resumeAppSwitches(); |
| 291 | } catch (RemoteException e) { |
| 292 | } |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 293 | // If we are launching a work activity and require to launch |
| 294 | // separate work challenge, we defer the activity action and cancel |
| 295 | // notification until work challenge is unlocked. |
| 296 | if (isActivityIntent) { |
| 297 | final int userId = intent.getCreatorUserHandle().getIdentifier(); |
| 298 | if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId) |
| 299 | && mKeyguardManager.isDeviceLocked(userId)) { |
| 300 | // TODO(b/28935539): should allow certain activities to |
| 301 | // bypass work challenge |
| 302 | if (mStatusBarRemoteInputCallback.startWorkChallengeIfNecessary(userId, |
| 303 | intent.getIntentSender(), notificationKey)) { |
| 304 | // Show work challenge, do not run PendingIntent and |
| 305 | // remove notification |
| 306 | collapseOnMainThread(); |
| 307 | return; |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | Intent fillInIntent = null; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 312 | NotificationEntry entry = row.getEntry(); |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 313 | final boolean isBubble = entry.isBubble(); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 314 | CharSequence remoteInputText = null; |
| 315 | if (!TextUtils.isEmpty(entry.remoteInputText)) { |
| 316 | remoteInputText = entry.remoteInputText; |
| 317 | } |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 318 | if (!TextUtils.isEmpty(remoteInputText) && !controller.isSpinning(notificationKey)) { |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 319 | fillInIntent = new Intent().putExtra(Notification.EXTRA_REMOTE_INPUT_DRAFT, |
| 320 | remoteInputText.toString()); |
| 321 | } |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 322 | if (isBubble) { |
| 323 | expandBubbleStackOnMainThread(notificationKey); |
| 324 | } else { |
| 325 | startNotificationIntent(intent, fillInIntent, row, wasOccluded, isActivityIntent); |
| 326 | } |
| 327 | if (isActivityIntent || isBubble) { |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 328 | mAssistManagerLazy.get().hideAssist(); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 329 | } |
| 330 | if (shouldCollapse()) { |
| 331 | collapseOnMainThread(); |
| 332 | } |
| 333 | |
Evan Laird | 181de62 | 2019-10-24 09:53:02 -0400 | [diff] [blame] | 334 | final int count = mEntryManager.getActiveNotificationsCount(); |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 335 | final int rank = entry.getRanking().getRank(); |
Gustav Sennton | f892fe9 | 2019-01-22 15:31:42 +0000 | [diff] [blame] | 336 | NotificationVisibility.NotificationLocation location = |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 337 | NotificationLogger.getNotificationLocation(entry); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 338 | final NotificationVisibility nv = NotificationVisibility.obtain(notificationKey, |
Gustav Sennton | f892fe9 | 2019-01-22 15:31:42 +0000 | [diff] [blame] | 339 | rank, count, true, location); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 340 | try { |
| 341 | mBarService.onNotificationClick(notificationKey, nv); |
| 342 | } catch (RemoteException ex) { |
| 343 | // system process is dead if we're here. |
| 344 | } |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 345 | if (!isBubble) { |
| 346 | if (parentToCancelFinal != null) { |
| 347 | removeNotification(parentToCancelFinal); |
| 348 | } |
| 349 | if (shouldAutoCancel(sbn) |
| 350 | || mRemoteInputManager.isNotificationKeptForRemoteInputHistory( |
| 351 | notificationKey)) { |
| 352 | // Automatically remove all notifications that we may have kept around longer |
| 353 | removeNotification(sbn); |
| 354 | } |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 355 | } |
| 356 | mIsCollapsingToShowActivityOverLockscreen = false; |
| 357 | } |
| 358 | |
Mark Renouf | fec45da | 2019-03-13 13:24:27 -0400 | [diff] [blame] | 359 | private void expandBubbleStackOnMainThread(String notificationKey) { |
| 360 | if (Looper.getMainLooper().isCurrentThread()) { |
| 361 | mBubbleController.expandStackAndSelectBubble(notificationKey); |
| 362 | } else { |
| 363 | mMainThreadHandler.post( |
| 364 | () -> mBubbleController.expandStackAndSelectBubble(notificationKey)); |
| 365 | } |
| 366 | } |
| 367 | |
Mark Renouf | 7bb6a24 | 2019-03-13 12:08:38 -0400 | [diff] [blame] | 368 | private void startNotificationIntent(PendingIntent intent, Intent fillInIntent, |
Evan Laird | 2ec752d | 2019-11-13 19:03:46 -0500 | [diff] [blame] | 369 | View row, boolean wasOccluded, boolean isActivityIntent) { |
Mark Renouf | 7bb6a24 | 2019-03-13 12:08:38 -0400 | [diff] [blame] | 370 | RemoteAnimationAdapter adapter = mActivityLaunchAnimator.getLaunchAnimation(row, |
| 371 | wasOccluded); |
| 372 | try { |
| 373 | if (adapter != null) { |
| 374 | ActivityTaskManager.getService() |
| 375 | .registerRemoteAnimationForNextActivityStart( |
| 376 | intent.getCreatorPackage(), adapter); |
| 377 | } |
| 378 | int launchResult = intent.sendAndReturnResult(mContext, 0, fillInIntent, null, |
| 379 | null, null, getActivityOptions(adapter)); |
| 380 | mActivityLaunchAnimator.setLaunchResult(launchResult, isActivityIntent); |
| 381 | } catch (RemoteException | PendingIntent.CanceledException e) { |
| 382 | // the stack trace isn't very helpful here. |
| 383 | // Just log the exception message. |
| 384 | Log.w(TAG, "Sending contentIntent failed: " + e); |
| 385 | // TODO: Dismiss Keyguard. |
| 386 | } |
| 387 | } |
| 388 | |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 389 | @Override |
| 390 | public void startNotificationGutsIntent(final Intent intent, final int appUid, |
| 391 | ExpandableNotificationRow row) { |
| 392 | mActivityStarter.dismissKeyguardThenExecute(() -> { |
| 393 | AsyncTask.execute(() -> { |
| 394 | int launchResult = TaskStackBuilder.create(mContext) |
| 395 | .addNextIntentWithParentStack(intent) |
| 396 | .startActivities(getActivityOptions( |
| 397 | mActivityLaunchAnimator.getLaunchAnimation( |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 398 | row, mStatusBar.isOccluded())), |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 399 | new UserHandle(UserHandle.getUserId(appUid))); |
| 400 | mActivityLaunchAnimator.setLaunchResult(launchResult, true /* isActivityIntent */); |
| 401 | if (shouldCollapse()) { |
| 402 | // Putting it back on the main thread, since we're touching views |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 403 | mMainThreadHandler.post(() -> mCommandQueue.animateCollapsePanels( |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 404 | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */)); |
| 405 | } |
| 406 | }); |
| 407 | return true; |
| 408 | }, null, false /* afterKeyguardGone */); |
| 409 | } |
| 410 | |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 411 | private void handleFullScreenIntent(NotificationEntry entry) { |
Selim Cinek | c3fec68 | 2019-06-06 18:11:07 -0700 | [diff] [blame] | 412 | if (mNotificationInterruptionStateProvider.shouldLaunchFullScreenIntentWhenAdded(entry)) { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 413 | if (shouldSuppressFullScreenIntent(entry)) { |
| 414 | if (DEBUG) { |
Ned Burns | 00b4b2d | 2019-10-17 22:09:27 -0400 | [diff] [blame] | 415 | Log.d(TAG, "No Fullscreen intent: suppressed by DND: " + entry.getKey()); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 416 | } |
Ned Burns | 60e9459 | 2019-09-06 14:47:25 -0400 | [diff] [blame] | 417 | } else if (entry.getImportance() < NotificationManager.IMPORTANCE_HIGH) { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 418 | if (DEBUG) { |
Ned Burns | 00b4b2d | 2019-10-17 22:09:27 -0400 | [diff] [blame] | 419 | Log.d(TAG, "No Fullscreen intent: not important enough: " + entry.getKey()); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 420 | } |
| 421 | } else { |
| 422 | // Stop screensaver if the notification has a fullscreen intent. |
| 423 | // (like an incoming phone call) |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 424 | mUiBgExecutor.execute(() -> { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 425 | try { |
| 426 | mDreamManager.awaken(); |
| 427 | } catch (RemoteException e) { |
| 428 | e.printStackTrace(); |
| 429 | } |
| 430 | }); |
| 431 | |
| 432 | // not immersive & a fullscreen alert should be shown |
| 433 | if (DEBUG) { |
| 434 | Log.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent"); |
| 435 | } |
| 436 | try { |
| 437 | EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION, |
Ned Burns | 00b4b2d | 2019-10-17 22:09:27 -0400 | [diff] [blame] | 438 | entry.getKey()); |
| 439 | entry.getSbn().getNotification().fullScreenIntent.send(); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 440 | entry.notifyFullScreenIntentLaunched(); |
| 441 | mMetricsLogger.count("note_fullscreen", 1); |
| 442 | } catch (PendingIntent.CanceledException e) { |
| 443 | // ignore |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 449 | @Override |
| 450 | public boolean isCollapsingToShowActivityOverLockscreen() { |
| 451 | return mIsCollapsingToShowActivityOverLockscreen; |
| 452 | } |
| 453 | |
| 454 | private static boolean shouldAutoCancel(StatusBarNotification sbn) { |
| 455 | int flags = sbn.getNotification().flags; |
| 456 | if ((flags & Notification.FLAG_AUTO_CANCEL) != Notification.FLAG_AUTO_CANCEL) { |
| 457 | return false; |
| 458 | } |
| 459 | if ((flags & Notification.FLAG_FOREGROUND_SERVICE) != 0) { |
| 460 | return false; |
| 461 | } |
| 462 | return true; |
| 463 | } |
| 464 | |
| 465 | private void collapseOnMainThread() { |
| 466 | if (Looper.getMainLooper().isCurrentThread()) { |
| 467 | mShadeController.collapsePanel(); |
| 468 | } else { |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 469 | mMainThreadHandler.post(mShadeController::collapsePanel); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 470 | } |
| 471 | } |
| 472 | |
| 473 | private boolean shouldCollapse() { |
| 474 | return mStatusBarStateController.getState() != StatusBarState.SHADE |
| 475 | || !mActivityLaunchAnimator.isAnimationPending(); |
| 476 | } |
| 477 | |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 478 | private boolean shouldSuppressFullScreenIntent(NotificationEntry entry) { |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 479 | if (mPresenter.isDeviceInVrMode()) { |
| 480 | return true; |
| 481 | } |
| 482 | |
| 483 | return entry.shouldSuppressFullScreenIntent(); |
| 484 | } |
| 485 | |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 486 | private void removeNotification(StatusBarNotification notification) { |
| 487 | // We have to post it to the UI thread for synchronization |
Mark Renouf | 6b2331c | 2019-03-21 13:40:08 -0400 | [diff] [blame] | 488 | mMainThreadHandler.post(() -> { |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 489 | Runnable removeRunnable = |
Mady Mellor | c2ff011 | 2019-03-28 14:18:06 -0700 | [diff] [blame] | 490 | () -> mEntryManager.performRemoveNotification(notification, REASON_CLICK); |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 491 | if (mPresenter.isCollapsing()) { |
| 492 | // To avoid lags we're only performing the remove |
| 493 | // after the shade was collapsed |
| 494 | mShadeController.addPostCollapseAction(removeRunnable); |
| 495 | } else { |
| 496 | removeRunnable.run(); |
| 497 | } |
| 498 | }); |
| 499 | } |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 500 | |
| 501 | /** |
| 502 | * Public builder for {@link StatusBarNotificationActivityStarter}. |
| 503 | */ |
| 504 | @Singleton |
| 505 | public static class Builder { |
| 506 | private final Context mContext; |
| 507 | private final CommandQueue mCommandQueue; |
| 508 | private final Lazy<AssistManager> mAssistManagerLazy; |
| 509 | private final NotificationEntryManager mEntryManager; |
| 510 | private final HeadsUpManagerPhone mHeadsUpManager; |
| 511 | private final ActivityStarter mActivityStarter; |
| 512 | private final IStatusBarService mStatusBarService; |
| 513 | private final StatusBarStateController mStatusBarStateController; |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 514 | private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 515 | private final KeyguardManager mKeyguardManager; |
| 516 | private final IDreamManager mDreamManager; |
| 517 | private final NotificationRemoteInputManager mRemoteInputManager; |
| 518 | private final StatusBarRemoteInputCallback mRemoteInputCallback; |
| 519 | private final NotificationGroupManager mGroupManager; |
| 520 | private final NotificationLockscreenUserManager mLockscreenUserManager; |
| 521 | private final KeyguardStateController mKeyguardStateController; |
| 522 | private final NotificationInterruptionStateProvider mNotificationInterruptionStateProvider; |
| 523 | private final MetricsLogger mMetricsLogger; |
| 524 | private final LockPatternUtils mLockPatternUtils; |
| 525 | private final Handler mMainThreadHandler; |
| 526 | private final Handler mBackgroundHandler; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 527 | private final Executor mUiBgExecutor; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 528 | private final ActivityIntentHelper mActivityIntentHelper; |
| 529 | private final BubbleController mBubbleController; |
| 530 | private final SuperStatusBarViewFactory mSuperStatusBarViewFactory; |
Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 531 | private final ShadeController mShadeController; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 532 | private NotificationPresenter mNotificationPresenter; |
| 533 | private ActivityLaunchAnimator mActivityLaunchAnimator; |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 534 | private StatusBar mStatusBar; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 535 | |
| 536 | @Inject |
| 537 | public Builder(Context context, |
| 538 | CommandQueue commandQueue, |
| 539 | Lazy<AssistManager> assistManagerLazy, |
| 540 | NotificationEntryManager entryManager, |
| 541 | HeadsUpManagerPhone headsUpManager, |
| 542 | ActivityStarter activityStarter, |
| 543 | IStatusBarService statusBarService, |
| 544 | StatusBarStateController statusBarStateController, |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 545 | StatusBarKeyguardViewManager statusBarKeyguardViewManager, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 546 | KeyguardManager keyguardManager, |
| 547 | IDreamManager dreamManager, |
| 548 | NotificationRemoteInputManager remoteInputManager, |
| 549 | StatusBarRemoteInputCallback remoteInputCallback, |
| 550 | NotificationGroupManager groupManager, |
| 551 | NotificationLockscreenUserManager lockscreenUserManager, |
| 552 | KeyguardStateController keyguardStateController, |
| 553 | NotificationInterruptionStateProvider notificationInterruptionStateProvider, |
| 554 | MetricsLogger metricsLogger, |
| 555 | LockPatternUtils lockPatternUtils, |
Dave Mankoff | 00e8a2f | 2019-12-18 16:59:49 -0500 | [diff] [blame] | 556 | @Main Handler mainThreadHandler, |
| 557 | @Background Handler backgroundHandler, |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 558 | @UiBackground Executor uiBgExecutor, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 559 | ActivityIntentHelper activityIntentHelper, |
| 560 | BubbleController bubbleController, |
Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 561 | ShadeController shadeController, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 562 | SuperStatusBarViewFactory superStatusBarViewFactory) { |
| 563 | mContext = context; |
| 564 | mCommandQueue = commandQueue; |
| 565 | mAssistManagerLazy = assistManagerLazy; |
| 566 | mEntryManager = entryManager; |
| 567 | mHeadsUpManager = headsUpManager; |
| 568 | mActivityStarter = activityStarter; |
| 569 | mStatusBarService = statusBarService; |
| 570 | mStatusBarStateController = statusBarStateController; |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 571 | mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 572 | mKeyguardManager = keyguardManager; |
| 573 | mDreamManager = dreamManager; |
| 574 | mRemoteInputManager = remoteInputManager; |
| 575 | mRemoteInputCallback = remoteInputCallback; |
| 576 | mGroupManager = groupManager; |
| 577 | mLockscreenUserManager = lockscreenUserManager; |
| 578 | mKeyguardStateController = keyguardStateController; |
| 579 | mNotificationInterruptionStateProvider = notificationInterruptionStateProvider; |
| 580 | mMetricsLogger = metricsLogger; |
| 581 | mLockPatternUtils = lockPatternUtils; |
| 582 | mMainThreadHandler = mainThreadHandler; |
| 583 | mBackgroundHandler = backgroundHandler; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 584 | mUiBgExecutor = uiBgExecutor; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 585 | mActivityIntentHelper = activityIntentHelper; |
| 586 | mBubbleController = bubbleController; |
Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 587 | mShadeController = shadeController; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 588 | mSuperStatusBarViewFactory = superStatusBarViewFactory; |
| 589 | } |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 590 | |
Heemin Seog | ba6337f | 2019-12-10 15:34:37 -0800 | [diff] [blame] | 591 | /** Sets the status bar to use as {@link StatusBar}. */ |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 592 | public Builder setStatusBar(StatusBar statusBar) { |
| 593 | mStatusBar = statusBar; |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 594 | return this; |
| 595 | } |
| 596 | |
| 597 | public Builder setNotificationPresenter(NotificationPresenter notificationPresenter) { |
| 598 | mNotificationPresenter = notificationPresenter; |
| 599 | return this; |
| 600 | } |
| 601 | |
| 602 | public Builder setActivityLaunchAnimator(ActivityLaunchAnimator activityLaunchAnimator) { |
| 603 | mActivityLaunchAnimator = activityLaunchAnimator; |
| 604 | return this; |
| 605 | } |
| 606 | |
| 607 | public StatusBarNotificationActivityStarter build() { |
| 608 | return new StatusBarNotificationActivityStarter(mContext, |
| 609 | mCommandQueue, mAssistManagerLazy, |
| 610 | mSuperStatusBarViewFactory.getNotificationPanelView(), |
| 611 | mNotificationPresenter, |
| 612 | mEntryManager, |
| 613 | mHeadsUpManager, |
| 614 | mActivityStarter, |
| 615 | mActivityLaunchAnimator, |
| 616 | mStatusBarService, |
| 617 | mStatusBarStateController, |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 618 | mStatusBarKeyguardViewManager, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 619 | mKeyguardManager, |
| 620 | mDreamManager, |
| 621 | mRemoteInputManager, |
| 622 | mRemoteInputCallback, |
| 623 | mGroupManager, |
| 624 | mLockscreenUserManager, |
| 625 | mShadeController, |
Heemin Seog | bd9bcbf | 2019-12-04 17:07:32 -0800 | [diff] [blame] | 626 | mStatusBar, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 627 | mKeyguardStateController, |
| 628 | mNotificationInterruptionStateProvider, |
| 629 | mMetricsLogger, |
| 630 | mLockPatternUtils, |
| 631 | mMainThreadHandler, |
| 632 | mBackgroundHandler, |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 633 | mUiBgExecutor, |
Dave Mankoff | 4c73e65 | 2019-11-14 17:39:08 -0500 | [diff] [blame] | 634 | mActivityIntentHelper, |
| 635 | mBubbleController); |
| 636 | } |
| 637 | } |
Gus Prevas | 21437b3 | 2018-12-05 10:36:13 -0500 | [diff] [blame] | 638 | } |