Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fd9d557 authored by Jernej Virag's avatar Jernej Virag
Browse files

Register Notification Memory Logging after boot completed

Based on statsd team recommendations, we probably shouldn't be talking
to stats service before LOCKED_BOOT_COMPLETED has triggered. This change
moves registration of statsd callbacks after that event.

Bug: 283841311
Test: using bugreports on panther
Change-Id: I6b3784990ad71b11af33ac790d3cb012f45679ff
parent f16b2dfa
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.dagger

import com.android.systemui.CoreStartable
import com.android.systemui.statusbar.notification.logging.NotificationMemoryMonitor
import dagger.Binds
import dagger.Module
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap

@Module
interface NotificationMemoryModule {

    /** Binds memory monitor into startable map. */
    @Binds
    @IntoMap
    @ClassKey(NotificationMemoryMonitor::class)
    fun bindsNotificationMemoryMonitorStartable(monitor: NotificationMemoryMonitor): CoreStartable
}
+0 −3
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.No
import com.android.systemui.statusbar.notification.collection.render.NotifStackController
import com.android.systemui.statusbar.notification.interruption.HeadsUpViewBinder
import com.android.systemui.statusbar.notification.logging.NotificationLogger
import com.android.systemui.statusbar.notification.logging.NotificationMemoryMonitor
import com.android.systemui.statusbar.notification.row.NotifBindPipelineInitializer
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import com.android.wm.shell.bubbles.Bubbles
@@ -72,7 +71,6 @@ class NotificationsControllerImpl @Inject constructor(
    private val peopleSpaceWidgetManager: PeopleSpaceWidgetManager,
    private val bubblesOptional: Optional<Bubbles>,
    private val fgsNotifListener: ForegroundServiceNotificationListener,
    private val memoryMonitor: Lazy<NotificationMemoryMonitor>,
    private val featureFlags: FeatureFlags
) : NotificationsController {

@@ -108,7 +106,6 @@ class NotificationsControllerImpl @Inject constructor(
        notificationLogger.setUpWithContainer(listContainer)
        peopleSpaceWidgetManager.attach(notificationListener)
        fgsNotifListener.init()
        memoryMonitor.get().init()
    }

    // TODO: Convert all functions below this line into listeners instead of public methods
+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
package com.android.systemui.statusbar.notification.logging

import android.util.Log
import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
@@ -32,13 +33,13 @@ constructor(
    private val featureFlags: FeatureFlags,
    private val notificationMemoryDumper: NotificationMemoryDumper,
    private val notificationMemoryLogger: Lazy<NotificationMemoryLogger>,
) {
) : CoreStartable {

    companion object {
        private const val TAG = "NotificationMemory"
    }

    fun init() {
    override fun start() {
        Log.d(TAG, "NotificationMemoryMonitor initialized.")
        notificationMemoryDumper.init()
        if (featureFlags.isEnabled(Flags.NOTIFICATION_MEMORY_LOGGING_ENABLED)) {