[SB Refactor] Define a new buffer for the shared connectivity repo.

Since ConnectivityPiplineLogger will eventually become mobile only, we
need to add a different buffer for the shared repo.

Bug: 238425913
Test: make modifications via System UI Tuner, then `adb shell dumpsys
activity service com.android.systemui/.SystemUIService
SharedConnectivityInputLog` -> see tuner updates in log

Change-Id: I5b75bc5e09f176ce54264023f0fcf33eb52ed07a
This commit is contained in:
Caitlin Shkuratov
2023-02-13 19:48:47 +00:00
parent 21fa009309
commit 2f946a641a
5 changed files with 74 additions and 5 deletions

View File

@@ -0,0 +1,25 @@
/*
* 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.pipeline.dagger
import javax.inject.Qualifier
/** Logs for connectivity-related inputs that are shared across wifi, mobile, etc. */
@Qualifier
@MustBeDocumented
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
annotation class SharedConnectivityInputLog

View File

@@ -128,6 +128,13 @@ abstract class StatusBarPipelineModule {
return factory.create("AirplaneTableLog", 30)
}
@Provides
@SysUISingleton
@SharedConnectivityInputLog
fun provideSharedConnectivityTableLogBuffer(factory: LogBufferFactory): LogBuffer {
return factory.create("SharedConnectivityInputLog", 30)
}
@Provides
@SysUISingleton
@MobileSummaryLog

View File

@@ -0,0 +1,37 @@
/*
* 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.pipeline.shared
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.plugins.log.LogLevel
import com.android.systemui.statusbar.pipeline.dagger.SharedConnectivityInputLog
import javax.inject.Inject
/** Logs for connectivity-related inputs that are shared across wifi, mobile, etc. */
@SysUISingleton
class ConnectivityInputLogger
@Inject
constructor(
@SharedConnectivityInputLog private val buffer: LogBuffer,
) {
fun logTuningChanged(tuningList: String?) {
buffer.log(TAG, LogLevel.DEBUG, { str1 = tuningList }, { "onTuningChanged: $str1" })
}
}
private const val TAG = "ConnectivityInputLogger"

View File

@@ -26,7 +26,7 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dump.DumpManager
import com.android.systemui.statusbar.phone.StatusBarIconController
import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger
import com.android.systemui.statusbar.pipeline.shared.ConnectivityInputLogger
import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger.Companion.SB_LOGGING_TAG
import com.android.systemui.statusbar.pipeline.shared.data.model.ConnectivitySlot
import com.android.systemui.statusbar.pipeline.shared.data.model.ConnectivitySlots
@@ -57,7 +57,7 @@ class ConnectivityRepositoryImpl @Inject constructor(
private val connectivitySlots: ConnectivitySlots,
context: Context,
dumpManager: DumpManager,
logger: ConnectivityPipelineLogger,
logger: ConnectivityInputLogger,
@Application scope: CoroutineScope,
tunerService: TunerService,
) : ConnectivityRepository, Dumpable {
@@ -77,7 +77,7 @@ class ConnectivityRepositoryImpl @Inject constructor(
if (key != HIDDEN_ICONS_TUNABLE_KEY) {
return
}
logger.logInputChange("onTuningChanged", newHideList)
logger.logTuningChanged(newHideList)
val outputList = newHideList?.split(",")?.toSlotSet(connectivitySlots)
?: defaultHiddenIcons

View File

@@ -19,7 +19,7 @@ package com.android.systemui.statusbar.pipeline.shared.data.repository
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.dump.DumpManager
import com.android.systemui.statusbar.pipeline.shared.ConnectivityPipelineLogger
import com.android.systemui.statusbar.pipeline.shared.ConnectivityInputLogger
import com.android.systemui.statusbar.pipeline.shared.data.model.ConnectivitySlot
import com.android.systemui.statusbar.pipeline.shared.data.model.ConnectivitySlots
import com.android.systemui.statusbar.pipeline.shared.data.repository.ConnectivityRepositoryImpl.Companion.DEFAULT_HIDDEN_ICONS_RESOURCE
@@ -52,7 +52,7 @@ class ConnectivityRepositoryImplTest : SysuiTestCase() {
@Mock private lateinit var connectivitySlots: ConnectivitySlots
@Mock private lateinit var dumpManager: DumpManager
@Mock private lateinit var logger: ConnectivityPipelineLogger
@Mock private lateinit var logger: ConnectivityInputLogger
private lateinit var scope: CoroutineScope
@Mock private lateinit var tunerService: TunerService