Merge changes If58bf46a,I6b378499 into udc-qpr-dev

* changes:
  Enable listener for statsd notification memory collection
  Register Notification Memory Logging after boot completed
This commit is contained in:
Jernej Virag
2023-07-31 09:19:30 +00:00
committed by Android (Google) Code Review
4 changed files with 40 additions and 8 deletions

View File

@@ -62,11 +62,12 @@ object Flags {
val INSTANT_VOICE_REPLY = unreleasedFlag(111, "instant_voice_reply")
/**
* This flag is server-controlled and should stay as [unreleasedFlag] since we never want to
* enable it on release builds.
* This flag controls whether we register a listener for StatsD notification memory reports.
* For statsd to actually call the listener however, a server-side toggle needs to be
* enabled as well.
*/
val NOTIFICATION_MEMORY_LOGGING_ENABLED =
unreleasedFlag(119, "notification_memory_logging_enabled")
releasedFlag(119, "notification_memory_logging_enabled")
// TODO(b/260335638): Tracking Bug
@JvmField

View File

@@ -0,0 +1,33 @@
/*
* 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
}

View File

@@ -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

View File

@@ -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)) {