From 171a27ee569f58c8d53172054b72bb3a5411af70 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Fri, 5 Nov 2021 12:30:50 -0400 Subject: [PATCH] New Pipeline: Add HeadsUpManagerLogger Bug: 198359689 Test: dumpsys Change-Id: I00ec13ebd7354a065ee32e9c55c70c7d0d290e89 --- .../dagger/SystemUIDefaultModule.java | 12 +- .../systemui/log/dagger/LogModule.java | 8 ++ .../log/dagger/NotificationHeadsUpLog.java | 33 +++++ .../AlertingNotificationManager.java | 28 ++-- .../statusbar/phone/HeadsUpManagerPhone.java | 4 +- .../statusbar/policy/HeadsUpManager.java | 29 ++--- .../statusbar/policy/HeadsUpManagerLogger.kt | 120 ++++++++++++++++++ .../android/systemui/tv/TvSystemUIModule.java | 12 +- .../AlertingNotificationManagerTest.java | 3 + .../row/NotificationTestHelper.java | 12 +- .../phone/HeadsUpManagerPhoneTest.java | 24 +++- ...ificationGroupAlertTransferHelperTest.java | 3 +- .../statusbar/policy/HeadsUpManagerTest.java | 2 +- 13 files changed, 241 insertions(+), 49 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/log/dagger/NotificationHeadsUpLog.java create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java index 50d2dd16b407f..6c52b5e8de1c2 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java @@ -64,6 +64,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.HeadsUpManager; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerImpl; import com.android.systemui.statusbar.policy.SensorPrivacyController; @@ -169,12 +170,19 @@ public abstract class SystemUIDefaultModule { @Provides static HeadsUpManagerPhone provideHeadsUpManagerPhone( Context context, + HeadsUpManagerLogger headsUpManagerLogger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, GroupMembershipManager groupManager, ConfigurationController configurationController) { - return new HeadsUpManagerPhone(context, statusBarStateController, bypassController, - groupManager, configurationController); + return new HeadsUpManagerPhone( + context, + headsUpManagerLogger, + statusBarStateController, + bypassController, + groupManager, + configurationController + ); } @Binds diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java index 46e2274970f7d..df950d7ba9b6d 100644 --- a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java +++ b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java @@ -52,6 +52,14 @@ public class LogModule { return factory.create("NotifLog", 1000); } + /** Provides a logging buffer for all logs related to the data layer of notifications. */ + @Provides + @SysUISingleton + @NotificationHeadsUpLog + public static LogBuffer provideNotificationHeadsUpLogBuffer(LogBufferFactory factory) { + return factory.create("NotifHeadsUpLog", 1000); + } + /** Provides a logging buffer for all logs related to managing notification sections. */ @Provides @SysUISingleton diff --git a/packages/SystemUI/src/com/android/systemui/log/dagger/NotificationHeadsUpLog.java b/packages/SystemUI/src/com/android/systemui/log/dagger/NotificationHeadsUpLog.java new file mode 100644 index 0000000000000..fcc184a317b86 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/log/dagger/NotificationHeadsUpLog.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.log.dagger; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import com.android.systemui.log.LogBuffer; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; + +import javax.inject.Qualifier; + +/** A {@link LogBuffer} for heads up notification-related messages. */ +@Qualifier +@Documented +@Retention(RUNTIME) +public @interface NotificationHeadsUpLog { +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java index 9fa460928e130..43b3fb10a9206 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java @@ -23,12 +23,12 @@ import android.os.Looper; import android.os.SystemClock; import android.util.ArrayMap; import android.util.ArraySet; -import android.util.Log; import android.view.accessibility.AccessibilityEvent; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import java.util.stream.Stream; @@ -41,6 +41,11 @@ public abstract class AlertingNotificationManager implements NotificationLifetim private static final String TAG = "AlertNotifManager"; protected final Clock mClock = new Clock(); protected final ArrayMap mAlertEntries = new ArrayMap<>(); + protected final HeadsUpManagerLogger mLogger; + + public AlertingNotificationManager(HeadsUpManagerLogger logger) { + mLogger = logger; + } /** * This is the list of entries that have already been removed from the @@ -61,9 +66,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @param entry entry to show */ public void showNotification(@NonNull NotificationEntry entry) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "showNotification"); - } + mLogger.logShowNotification(entry.getKey()); addAlertEntry(entry); updateNotification(entry.getKey(), true /* alert */); entry.setInterruption(); @@ -77,9 +80,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @return true if notification is removed, false otherwise */ public boolean removeNotification(@NonNull String key, boolean releaseImmediately) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "removeNotification"); - } + mLogger.logRemoveNotification(key, releaseImmediately); AlertEntry alertEntry = mAlertEntries.get(key); if (alertEntry == null) { return true; @@ -100,11 +101,8 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * removal time */ public void updateNotification(@NonNull String key, boolean alert) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "updateNotification"); - } - AlertEntry alertEntry = mAlertEntries.get(key); + mLogger.logUpdateNotification(key, alert, alertEntry != null); if (alertEntry == null) { // the entry was released before this update (i.e by a listener) This can happen // with the groupmanager @@ -121,9 +119,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * Clears all managed notifications. */ public void releaseAllImmediately() { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "releaseAllImmediately"); - } + mLogger.logReleaseAllImmediately(); // A copy is necessary here as we are changing the underlying map. This would cause // undefined behavior if we iterated over the key set directly. ArraySet keysToRemove = new ArraySet<>(mAlertEntries.keySet()); @@ -300,9 +296,7 @@ public abstract class AlertingNotificationManager implements NotificationLifetim * @param updatePostTime whether or not to refresh the post time */ public void updateEntry(boolean updatePostTime) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "updateEntry"); - } + mLogger.logUpdateEntry(updatePostTime); long currentTime = mClock.currentTimeMillis(); mEarliestRemovaltime = currentTime + mMinimumDisplayTime; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java index c81196d7a0f96..01acce302b308 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.HeadsUpManager; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import java.io.FileDescriptor; @@ -101,11 +102,12 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, // Constructor: public HeadsUpManagerPhone(@NonNull final Context context, + HeadsUpManagerLogger logger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, GroupMembershipManager groupMembershipManager, ConfigurationController configurationController) { - super(context); + super(context, logger); Resources resources = mContext.getResources(); mExtensionTime = resources.getInteger(R.integer.ambient_notification_extension_time); mAutoHeadsUpNotificationDecay = resources.getInteger( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java index e0b0dd36ccd93..9587261e75bf2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java @@ -26,7 +26,6 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.provider.Settings; import android.util.ArrayMap; -import android.util.Log; import android.view.accessibility.AccessibilityManager; import com.android.internal.logging.MetricsLogger; @@ -81,7 +80,8 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { } } - public HeadsUpManager(@NonNull final Context context) { + public HeadsUpManager(@NonNull final Context context, HeadsUpManagerLogger logger) { + super(logger); mContext = context; mAccessibilityMgr = Dependency.get(AccessibilityManagerWrapper.class); mUiEventLogger = Dependency.get(UiEventLogger.class); @@ -102,9 +102,7 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { context.getContentResolver(), SETTING_HEADS_UP_SNOOZE_LENGTH_MS, -1); if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) { mSnoozeLengthMs = packageSnoozeLengthMs; - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "mSnoozeLengthMs = " + mSnoozeLengthMs); - } + mLogger.logSnoozeLengthChange(packageSnoozeLengthMs); } } }; @@ -145,9 +143,7 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { protected void setEntryPinned( @NonNull HeadsUpManager.HeadsUpEntry headsUpEntry, boolean isPinned) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "setEntryPinned: " + isPinned); - } + mLogger.logSetEntryPinned(headsUpEntry.mEntry.getKey(), isPinned); NotificationEntry entry = headsUpEntry.mEntry; if (entry.isRowPinned() != isPinned) { entry.setRowPinned(isPinned); @@ -198,10 +194,7 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { if (hasPinnedNotification == mHasPinnedNotification) { return; } - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "Pinned mode changed: " + mHasPinnedNotification + " -> " + - hasPinnedNotification); - } + mLogger.logUpdatePinnedMode(hasPinnedNotification); mHasPinnedNotification = hasPinnedNotification; if (mHasPinnedNotification) { MetricsLogger.count(mContext, "note_peek", 1); @@ -219,12 +212,11 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { Long snoozedUntil = mSnoozedPackages.get(key); if (snoozedUntil != null) { if (snoozedUntil > mClock.currentTimeMillis()) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, key + " snoozed"); - } + mLogger.logIsSnoozedReturned(key); return true; } - mSnoozedPackages.remove(packageName); + mLogger.logPackageUnsnoozed(key); + mSnoozedPackages.remove(key); } return false; } @@ -236,8 +228,9 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { for (String key : mAlertEntries.keySet()) { AlertEntry entry = getHeadsUpEntry(key); String packageName = entry.mEntry.getSbn().getPackageName(); - mSnoozedPackages.put(snoozeKey(packageName, mUser), - mClock.currentTimeMillis() + mSnoozeLengthMs); + String snoozeKey = snoozeKey(packageName, mUser); + mLogger.logPackageSnoozed(snoozeKey); + mSnoozedPackages.put(snoozeKey, mClock.currentTimeMillis() + mSnoozeLengthMs); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt new file mode 100644 index 0000000000000..2bdf62bbf75b0 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManagerLogger.kt @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.policy + +import com.android.systemui.log.LogBuffer +import com.android.systemui.log.LogLevel.INFO +import com.android.systemui.log.LogLevel.VERBOSE +import com.android.systemui.log.dagger.NotificationHeadsUpLog +import javax.inject.Inject + +/** Logger for [HeadsUpManager]. */ +class HeadsUpManagerLogger @Inject constructor( + @NotificationHeadsUpLog private val buffer: LogBuffer +) { + fun logPackageSnoozed(snoozeKey: String) { + buffer.log(TAG, INFO, { + str1 = snoozeKey + }, { + "package snoozed $str1" + }) + } + + fun logPackageUnsnoozed(snoozeKey: String) { + buffer.log(TAG, INFO, { + str1 = snoozeKey + }, { + "package unsnoozed $str1" + }) + } + + fun logIsSnoozedReturned(snoozeKey: String) { + buffer.log(TAG, INFO, { + str1 = snoozeKey + }, { + "package snoozed when queried $str1" + }) + } + + fun logReleaseAllImmediately() { + buffer.log(TAG, INFO, { }, { + "release all immediately" + }) + } + + fun logShowNotification(key: String) { + buffer.log(TAG, INFO, { + str1 = key + }, { + "show notification $str1" + }) + } + + fun logRemoveNotification(key: String, releaseImmediately: Boolean) { + buffer.log(TAG, INFO, { + str1 = key + bool1 = releaseImmediately + }, { + "remove notification $str1 releaseImmediately: $bool1" + }) + } + + fun logUpdateNotification(key: String, alert: Boolean, hasEntry: Boolean) { + buffer.log(TAG, INFO, { + str1 = key + bool1 = alert + bool2 = hasEntry + }, { + "update notification $str1 alert: $bool1 hasEntry: $bool2" + }) + } + + fun logUpdateEntry(updatePostTime: Boolean) { + buffer.log(TAG, INFO, { + bool1 = updatePostTime + }, { + "update entry updatePostTime: $bool1" + }) + } + + fun logSnoozeLengthChange(packageSnoozeLengthMs: Int) { + buffer.log(TAG, INFO, { + int1 = packageSnoozeLengthMs + }, { + "snooze length changed: ${int1}ms" + }) + } + + fun logSetEntryPinned(key: String, isPinned: Boolean) { + buffer.log(TAG, VERBOSE, { + str1 = key + bool1 = isPinned + }, { + "set entry pinned $str1 pinned: $bool1" + }) + } + + fun logUpdatePinnedMode(hasPinnedNotification: Boolean) { + buffer.log(TAG, INFO, { + bool1 = hasPinnedNotification + }, { + "has pinned notification changed to $bool1" + }) + } +} + +private const val TAG = "HeadsUpManager" \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java b/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java index 923aff1e6b3d4..65518d6b3e47f 100644 --- a/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/tv/TvSystemUIModule.java @@ -65,6 +65,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.HeadsUpManager; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController; import com.android.systemui.statusbar.policy.IndividualSensorPrivacyControllerImpl; import com.android.systemui.statusbar.policy.SensorPrivacyController; @@ -162,12 +163,19 @@ public abstract class TvSystemUIModule { @Provides static HeadsUpManagerPhone provideHeadsUpManagerPhone( Context context, + HeadsUpManagerLogger headsUpManagerLogger, StatusBarStateController statusBarStateController, KeyguardBypassController bypassController, NotificationGroupManagerLegacy groupManager, ConfigurationController configurationController) { - return new HeadsUpManagerPhone(context, statusBarStateController, bypassController, - groupManager, configurationController); + return new HeadsUpManagerPhone( + context, + headsUpManagerLogger, + statusBarStateController, + bypassController, + groupManager, + configurationController + ); } @Binds diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java index dee6020dfd569..9bf877584679e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java @@ -23,6 +23,7 @@ import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; @@ -42,6 +43,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import org.junit.Before; import org.junit.Rule; @@ -81,6 +83,7 @@ public class AlertingNotificationManagerTest extends SysuiTestCase { private AlertEntry mLastCreatedEntry; private TestableAlertingNotificationManager() { + super(mock(HeadsUpManagerLogger.class)); mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME; mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME; mHandler = mTestHandler; 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 c5d1e3acb2b94..e3dcfab604f66 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 @@ -68,6 +68,7 @@ import com.android.systemui.statusbar.notification.row.NotificationRowContentBin import com.android.systemui.statusbar.phone.ConfigurationControllerImpl; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.systemui.statusbar.policy.InflatedSmartReplyState; import com.android.systemui.statusbar.policy.InflatedSmartReplyViewHolder; import com.android.systemui.statusbar.policy.SmartReplyStateInflater; @@ -129,9 +130,14 @@ public class NotificationTestHelper { Optional.of((mock(Bubbles.class))), mock(DumpManager.class)); mGroupExpansionManager = mGroupMembershipManager; - mHeadsUpManager = new HeadsUpManagerPhone(mContext, mStatusBarStateController, - mock(KeyguardBypassController.class), mock(NotificationGroupManagerLegacy.class), - mock(ConfigurationControllerImpl.class)); + mHeadsUpManager = new HeadsUpManagerPhone( + mContext, + mock(HeadsUpManagerLogger.class), + mStatusBarStateController, + mock(KeyguardBypassController.class), + mock(NotificationGroupManagerLegacy.class), + mock(ConfigurationControllerImpl.class) + ); mGroupMembershipManager.setHeadsUpManager(mHeadsUpManager); mIconManager = new IconManager( mock(CommonNotifCollection.class), diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java index 83b6d2c088b9f..0f419c7684306 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java @@ -39,6 +39,7 @@ import com.android.systemui.statusbar.notification.collection.legacy.Notificatio import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.ConfigurationController; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import org.junit.Before; import org.junit.Ignore; @@ -57,6 +58,7 @@ public class HeadsUpManagerPhoneTest extends AlertingNotificationManagerTest { private HeadsUpManagerPhone mHeadsUpManager; + @Mock private HeadsUpManagerLogger mHeadsUpManagerLogger; @Mock private NotificationGroupManagerLegacy mGroupManager; @Mock private View mNotificationShadeWindowView; @Mock private VisualStabilityManager mVSManager; @@ -69,14 +71,21 @@ public class HeadsUpManagerPhoneTest extends AlertingNotificationManagerTest { private final class TestableHeadsUpManagerPhone extends HeadsUpManagerPhone { TestableHeadsUpManagerPhone( Context context, + HeadsUpManagerLogger headsUpManagerLogger, NotificationGroupManagerLegacy groupManager, VisualStabilityManager vsManager, StatusBarStateController statusBarStateController, KeyguardBypassController keyguardBypassController, ConfigurationController configurationController ) { - super(context, statusBarStateController, keyguardBypassController, - groupManager, configurationController); + super( + context, + headsUpManagerLogger, + statusBarStateController, + keyguardBypassController, + groupManager, + configurationController + ); setup(vsManager); mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME; mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME; @@ -96,8 +105,15 @@ public class HeadsUpManagerPhoneTest extends AlertingNotificationManagerTest { when(mVSManager.isReorderingAllowed()).thenReturn(true); mDependency.injectMockDependency(NotificationShadeWindowController.class); mDependency.injectMockDependency(ConfigurationController.class); - mHeadsUpManager = new TestableHeadsUpManagerPhone(mContext, mGroupManager, mVSManager, - mStatusBarStateController, mBypassController, mConfigurationController); + mHeadsUpManager = new TestableHeadsUpManagerPhone( + mContext, + mHeadsUpManagerLogger, + mGroupManager, + mVSManager, + mStatusBarStateController, + mBypassController, + mConfigurationController + ); super.setUp(); mHeadsUpManager.mHandler = mTestHandler; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java index 80d9c0876ec1c..b717d28b24ff6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java @@ -48,6 +48,7 @@ import com.android.systemui.statusbar.notification.row.NotifBindPipeline.BindCal import com.android.systemui.statusbar.notification.row.RowContentBindParams; import com.android.systemui.statusbar.notification.row.RowContentBindStage; import com.android.systemui.statusbar.policy.HeadsUpManager; +import com.android.systemui.statusbar.policy.HeadsUpManagerLogger; import com.android.wm.shell.bubbles.Bubbles; import org.junit.Before; @@ -86,7 +87,7 @@ public class NotificationGroupAlertTransferHelperTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mHeadsUpManager = new HeadsUpManager(mContext) {}; + mHeadsUpManager = new HeadsUpManager(mContext, mock(HeadsUpManagerLogger.class)) {}; when(mNotificationEntryManager.getPendingNotificationsIterator()) .thenReturn(mPendingEntries.values()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java index b53cbf72ef6ef..5e852e303533b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HeadsUpManagerTest.java @@ -60,7 +60,7 @@ public class HeadsUpManagerTest extends AlertingNotificationManagerTest { private final class TestableHeadsUpManager extends HeadsUpManager { TestableHeadsUpManager(Context context) { - super(context); + super(context, mock(HeadsUpManagerLogger.class)); mMinimumDisplayTime = TEST_MINIMUM_DISPLAY_TIME; mAutoDismissNotificationDecay = TEST_AUTO_DISMISS_TIME; }