summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java132
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java7
14 files changed, 209 insertions, 60 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java
index 07b7b22d2320..0a76c7ddbe8d 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIBinder.java
@@ -29,6 +29,7 @@ import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.car.CarStatusBar;
import com.android.systemui.statusbar.car.CarStatusBarModule;
import com.android.systemui.statusbar.notification.InstantAppNotifier;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.tv.TvStatusBar;
import com.android.systemui.theme.ThemeOverlayController;
@@ -42,7 +43,7 @@ import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;
/** Binder for car specific {@link SystemUI} modules. */
-@Module(includes = {RecentsModule.class, CarStatusBarModule.class})
+@Module(includes = {RecentsModule.class, CarStatusBarModule.class, NotificationsModule.class})
public abstract class CarSystemUIBinder {
/** Inject into AuthController. */
@Binds
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
index 5de88e17d320..c08c3cbc869b 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
@@ -33,6 +33,7 @@ import com.android.systemui.recents.RecentsModule;
import com.android.systemui.shortcut.ShortcutKeyDispatcher;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.notification.InstantAppNotifier;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarModule;
import com.android.systemui.statusbar.tv.TvStatusBar;
@@ -49,7 +50,7 @@ import dagger.multibindings.IntoMap;
/**
* SystemUI objects that are injectable should go here.
*/
-@Module(includes = {RecentsModule.class, StatusBarModule.class})
+@Module(includes = {RecentsModule.class, StatusBarModule.class, NotificationsModule.class})
public abstract class SystemUIBinder {
/** Inject into AuthController. */
@Binds
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index 91aeb224e143..030b504c9a7a 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -35,10 +35,8 @@ import com.android.systemui.statusbar.BlurUtils;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeWindowBlurController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
-import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
-import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.people.PeopleHubModule;
import com.android.systemui.statusbar.notification.row.dagger.ExpandableNotificationRowComponent;
import com.android.systemui.statusbar.notification.row.dagger.NotificationRowComponent;
@@ -69,7 +67,6 @@ import dagger.Provides;
AssistModule.class,
ConcurrencyModule.class,
LogModule.class,
- NotificationsModule.class,
PeopleHubModule.class,
},
subcomponents = {StatusBarComponent.class,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
index d0e238a66330..72a7e11d8543 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java
@@ -28,13 +28,10 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.policy.HeadsUpManager;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
/** Handles heads-up and pulsing behavior driven by notification changes. */
-@Singleton
public class NotificationAlertingManager {
private static final String TAG = "NotifAlertManager";
@@ -47,7 +44,9 @@ public class NotificationAlertingManager {
private HeadsUpManager mHeadsUpManager;
- @Inject
+ /**
+ * Injected constructor. See {@link NotificationsModule}.
+ */
public NotificationAlertingManager(
NotificationEntryManager notificationEntryManager,
NotificationRemoteInputManager remoteInputManager,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
index b0bf8130f3a9..4f55e02bddfb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java
@@ -47,6 +47,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationRankin
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
@@ -64,9 +65,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
import dagger.Lazy;
/**
@@ -94,7 +92,6 @@ import dagger.Lazy;
* aware of
* @see #getActiveNotificationsForCurrentUser() to see every notification that the current user owns
*/
-@Singleton
public class NotificationEntryManager implements
CommonNotifCollection,
Dumpable,
@@ -181,7 +178,9 @@ public class NotificationEntryManager implements
}
}
- @Inject
+ /**
+ * Injected constructor. See {@link NotificationsModule}.
+ */
public NotificationEntryManager(
NotificationEntryManagerLogger logger,
NotificationGroupManager groupManager,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
index 99718abb6492..616c110ea7cc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
@@ -26,6 +26,7 @@ import com.android.systemui.Dumpable;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
@@ -33,14 +34,10 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
/**
* A manager that ensures that notifications are visually stable. It will suppress reorderings
* and reorder at the right time when they are out of view.
*/
-@Singleton
public class VisualStabilityManager implements OnHeadsUpChangedListener, Dumpable {
private static final long TEMPORARY_REORDERING_ALLOWED_DURATION = 1000;
@@ -60,7 +57,9 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener, Dumpabl
private ArraySet<View> mAddedChildren = new ArraySet<>();
private boolean mPulsing;
- @Inject
+ /**
+ * Injected constructor. See {@link NotificationsModule}.
+ */
public VisualStabilityManager(
NotificationEntryManager notificationEntryManager, @Main Handler handler) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
index 39f4dfacc2c5..8f8f7422c449 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java
@@ -17,15 +17,39 @@
package com.android.systemui.statusbar.notification.dagger;
import android.content.Context;
+import android.os.Handler;
+import android.view.accessibility.AccessibilityManager;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
+import com.android.systemui.dagger.qualifiers.Main;
+import com.android.systemui.dagger.qualifiers.UiBackground;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.FeatureFlags;
+import com.android.systemui.statusbar.NotificationListener;
+import com.android.systemui.statusbar.NotificationRemoteInputManager;
+import com.android.systemui.statusbar.notification.ForegroundServiceDismissalFeatureController;
+import com.android.systemui.statusbar.notification.NotificationAlertingManager;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
+import com.android.systemui.statusbar.notification.NotificationEntryManagerLogger;
+import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
+import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
+import com.android.systemui.statusbar.notification.collection.NotificationRankingManager;
+import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
+import com.android.systemui.statusbar.notification.collection.provider.HighPriorityProvider;
import com.android.systemui.statusbar.notification.init.NotificationsController;
import com.android.systemui.statusbar.notification.init.NotificationsControllerImpl;
import com.android.systemui.statusbar.notification.init.NotificationsControllerStub;
+import com.android.systemui.statusbar.notification.logging.NotificationLogger;
+import com.android.systemui.statusbar.notification.row.NotificationBlockingHelperManager;
+import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
+import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.StatusBar;
+import com.android.systemui.util.leak.LeakDetector;
+
+import java.util.concurrent.Executor;
import javax.inject.Singleton;
@@ -33,9 +57,111 @@ import dagger.Lazy;
import dagger.Module;
import dagger.Provides;
-/** Module for classes related to the notifications data pipeline */
+/**
+ * Dagger Module for classes found within the com.android.systemui.statusbar.notification package.
+ */
@Module
-public class NotificationsModule {
+public interface NotificationsModule {
+ /** Provides an instance of {@link NotificationEntryManager} */
+ @Singleton
+ @Provides
+ static NotificationEntryManager provideNotificationEntryManager(
+ NotificationEntryManagerLogger logger,
+ NotificationGroupManager groupManager,
+ NotificationRankingManager rankingManager,
+ NotificationEntryManager.KeyguardEnvironment keyguardEnvironment,
+ FeatureFlags featureFlags,
+ Lazy<NotificationRowBinder> notificationRowBinderLazy,
+ Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy,
+ LeakDetector leakDetector,
+ ForegroundServiceDismissalFeatureController fgsFeatureController) {
+ return new NotificationEntryManager(
+ logger,
+ groupManager,
+ rankingManager,
+ keyguardEnvironment,
+ featureFlags,
+ notificationRowBinderLazy,
+ notificationRemoteInputManagerLazy,
+ leakDetector,
+ fgsFeatureController);
+ }
+
+ /** Provides an instance of {@link NotificationGutsManager} */
+ @Singleton
+ @Provides
+ static NotificationGutsManager provideNotificationGutsManager(
+ Context context,
+ VisualStabilityManager visualStabilityManager,
+ Lazy<StatusBar> statusBarLazy,
+ @Main Handler mainHandler,
+ AccessibilityManager accessibilityManager,
+ HighPriorityProvider highPriorityProvider) {
+ return new NotificationGutsManager(
+ context,
+ visualStabilityManager,
+ statusBarLazy,
+ mainHandler,
+ accessibilityManager,
+ highPriorityProvider);
+ }
+
+ /** Provides an instance of {@link VisualStabilityManager} */
+ @Singleton
+ @Provides
+ static VisualStabilityManager provideVisualStabilityManager(
+ NotificationEntryManager notificationEntryManager, Handler handler) {
+ return new VisualStabilityManager(notificationEntryManager, handler);
+ }
+
+ /** Provides an instance of {@link NotificationAlertingManager} */
+ @Singleton
+ @Provides
+ static NotificationAlertingManager provideNotificationAlertingManager(
+ NotificationEntryManager notificationEntryManager,
+ NotificationRemoteInputManager remoteInputManager,
+ VisualStabilityManager visualStabilityManager,
+ StatusBarStateController statusBarStateController,
+ NotificationInterruptionStateProvider notificationInterruptionStateProvider,
+ NotificationListener notificationListener) {
+ return new NotificationAlertingManager(
+ notificationEntryManager,
+ remoteInputManager,
+ visualStabilityManager,
+ statusBarStateController,
+ notificationInterruptionStateProvider,
+ notificationListener);
+ }
+
+ /** Provides an instance of {@link NotificationLogger} */
+ @Singleton
+ @Provides
+ static NotificationLogger provideNotificationLogger(
+ NotificationListener notificationListener,
+ @UiBackground Executor uiBgExecutor,
+ NotificationEntryManager entryManager,
+ StatusBarStateController statusBarStateController,
+ NotificationLogger.ExpansionStateLogger expansionStateLogger) {
+ return new NotificationLogger(
+ notificationListener,
+ uiBgExecutor,
+ entryManager,
+ statusBarStateController,
+ expansionStateLogger);
+ }
+
+ /** Provides an instance of {@link NotificationBlockingHelperManager} */
+ @Singleton
+ @Provides
+ static NotificationBlockingHelperManager provideNotificationBlockingHelperManager(
+ Context context,
+ NotificationGutsManager notificationGutsManager,
+ NotificationEntryManager notificationEntryManager,
+ MetricsLogger metricsLogger) {
+ return new NotificationBlockingHelperManager(
+ context, notificationGutsManager, notificationEntryManager, metricsLogger);
+ }
+
/** Initializes the notification data pipeline (can be disabled via config). */
@Singleton
@Provides
@@ -55,7 +181,7 @@ public class NotificationsModule {
*/
@Provides
@Singleton
- public CommonNotifCollection provideCommonNotifCollection(
+ static CommonNotifCollection provideCommonNotifCollection(
FeatureFlags featureFlags,
Lazy<NotifPipeline> pipeline,
NotificationEntryManager entryManager) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
index 89e5f5596291..becb758bf470 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java
@@ -39,6 +39,7 @@ import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.notification.NotificationEntryListener;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -50,13 +51,11 @@ import java.util.Map;
import java.util.concurrent.Executor;
import javax.inject.Inject;
-import javax.inject.Singleton;
/**
* Handles notification logging, in particular, logging which notifications are visible and which
* are not.
*/
-@Singleton
public class NotificationLogger implements StateListener {
private static final String TAG = "NotificationLogger";
@@ -192,7 +191,9 @@ public class NotificationLogger implements StateListener {
}
}
- @Inject
+ /**
+ * Injected constructor. See {@link NotificationsModule}.
+ */
public NotificationLogger(NotificationListener notificationListener,
@UiBackground Executor uiBgExecutor,
NotificationEntryManager entryManager,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java
index 7b758aa09e5c..921232568755 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManager.java
@@ -16,8 +16,7 @@
package com.android.systemui.statusbar.notification.row;
-import static android.service.notification.NotificationListenerService.Ranking
- .USER_SENTIMENT_NEGATIVE;
+import static android.service.notification.NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE;
import android.content.Context;
import android.metrics.LogMaker;
@@ -27,29 +26,28 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.Dependency;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.logging.NotificationCounters;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
/**
* Manager for the notification blocking helper - tracks and helps create the blocking helper
* affordance.
*/
-@Singleton
public class NotificationBlockingHelperManager {
/** Enables debug logging and always makes the blocking helper show up after a dismiss. */
private static final boolean DEBUG = false;
private static final String TAG = "BlockingHelper";
private final Context mContext;
+ private final NotificationGutsManager mNotificationGutsManager;
+ private final NotificationEntryManager mNotificationEntryManager;
+ private final MetricsLogger mMetricsLogger;
/** Row that the blocking helper will be shown in (via {@link NotificationGuts}. */
private ExpandableNotificationRow mBlockingHelperRow;
private Set<String> mNonBlockablePkgs;
@@ -60,11 +58,18 @@ public class NotificationBlockingHelperManager {
*/
private boolean mIsShadeExpanded;
- private MetricsLogger mMetricsLogger = new MetricsLogger();
-
- @Inject
- public NotificationBlockingHelperManager(Context context) {
+ /**
+ * Injected constructor. See {@link NotificationsModule}.
+ */
+ public NotificationBlockingHelperManager(
+ Context context,
+ NotificationGutsManager notificationGutsManager,
+ NotificationEntryManager notificationEntryManager,
+ MetricsLogger metricsLogger) {
mContext = context;
+ mNotificationGutsManager = notificationGutsManager;
+ mNotificationEntryManager = notificationEntryManager;
+ mMetricsLogger = metricsLogger;
mNonBlockablePkgs = new HashSet<>();
Collections.addAll(mNonBlockablePkgs, mContext.getResources().getStringArray(
com.android.internal.R.array.config_nonBlockableNotificationPackages));
@@ -99,7 +104,6 @@ public class NotificationBlockingHelperManager {
if (DEBUG) {
Log.d(TAG, "Manager.perhapsShowBlockingHelper: Showing new blocking helper");
}
- NotificationGutsManager manager = Dependency.get(NotificationGutsManager.class);
// Enable blocking helper on the row before moving forward so everything in the guts is
// correctly prepped.
@@ -113,10 +117,10 @@ public class NotificationBlockingHelperManager {
// We don't care about the touch origin (x, y) since we're opening guts without any
// explicit user interaction.
- manager.openGuts(mBlockingHelperRow, 0, 0, menuRow.getLongpressMenuItem(mContext));
+ mNotificationGutsManager.openGuts(
+ mBlockingHelperRow, 0, 0, menuRow.getLongpressMenuItem(mContext));
- Dependency.get(MetricsLogger.class)
- .count(NotificationCounters.BLOCKING_HELPER_SHOWN, 1);
+ mMetricsLogger.count(NotificationCounters.BLOCKING_HELPER_SHOWN, 1);
return true;
}
return false;
@@ -139,8 +143,7 @@ public class NotificationBlockingHelperManager {
mBlockingHelperRow.setBlockingHelperShowing(false);
if (mBlockingHelperRow.isAttachedToWindow()) {
- Dependency.get(NotificationEntryManager.class).updateNotifications(
- "dismissCurrentBlockingHelper");
+ mNotificationEntryManager.updateNotifications("dismissCurrentBlockingHelper");
}
mBlockingHelperRow = null;
return true;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
index 566da65e37f3..e3ca283d13ad 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
@@ -33,7 +33,6 @@ import android.widget.RemoteViews;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.widget.ImageMessageConsumer;
-import com.android.systemui.Dependency;
import com.android.systemui.statusbar.InflationTask;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.SmartReplyController;
@@ -53,6 +52,8 @@ import java.util.HashMap;
import javax.inject.Inject;
import javax.inject.Singleton;
+import dagger.Lazy;
+
/**
* {@link NotificationContentInflater} binds content to a {@link ExpandableNotificationRow} by
* asynchronously building the content's {@link RemoteViews} and applying it to the row.
@@ -66,13 +67,19 @@ public class NotificationContentInflater implements NotificationRowContentBinder
private boolean mInflateSynchronously = false;
private final NotificationRemoteInputManager mRemoteInputManager;
private final NotifRemoteViewCache mRemoteViewCache;
+ private final Lazy<SmartReplyConstants> mSmartReplyConstants;
+ private final Lazy<SmartReplyController> mSmartReplyController;
@Inject
NotificationContentInflater(
NotifRemoteViewCache remoteViewCache,
- NotificationRemoteInputManager remoteInputManager) {
+ NotificationRemoteInputManager remoteInputManager,
+ Lazy<SmartReplyConstants> smartReplyConstants,
+ Lazy<SmartReplyController> smartReplyController) {
mRemoteViewCache = remoteViewCache;
mRemoteInputManager = remoteInputManager;
+ mSmartReplyConstants = smartReplyConstants;
+ mSmartReplyController = smartReplyController;
}
@Override
@@ -104,6 +111,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
contentToBind,
mRemoteViewCache,
entry,
+ mSmartReplyConstants.get(),
+ mSmartReplyController.get(),
row,
bindParams.isLowPriority,
bindParams.isChildInGroup,
@@ -136,6 +145,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
packageContext);
result = inflateSmartReplyViews(result, reInflateFlags, entry,
row.getContext(), packageContext, row.getHeadsUpManager(),
+ mSmartReplyConstants.get(), mSmartReplyController.get(),
row.getExistingSmartRepliesAndActions());
apply(
@@ -204,9 +214,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
private static InflationProgress inflateSmartReplyViews(InflationProgress result,
@InflationFlag int reInflateFlags, NotificationEntry entry, Context context,
Context packageContext, HeadsUpManager headsUpManager,
+ SmartReplyConstants smartReplyConstants, SmartReplyController smartReplyController,
SmartRepliesAndActions previousSmartRepliesAndActions) {
- SmartReplyConstants smartReplyConstants = Dependency.get(SmartReplyConstants.class);
- SmartReplyController smartReplyController = Dependency.get(SmartReplyController.class);
if ((reInflateFlags & FLAG_CONTENT_VIEW_EXPANDED) != 0 && result.newExpandedView != null) {
result.expandedInflatedSmartReplies =
InflatedSmartReplies.inflate(
@@ -643,6 +652,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
private final boolean mUsesIncreasedHeadsUpHeight;
private final @InflationFlag int mReInflateFlags;
private final NotifRemoteViewCache mRemoteViewCache;
+ private final SmartReplyConstants mSmartReplyConstants;
+ private final SmartReplyController mSmartReplyController;
private ExpandableNotificationRow mRow;
private Exception mError;
private RemoteViews.OnClickHandler mRemoteViewClickHandler;
@@ -653,6 +664,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
@InflationFlag int reInflateFlags,
NotifRemoteViewCache cache,
NotificationEntry entry,
+ SmartReplyConstants smartReplyConstants,
+ SmartReplyController smartReplyController,
ExpandableNotificationRow row,
boolean isLowPriority,
boolean isChildInGroup,
@@ -662,6 +675,8 @@ public class NotificationContentInflater implements NotificationRowContentBinder
RemoteViews.OnClickHandler remoteViewClickHandler) {
mEntry = entry;
mRow = row;
+ mSmartReplyConstants = smartReplyConstants;
+ mSmartReplyController = smartReplyController;
mInflateSynchronously = inflateSynchronously;
mReInflateFlags = reInflateFlags;
mRemoteViewCache = cache;
@@ -701,6 +716,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
mUsesIncreasedHeadsUpHeight, packageContext);
return inflateSmartReplyViews(inflationProgress, mReInflateFlags, mEntry,
mRow.getContext(), packageContext, mRow.getHeadsUpManager(),
+ mSmartReplyConstants, mSmartReplyController,
mRow.getExistingSmartRepliesAndActions());
} catch (Exception e) {
mError = e;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index 352abcfc9214..8a0b21a488ea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -56,25 +56,21 @@ import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.provider.HighPriorityProvider;
+import com.android.systemui.statusbar.notification.dagger.NotificationsModule;
import com.android.systemui.statusbar.notification.row.NotificationInfo.CheckSaveListener;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
-import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
import dagger.Lazy;
/**
* Handles various NotificationGuts related tasks, such as binding guts to a row, opening and
* closing guts, and keeping track of the currently exposed notification guts.
*/
-@Singleton
public class NotificationGutsManager implements Dumpable, NotificationLifetimeExtender {
private static final String TAG = "NotificationGutsManager";
@@ -111,7 +107,9 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
private final Handler mMainHandler;
private Runnable mOpenRunnable;
- @Inject
+ /**
+ * Injected constructor. See {@link NotificationsModule}.
+ */
public NotificationGutsManager(Context context, VisualStabilityManager visualStabilityManager,
Lazy<StatusBar> statusBarLazy, @Main Handler mainHandler,
AccessibilityManager accessibilityManager,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
index 1dfe7bc33373..a8c438a390ef 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationBlockingHelperManagerTest.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
@@ -43,6 +44,7 @@ import android.view.View;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -83,13 +85,12 @@ public class NotificationBlockingHelperManagerTest extends SysuiTestCase {
any(NotificationMenuRowPlugin.MenuItem.class)))
.thenReturn(true);
when(mMenuRow.getLongpressMenuItem(any(Context.class))).thenReturn(mMenuItem);
- mDependency.injectTestDependency(NotificationGutsManager.class, mGutsManager);
- mDependency.injectTestDependency(NotificationEntryManager.class, mEntryManager);
mDependency.injectMockDependency(BubbleController.class);
mHelper = new NotificationTestHelper(mContext, mDependency);
- mBlockingHelperManager = new NotificationBlockingHelperManager(mContext);
+ mBlockingHelperManager = new NotificationBlockingHelperManager(
+ mContext, mGutsManager, mEntryManager, mock(MetricsLogger.class));
// By default, have the shade visible/expanded.
mBlockingHelperManager.setNotificationShadeExpanded(1f);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
index 8a42e5fb4ea0..149a95ae4cb5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentInflaterTest.java
@@ -50,10 +50,12 @@ import androidx.test.filters.Suppress;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
+import com.android.systemui.statusbar.SmartReplyController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.BindParams;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationCallback;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;
+import com.android.systemui.statusbar.policy.SmartReplyConstants;
import com.android.systemui.tests.R;
import org.junit.Assert;
@@ -92,9 +94,14 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
ExpandableNotificationRow row = new NotificationTestHelper(mContext, mDependency).createRow(
mBuilder.build());
mRow = spy(row);
+
+ final SmartReplyConstants smartReplyConstants = mock(SmartReplyConstants.class);
+ final SmartReplyController smartReplyController = mock(SmartReplyController.class);
mNotificationInflater = new NotificationContentInflater(
mCache,
- mock(NotificationRemoteInputManager.class));
+ mock(NotificationRemoteInputManager.class),
+ () -> smartReplyConstants,
+ () -> smartReplyController);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
index 7a1bd052a336..9a52ee8d6af7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java
@@ -60,6 +60,7 @@ import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
+import com.android.systemui.statusbar.policy.SmartReplyConstants;
import com.android.systemui.tests.R;
import org.mockito.ArgumentCaptor;
@@ -98,7 +99,6 @@ public class NotificationTestHelper {
dependency.injectMockDependency(NotificationMediaManager.class);
dependency.injectMockDependency(BubbleController.class);
dependency.injectMockDependency(NotificationShadeWindowController.class);
- dependency.injectMockDependency(SmartReplyController.class);
mStatusBarStateController = mock(StatusBarStateController.class);
mGroupManager = new NotificationGroupManager(mStatusBarStateController);
mHeadsUpManager = new HeadsUpManagerPhone(mContext, mStatusBarStateController,
@@ -106,10 +106,11 @@ public class NotificationTestHelper {
mHeadsUpManager.setUp(null, mGroupManager, null, null);
mGroupManager.setHeadsUpManager(mHeadsUpManager);
-
NotificationContentInflater contentBinder = new NotificationContentInflater(
mock(NotifRemoteViewCache.class),
- mock(NotificationRemoteInputManager.class));
+ mock(NotificationRemoteInputManager.class),
+ () -> mock(SmartReplyConstants.class),
+ () -> mock(SmartReplyController.class));
contentBinder.setInflateSynchronously(true);
mBindStage = new RowContentBindStage(contentBinder,
mock(NotifInflationErrorManager.class),