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

Commit d7a5e6a8 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge "[SB][Sat] Add carrier text logs, make device-based sat VM a singleton." into main

parents fa996c9f 996bf18e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ public class CarrierTextManager {
                });
                mTelephonyListenerManager.addActiveDataSubscriptionIdListener(mPhoneStateListener);
                cancelSatelliteCollectionJob(/* reason= */ "Starting new job");
                mLogger.logStartListeningForSatelliteCarrierText();
                mSatelliteConnectionJob =
                    mJavaAdapter.alwaysCollectFlow(
                        mDeviceBasedSatelliteViewModel.getCarrierText(),
@@ -316,7 +317,7 @@ public class CarrierTextManager {
                mWakefulnessLifecycle.removeObserver(mWakefulnessObserver);
            });
            mTelephonyListenerManager.removeActiveDataSubscriptionIdListener(mPhoneStateListener);
            cancelSatelliteCollectionJob(/* reason= */ "Stopping listening");
            cancelSatelliteCollectionJob(/* reason= */ "#handleSetListening has null callback");
        }
    }

@@ -336,6 +337,7 @@ public class CarrierTextManager {

    private void onSatelliteCarrierTextChanged(@Nullable String text) {
        mLogger.logUpdateCarrierTextForReason(REASON_SATELLITE_CHANGED);
        mLogger.logNewSatelliteCarrierText(text);
        mSatelliteCarrierText = text;
        updateCarrierText();
    }
@@ -654,6 +656,7 @@ public class CarrierTextManager {
    private void cancelSatelliteCollectionJob(String reason) {
        Job job = mSatelliteConnectionJob;
        if (job != null) {
            mLogger.logStopListeningForSatelliteCarrierText(reason);
            job.cancel(new CancellationException(reason));
        }
    }
+43 −4
Original line number Diff line number Diff line
@@ -38,8 +38,11 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu
        buffer.log(
            TAG,
            LogLevel.VERBOSE,
            { int1 = numSubs },
            { "updateCarrierText: location=${location ?: "(unknown)"} numSubs=$int1" },
            {
                int1 = numSubs
                str1 = location
            },
            { "updateCarrierText: location=${str1 ?: "(unknown)"} numSubs=$int1" },
        )
    }

@@ -77,6 +80,15 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu
        )
    }

    fun logNewSatelliteCarrierText(newSatelliteText: String?) {
        buffer.log(
            TAG,
            LogLevel.VERBOSE,
            { str1 = newSatelliteText },
            { "New satellite text = $str1" },
        )
    }

    fun logUsingSatelliteText(satelliteText: String) {
        buffer.log(
            TAG,
@@ -125,10 +137,37 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu
        buffer.log(
            TAG,
            LogLevel.DEBUG,
            { int1 = reason },
            {
                int1 = reason
                str1 = location
            },
            {
                "refreshing carrier info for reason: ${reason.reasonMessage()}" +
                    " location=${location ?: "(unknown)"}"
                    " location=${str1 ?: "(unknown)"}"
            }
        )
    }

    fun logStartListeningForSatelliteCarrierText() {
        buffer.log(
            TAG,
            LogLevel.DEBUG,
            { str1 = location },
            { "Start listening for satellite carrier text. Location=${str1 ?: "(unknown)"}" }
        )
    }

    fun logStopListeningForSatelliteCarrierText(reason: String) {
        buffer.log(
            TAG,
            LogLevel.DEBUG,
            {
                str1 = location
                str2 = reason
            },
            {
                "Stop listening for satellite carrier text. " +
                    "Location=${str1 ?: "(unknown)"} Reason=$str2"
            }
        )
    }
+1 −1
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ public class LogModule {
    @SysUISingleton
    @CarrierTextManagerLog
    public static LogBuffer provideCarrierTextManagerLog(LogBufferFactory factory) {
        return factory.create("CarrierTextManagerLog", 100);
        return factory.create("CarrierTextManagerLog", 400);
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -17,9 +17,12 @@
package com.android.systemui.shade

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogBufferFactory
import com.android.systemui.plugins.qs.QSContainerController
import com.android.systemui.qs.ui.adapter.QSSceneAdapterImpl
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.carrier.ShadeCarrierGroupControllerLog
import com.android.systemui.shade.data.repository.PrivacyChipRepository
import com.android.systemui.shade.data.repository.PrivacyChipRepositoryImpl
import com.android.systemui.shade.data.repository.ShadeRepository
@@ -143,6 +146,13 @@ abstract class ShadeModule {
        fun providesQSContainerController(impl: QSSceneAdapterImpl): QSContainerController {
            return impl
        }

        @Provides
        @SysUISingleton
        @ShadeCarrierGroupControllerLog
        fun provideShadeCarrierLog(factory: LogBufferFactory): LogBuffer {
            return factory.create("ShadeCarrierGroupControllerLog", 400)
        }
    }

    @Binds
+14 −1
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ public class ShadeCarrierGroupController {

    private final SlotIndexResolver mSlotIndexResolver;

    private final ShadeCarrierGroupControllerLogger mLogger;

    private final SignalCallback mSignalCallback = new SignalCallback() {
                @Override
                public void setMobileDataIndicators(@NonNull MobileDataIndicators indicators) {
@@ -148,6 +150,7 @@ public class ShadeCarrierGroupController {
            ActivityStarter activityStarter,
            @Background Handler bgHandler,
            @Main Looper mainLooper,
            ShadeCarrierGroupControllerLogger logger,
            NetworkController networkController,
            CarrierTextManager.Builder carrierTextManagerBuilder,
            Context context,
@@ -160,6 +163,7 @@ public class ShadeCarrierGroupController {
        mContext = context;
        mActivityStarter = activityStarter;
        mBgHandler = bgHandler;
        mLogger = logger;
        mNetworkController = networkController;
        mStatusBarPipelineFlags = statusBarPipelineFlags;
        mCarrierTextManager = carrierTextManagerBuilder
@@ -374,10 +378,13 @@ public class ShadeCarrierGroupController {
            return;
        }

        mLogger.logHandleUpdateCarrierInfo(info);

        mNoSimTextView.setVisibility(View.GONE);
        if (!info.airplaneMode && info.anySimReady) {
            boolean[] slotSeen = new boolean[SIM_SLOTS];
            if (info.listOfCarriers.length == info.subscriptionIds.length) {
                mLogger.logUsingSimViews();
                for (int i = 0; i < SIM_SLOTS && i < info.listOfCarriers.length; i++) {
                    int slot = getSlotIndex(info.subscriptionIds[i]);
                    if (slot >= SIM_SLOTS) {
@@ -405,9 +412,11 @@ public class ShadeCarrierGroupController {
                    }
                }
            } else {
                Log.e(TAG, "Carrier information arrays not of same length");
                mLogger.logInvalidArrayLengths(
                        info.listOfCarriers.length, info.subscriptionIds.length);
            }
        } else {
            mLogger.logUsingNoSimView(info.carrierText);
            // No sims or airplane mode (but not WFC). Do not show ShadeCarrierGroup,
            // instead just show info.carrierText in a different view.
            for (int i = 0; i < SIM_SLOTS; i++) {
@@ -458,6 +467,7 @@ public class ShadeCarrierGroupController {
        private final ActivityStarter mActivityStarter;
        private final Handler mHandler;
        private final Looper mLooper;
        private final ShadeCarrierGroupControllerLogger mLogger;
        private final NetworkController mNetworkController;
        private final CarrierTextManager.Builder mCarrierTextControllerBuilder;
        private final Context mContext;
@@ -472,6 +482,7 @@ public class ShadeCarrierGroupController {
                ActivityStarter activityStarter,
                @Background Handler handler,
                @Main Looper looper,
                ShadeCarrierGroupControllerLogger logger,
                NetworkController networkController,
                CarrierTextManager.Builder carrierTextControllerBuilder,
                Context context,
@@ -484,6 +495,7 @@ public class ShadeCarrierGroupController {
            mActivityStarter = activityStarter;
            mHandler = handler;
            mLooper = looper;
            mLogger = logger;
            mNetworkController = networkController;
            mCarrierTextControllerBuilder = carrierTextControllerBuilder;
            mContext = context;
@@ -505,6 +517,7 @@ public class ShadeCarrierGroupController {
                    mActivityStarter,
                    mHandler,
                    mLooper,
                    mLogger,
                    mNetworkController,
                    mCarrierTextControllerBuilder,
                    mContext,
Loading