summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Laird <evanlaird@google.com> 2024-01-17 19:51:08 +0000
committer Evan Laird <evanlaird@google.com> 2024-01-18 17:36:39 -0500
commitbcd04bd9d5e373aeec2a59dedbc1597a4ccc81c4 (patch)
tree344bf436ea5dadadb362ba506bf2dc147a2afe7d
parent7cd20ff09af0a99fea9ba2125377ec0380daa276 (diff)
Revert^2 "[Satellite] Input logging for the repository layer"
6ef29c5003eec058447a5244969b6fdc5aa74dfd Original commit message: [Satellite] Input logging for the repository layer Test: adb shell cmd statusbar echo -b DeviceBasedSatelliteInputLog:V Test: after above command, grep for "DeviceBasedSatelliteRepo" Bug: 311417356 Flag: ACONFIG com.android.internal.telephony.flags.oem_enabled_satellite_flag DEVELOPMENT Change-Id: Ib0415397bcef72fd0f5a62108c35214556572fe6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/OemSatelliteInputLog.kt26
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt57
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt3
4 files changed, 89 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/OemSatelliteInputLog.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/OemSatelliteInputLog.kt
new file mode 100644
index 000000000000..252945f1ed6a
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/OemSatelliteInputLog.kt
@@ -0,0 +1,26 @@
+/*
+ * 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.pipeline.dagger
+
+import com.android.systemui.statusbar.pipeline.satellite.data.DeviceBasedSatelliteRepository
+import javax.inject.Qualifier
+
+/** Detailed [DeviceBasedSatelliteRepository] logs */
+@Qualifier
+@MustBeDocumented
+@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
+annotation class OemSatelliteInputLog
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt
index e309c32df64e..2b90e649a154 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt
@@ -265,6 +265,13 @@ abstract class StatusBarPipelineModule {
return factory.create("VerboseMobileViewLog", 100)
}
+ @Provides
+ @SysUISingleton
+ @OemSatelliteInputLog
+ fun provideOemSatelliteInputLog(factory: LogBufferFactory): LogBuffer {
+ return factory.create("DeviceBasedSatelliteInputLog", 32)
+ }
+
const val FIRST_MOBILE_SUB_SHOWING_NETWORK_TYPE_ICON =
"FirstMobileSubShowingNetworkTypeIcon"
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt
index 6f69c2c60397..0e6775685611 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt
@@ -26,6 +26,11 @@ import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCall
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
+import com.android.systemui.log.LogBuffer
+import com.android.systemui.log.core.LogLevel
+import com.android.systemui.log.core.MessageInitializer
+import com.android.systemui.log.core.MessagePrinter
+import com.android.systemui.statusbar.pipeline.dagger.OemSatelliteInputLog
import com.android.systemui.statusbar.pipeline.satellite.data.DeviceBasedSatelliteRepository
import com.android.systemui.statusbar.pipeline.satellite.data.prod.SatelliteSupport.Companion.whenSupported
import com.android.systemui.statusbar.pipeline.satellite.data.prod.SatelliteSupport.NotSupported
@@ -127,6 +132,7 @@ constructor(
satelliteManagerOpt: Optional<SatelliteManager>,
@Background private val bgDispatcher: CoroutineDispatcher,
@Application private val scope: CoroutineScope,
+ @OemSatelliteInputLog private val logBuffer: LogBuffer,
private val systemClock: SystemClock,
) : DeviceBasedSatelliteRepository {
@@ -150,6 +156,11 @@ constructor(
ensureMinUptime(systemClock, MIN_UPTIME)
satelliteSupport.value = satelliteManager.checkSatelliteSupported()
+ logBuffer.i(
+ { str1 = satelliteSupport.value.toString() },
+ { "Checked for system support. support=$str1" },
+ )
+
// We only need to check location availability if this mode is supported
if (satelliteSupport.value is Supported) {
isSatelliteAllowedForCurrentLocation.subscriptionCount
@@ -164,6 +175,9 @@ constructor(
* connection might cause more frequent checks.
*/
while (true) {
+ logBuffer.i {
+ "requestIsSatelliteCommunicationAllowedForCurrentLocation"
+ }
checkIsSatelliteAllowed()
delay(POLLING_INTERVAL_MS)
}
@@ -172,6 +186,8 @@ constructor(
}
}
} else {
+ logBuffer.i { "Satellite manager is null" }
+
satelliteSupport.value = NotSupported
}
}
@@ -186,6 +202,7 @@ constructor(
private fun connectionStateFlow(sm: SupportedSatelliteManager): Flow<SatelliteConnectionState> =
conflatedCallbackFlow {
val cb = SatelliteModemStateCallback { state ->
+ logBuffer.i({ int1 = state }) { "onSatelliteModemStateChanged: state=$int1" }
trySend(SatelliteConnectionState.fromModemState(state))
}
@@ -196,7 +213,7 @@ constructor(
sm.registerForSatelliteModemStateChanged(bgDispatcher.asExecutor(), cb)
registered = res == SATELLITE_RESULT_SUCCESS
} catch (e: Exception) {
- // Logging is in next commit
+ logBuffer.e("error registering for modem state", e)
}
awaitClose { if (registered) sm.unregisterForSatelliteModemStateChanged(cb) }
@@ -210,6 +227,9 @@ constructor(
private fun signalStrengthFlow(sm: SupportedSatelliteManager) =
conflatedCallbackFlow {
val cb = NtnSignalStrengthCallback { signalStrength ->
+ logBuffer.i({ int1 = signalStrength.level }) {
+ "onNtnSignalStrengthChanged: level=$int1"
+ }
trySend(signalStrength.level)
}
@@ -218,7 +238,7 @@ constructor(
sm.registerForNtnSignalStrengthChanged(bgDispatcher.asExecutor(), cb)
registered = true
} catch (e: Exception) {
- // Logging is in next commit
+ logBuffer.e("error registering for signal strength", e)
}
awaitClose { if (registered) sm.unregisterForNtnSignalStrengthChanged(cb) }
@@ -232,11 +252,15 @@ constructor(
bgDispatcher.asExecutor(),
object : OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> {
override fun onError(e: SatelliteManager.SatelliteException) {
- android.util.Log.e(TAG, "Found exception when checking for satellite: ", e)
+ logBuffer.e(
+ "Found exception when checking availability",
+ e,
+ )
isSatelliteAllowedForCurrentLocation.value = false
}
override fun onResult(allowed: Boolean) {
+ logBuffer.i { allowed.toString() }
isSatelliteAllowedForCurrentLocation.value = allowed
}
}
@@ -258,6 +282,12 @@ constructor(
}
override fun onError(error: SatelliteManager.SatelliteException) {
+ logBuffer.e(
+ "Exception when checking for satellite support. " +
+ "Assuming it is not supported for this device.",
+ error,
+ )
+
// Assume that an error means it's not supported
continuation.resume(NotSupported)
}
@@ -265,7 +295,12 @@ constructor(
try {
requestIsSatelliteSupported(bgDispatcher.asExecutor(), cb)
- } catch (e: Exception) {
+ } catch (error: Exception) {
+ logBuffer.e(
+ "Exception when checking for satellite support. " +
+ "Assuming it is not supported for this device.",
+ error,
+ )
continuation.resume(NotSupported)
}
}
@@ -287,5 +322,19 @@ constructor(
delay(timeTilMinUptime)
}
}
+
+ /** A couple of convenience logging methods rather than a whole class */
+ private fun LogBuffer.i(
+ initializer: MessageInitializer = {},
+ printer: MessagePrinter,
+ ) = this.log(TAG, LogLevel.INFO, initializer, printer)
+
+ private fun LogBuffer.e(message: String, exception: Throwable? = null) =
+ this.log(
+ tag = TAG,
+ level = LogLevel.ERROR,
+ message = message,
+ exception = exception,
+ )
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt
index 723eda0783cd..0e0d4897d667 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt
@@ -35,6 +35,7 @@ import android.telephony.satellite.SatelliteModemStateCallback
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.log.core.FakeLogBuffer
import com.android.systemui.statusbar.pipeline.satellite.data.prod.DeviceBasedSatelliteRepositoryImpl.Companion.MIN_UPTIME
import com.android.systemui.statusbar.pipeline.satellite.data.prod.DeviceBasedSatelliteRepositoryImpl.Companion.POLLING_INTERVAL_MS
import com.android.systemui.statusbar.pipeline.satellite.shared.model.SatelliteConnectionState
@@ -87,6 +88,7 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
Optional.empty(),
dispatcher,
testScope.backgroundScope,
+ FakeLogBuffer.Factory.create(),
systemClock,
)
@@ -419,6 +421,7 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
if (satMan != null) Optional.of(satMan) else Optional.empty(),
dispatcher,
testScope.backgroundScope,
+ FakeLogBuffer.Factory.create(),
systemClock,
)
}