Move notif LogBuffers to new NotificationsLogModule

Bug: 369151941
Test: builds
Flag: EXEMPT not possible
Change-Id: Id43d1a238f8caca6a30ac0d7d8690aeaec8de07a
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 4c21da5..8097d95 100644
--- a/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java
+++ b/packages/SystemUI/src/com/android/systemui/log/dagger/LogModule.java
@@ -32,8 +32,6 @@
 import com.android.systemui.qs.QSFragmentLegacy;
 import com.android.systemui.qs.pipeline.shared.QSPipelineFlagsRepository;
 import com.android.systemui.qs.pipeline.shared.TileSpec;
-import com.android.systemui.statusbar.notification.NotifPipelineFlags;
-import com.android.systemui.util.Compile;
 import com.android.systemui.util.wakelock.WakeLockLog;
 
 import dagger.Lazy;
@@ -56,61 +54,6 @@
         return factory.create("DozeLog", 150);
     }
 
-    /** Provides a logging buffer for all logs related to the data layer of notifications. */
-    @Provides
-    @SysUISingleton
-    @NotificationLog
-    public static LogBuffer provideNotificationsLogBuffer(
-            LogBufferFactory factory,
-            NotifPipelineFlags notifPipelineFlags) {
-        int maxSize = 1000;
-        if (Compile.IS_DEBUG && notifPipelineFlags.isDevLoggingEnabled()) {
-            maxSize *= 10;
-        }
-        return factory.create("NotifLog", maxSize, Compile.IS_DEBUG /* systrace */);
-    }
-
-    /** Provides a logging buffer for all logs related to notifications on the lockscreen. */
-    @Provides
-    @SysUISingleton
-    @NotificationLockscreenLog
-    public static LogBuffer provideNotificationLockScreenLogBuffer(
-            LogBufferFactory factory) {
-        return factory.create("NotifLockscreenLog", 50, false /* systrace */);
-    }
-
-    /** Provides a logging buffer for logs related to heads up presentation of notifications. */
-    @Provides
-    @SysUISingleton
-    @NotificationHeadsUpLog
-    public static LogBuffer provideNotificationHeadsUpLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifHeadsUpLog", 1000);
-    }
-
-    /** Provides a logging buffer for logs related to inflation of notifications. */
-    @Provides
-    @SysUISingleton
-    @NotifInflationLog
-    public static LogBuffer provideNotifInflationLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifInflationLog", 250);
-    }
-
-    /** Provides a logging buffer for notification interruption calculations. */
-    @Provides
-    @SysUISingleton
-    @NotificationInterruptLog
-    public static LogBuffer provideNotificationInterruptLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifInterruptLog", 100);
-    }
-
-    /** Provides a logging buffer for notification rendering events. */
-    @Provides
-    @SysUISingleton
-    @NotificationRenderLog
-    public static LogBuffer provideNotificationRenderLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifRenderLog", 100);
-    }
-
     /** Provides a logging buffer for all logs for lockscreen to shade transition events. */
     @Provides
     @SysUISingleton
@@ -119,16 +62,6 @@
         return factory.create("LSShadeTransitionLog", 50);
     }
 
-    /** */
-    @Provides
-    @SysUISingleton
-    @SensitiveNotificationProtectionLog
-    public static LogBuffer provideSensitiveNotificationProtectionLogBuffer(
-            LogBufferFactory factory
-    ) {
-        return factory.create("SensitiveNotificationProtectionLog", 10);
-    }
-
     /** Provides a logging buffer for shade window messages. */
     @Provides
     @SysUISingleton
@@ -153,30 +86,6 @@
         return factory.create("ShadeTouchLog", 500, false);
     }
 
-    /** Provides a logging buffer for all logs related to managing notification sections. */
-    @Provides
-    @SysUISingleton
-    @NotificationSectionLog
-    public static LogBuffer provideNotificationSectionLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifSectionLog", 1000 /* maxSize */, false /* systrace */);
-    }
-
-    /** Provides a logging buffer for all logs related to remote input controller. */
-    @Provides
-    @SysUISingleton
-    @NotificationRemoteInputLog
-    public static LogBuffer provideNotificationRemoteInputLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifRemoteInputLog", 50 /* maxSize */, false /* systrace */);
-    }
-
-    /** Provides a logging buffer for all logs related to notification visual stability. */
-    @Provides
-    @SysUISingleton
-    @VisualStabilityLog
-    public static LogBuffer provideVisualStabilityLogBuffer(LogBufferFactory factory) {
-        return factory.create("VisualStabilityLog", 50 /* maxSize */, false /* systrace */);
-    }
-
     /** Provides a logging buffer for all logs related to keyguard media controller. */
     @Provides
     @SysUISingleton
@@ -185,22 +94,6 @@
         return factory.create("KeyguardMediaControllerLog", 50 /* maxSize */, false /* systrace */);
     }
 
-    /** Provides a logging buffer for all logs related to unseen notifications. */
-    @Provides
-    @SysUISingleton
-    @UnseenNotificationLog
-    public static LogBuffer provideUnseenNotificationLogBuffer(LogBufferFactory factory) {
-        return factory.create("UnseenNotifLog", 20 /* maxSize */, false /* systrace */);
-    }
-
-    /** Provides a logging buffer for all logs related to the data layer of notifications. */
-    @Provides
-    @SysUISingleton
-    @NotifInteractionLog
-    public static LogBuffer provideNotifInteractionLogBuffer(LogBufferFactory factory) {
-        return factory.create("NotifInteractionLog", 50);
-    }
-
     /** Provides a logging buffer for all logs related to Quick Settings. */
     @Provides
     @SysUISingleton
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 684ce48..42aadd1 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
@@ -76,6 +76,7 @@
 import com.android.systemui.statusbar.notification.interruption.VisualInterruptionRefactor;
 import com.android.systemui.statusbar.notification.logging.NotificationPanelLogger;
 import com.android.systemui.statusbar.notification.logging.NotificationPanelLoggerImpl;
+import com.android.systemui.statusbar.notification.logging.dagger.NotificationsLogModule;
 import com.android.systemui.statusbar.notification.row.NotificationEntryProcessorFactory;
 import com.android.systemui.statusbar.notification.row.NotificationEntryProcessorFactoryLooperImpl;
 import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
@@ -116,6 +117,7 @@
         ActivatableNotificationViewModelModule.class,
         NotificationMemoryModule.class,
         NotificationStatsLoggerModule.class,
+        NotificationsLogModule.class,
 })
 public interface NotificationsModule {
     @Binds
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/dagger/NotificationsLogModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/dagger/NotificationsLogModule.kt
new file mode 100644
index 0000000..7dd4cde
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/dagger/NotificationsLogModule.kt
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2024 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.notification.logging.dagger
+
+import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.LogBufferFactory
+import com.android.systemui.log.dagger.NotifInflationLog
+import com.android.systemui.log.dagger.NotifInteractionLog
+import com.android.systemui.log.dagger.NotificationHeadsUpLog
+import com.android.systemui.log.dagger.NotificationInterruptLog
+import com.android.systemui.log.dagger.NotificationLockscreenLog
+import com.android.systemui.log.dagger.NotificationLog
+import com.android.systemui.log.dagger.NotificationRemoteInputLog
+import com.android.systemui.log.dagger.NotificationRenderLog
+import com.android.systemui.log.dagger.NotificationSectionLog
+import com.android.systemui.log.dagger.SensitiveNotificationProtectionLog
+import com.android.systemui.log.dagger.UnseenNotificationLog
+import com.android.systemui.log.dagger.VisualStabilityLog
+import com.android.systemui.statusbar.notification.NotifPipelineFlags
+import com.android.systemui.util.Compile
+import dagger.Module
+import dagger.Provides
+
+@Module
+object NotificationsLogModule {
+    /** Provides a logging buffer for logs related to heads up presentation of notifications. */
+    @Provides
+    @SysUISingleton
+    @NotificationHeadsUpLog
+    fun provideNotificationHeadsUpLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifHeadsUpLog", 1000)
+    }
+
+    /** Provides a logging buffer for logs related to inflation of notifications. */
+    @Provides
+    @SysUISingleton
+    @NotifInflationLog
+    fun provideNotifInflationLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifInflationLog", 250)
+    }
+
+    /** Provides a logging buffer for all logs related to the data layer of notifications. */
+    @Provides
+    @SysUISingleton
+    @NotifInteractionLog
+    fun provideNotifInteractionLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifInteractionLog", 50)
+    }
+
+    /** Provides a logging buffer for notification interruption calculations. */
+    @Provides
+    @SysUISingleton
+    @NotificationInterruptLog
+    fun provideNotificationInterruptLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifInterruptLog", 100)
+    }
+
+    /** Provides a logging buffer for all logs related to notifications on the lockscreen. */
+    @Provides
+    @SysUISingleton
+    @NotificationLockscreenLog
+    fun provideNotificationLockScreenLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifLockscreenLog", 50, false /* systrace */)
+    }
+
+    /** Provides a logging buffer for all logs related to the data layer of notifications. */
+    @Provides
+    @SysUISingleton
+    @NotificationLog
+    fun provideNotificationsLogBuffer(
+        factory: LogBufferFactory,
+        notifPipelineFlags: NotifPipelineFlags,
+    ): LogBuffer {
+        var maxSize = 1000
+        if (Compile.IS_DEBUG && notifPipelineFlags.isDevLoggingEnabled()) {
+            maxSize *= 10
+        }
+        return factory.create("NotifLog", maxSize, Compile.IS_DEBUG /* systrace */)
+    }
+
+    /** Provides a logging buffer for all logs related to remote input controller. */
+    @Provides
+    @SysUISingleton
+    @NotificationRemoteInputLog
+    fun provideNotificationRemoteInputLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifRemoteInputLog", 50, /* maxSize */ false /* systrace */)
+    }
+
+    /** Provides a logging buffer for notification rendering events. */
+    @Provides
+    @SysUISingleton
+    @NotificationRenderLog
+    fun provideNotificationRenderLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifRenderLog", 100)
+    }
+
+    /** Provides a logging buffer for all logs related to managing notification sections. */
+    @Provides
+    @SysUISingleton
+    @NotificationSectionLog
+    fun provideNotificationSectionLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("NotifSectionLog", 1000, /* maxSize */ false /* systrace */)
+    }
+
+    /**  */
+    @Provides
+    @SysUISingleton
+    @SensitiveNotificationProtectionLog
+    fun provideSensitiveNotificationProtectionLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("SensitiveNotificationProtectionLog", 10)
+    }
+
+    /** Provides a logging buffer for all logs related to unseen notifications. */
+    @Provides
+    @SysUISingleton
+    @UnseenNotificationLog
+    fun provideUnseenNotificationLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("UnseenNotifLog", 20, /* maxSize */ false /* systrace */)
+    }
+
+    /** Provides a logging buffer for all logs related to notification visual stability. */
+    @Provides
+    @SysUISingleton
+    @VisualStabilityLog
+    fun provideVisualStabilityLogBuffer(factory: LogBufferFactory): LogBuffer {
+        return factory.create("VisualStabilityLog", 50, /* maxSize */ false /* systrace */)
+    }
+}