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

Commit 6ef29c50 authored by Priyanka Advani's avatar Priyanka Advani Committed by Android (Google) Code Review
Browse files

Revert "[Satellite] Input logging for the repository layer"

Revert submission 25841762

Reason for revert: Likely culprit for b/320529189. Will be running through ABTD before submitting the revert.

Reverted changes: /q/submissionid:25841762

Change-Id: Iac4d26ccc33d37e3023804429f6a8c9e2b9e02e9
parent 77387ee5
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
/*
 * 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
+0 −7
Original line number Diff line number Diff line
@@ -265,13 +265,6 @@ 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"
    }
+3 −47
Original line number Diff line number Diff line
@@ -25,11 +25,6 @@ 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
@@ -129,7 +124,6 @@ constructor(
    satelliteManagerOpt: Optional<SatelliteManager>,
    @Background private val bgDispatcher: CoroutineDispatcher,
    @Application private val scope: CoroutineScope,
    @OemSatelliteInputLog private val logBuffer: LogBuffer,
    private val systemClock: SystemClock,
) : DeviceBasedSatelliteRepository {

@@ -152,11 +146,6 @@ 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
@@ -171,9 +160,6 @@ constructor(
                                 * connection might cause more frequent checks.
                                 */
                                while (true) {
                                    logBuffer.i {
                                        "requestIsSatelliteCommunicationAllowedForCurrentLocation"
                                    }
                                    checkIsSatelliteAllowed()
                                    delay(POLLING_INTERVAL_MS)
                                }
@@ -182,8 +168,6 @@ constructor(
                }
            }
        } else {
            logBuffer.i { "Satellite manager is null" }

            satelliteSupport.value = NotSupported
        }
    }
@@ -198,7 +182,6 @@ constructor(
    private fun connectionStateFlow(sm: SupportedSatelliteManager): Flow<SatelliteConnectionState> =
        conflatedCallbackFlow {
                val cb = SatelliteModemStateCallback { state ->
                    logBuffer.i({ int1 = state }) { "onSatelliteModemStateChanged: state=$int1" }
                    trySend(SatelliteConnectionState.fromModemState(state))
                }

@@ -209,7 +192,7 @@ constructor(
                        sm.registerForSatelliteModemStateChanged(bgDispatcher.asExecutor(), cb)
                    registered = res == SATELLITE_RESULT_SUCCESS
                } catch (e: Exception) {
                    logBuffer.e("error registering for modem state", e)
                    // Logging is in next commit
                }

                awaitClose { if (registered) sm.unregisterForSatelliteModemStateChanged(cb) }
@@ -223,9 +206,6 @@ constructor(
    private fun signalStrengthFlow(sm: SupportedSatelliteManager) =
        conflatedCallbackFlow {
                val cb = NtnSignalStrengthCallback { signalStrength ->
                    logBuffer.i({ int1 = signalStrength.level }) {
                        "onNtnSignalStrengthChanged: level=$int1"
                    }
                    trySend(signalStrength.level)
                }

@@ -234,7 +214,7 @@ constructor(
                    sm.registerForNtnSignalStrengthChanged(bgDispatcher.asExecutor(), cb)
                    registered = true
                } catch (e: Exception) {
                    logBuffer.e("error registering for signal strength", e)
                    // Logging is in next commit
                }

                awaitClose { if (registered) sm.unregisterForNtnSignalStrengthChanged(cb) }
@@ -248,15 +228,11 @@ constructor(
                bgDispatcher.asExecutor(),
                object : OutcomeReceiver<Boolean, SatelliteManager.SatelliteException> {
                    override fun onError(e: SatelliteManager.SatelliteException) {
                        logBuffer.e(
                            "Found exception when checking availability",
                            e,
                        )
                        android.util.Log.e(TAG, "Found exception when checking for satellite: ", e)
                        isSatelliteAllowedForCurrentLocation.value = false
                    }

                    override fun onResult(allowed: Boolean) {
                        logBuffer.i { allowed.toString() }
                        isSatelliteAllowedForCurrentLocation.value = allowed
                    }
                }
@@ -278,12 +254,6 @@ 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)
                    }
@@ -309,19 +279,5 @@ 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,
            )
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ 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
@@ -88,7 +87,6 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
                    Optional.empty(),
                    dispatcher,
                    testScope.backgroundScope,
                    FakeLogBuffer.Factory.create(),
                    systemClock,
                )

@@ -398,7 +396,6 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
                if (satMan != null) Optional.of(satMan) else Optional.empty(),
                dispatcher,
                testScope.backgroundScope,
                FakeLogBuffer.Factory.create(),
                systemClock,
            )
    }