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

Commit ab1deb93 authored by sangyun's avatar sangyun
Browse files

Adjusted the timing of getting instance of the SatelliteController.

The Instance of SatelliteController is not created at
ServiceStateStats creation time. so moved to inline function

Bug: 340684228
Test: statsd_testdrive 10090
Merged-In: Ib35cc76e44ec494e753cdff2e1b2afa4a84bb634
Change-Id: Ib35cc76e44ec494e753cdff2e1b2afa4a84bb634
parent e6312915
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -67,14 +67,12 @@ public class ServiceStateStats extends DataNetworkControllerCallback {
    private boolean mExistAnyConnectedInternetPdn;
    private int mCurrentDataRat =
            TelephonyStatsLog.DATA_RAT_STATE_CHANGED__DATA_RAT__DATA_RAT_UNSPECIFIED;
    private final SatelliteController mSatelliteController;

    public ServiceStateStats(Phone phone) {
        super(Runnable::run);
        mPhone = phone;
        mStorage = PhoneFactory.getMetricsCollector().getAtomsStorage();
        mDeviceStateHelper = PhoneFactory.getMetricsCollector().getDeviceStateHelper();
        mSatelliteController = SatelliteController.getInstance();
    }

    /** Finalizes the durations of the current service state segment. */
@@ -126,6 +124,7 @@ public class ServiceStateStats extends DataNetworkControllerCallback {
            // Finish the duration of last service state and mark modem off
            addServiceState(mLastState.getAndSet(new TimestampedServiceState(null, now)), now);
        } else {
            SatelliteController satelliteController = SatelliteController.getInstance();
            CellularServiceState newState = new CellularServiceState();
            newState.voiceRat = getVoiceRat(mPhone, serviceState);
            newState.dataRat = getRat(serviceState, NetworkRegistrationInfo.DOMAIN_PS);
@@ -143,8 +142,8 @@ public class ServiceStateStats extends DataNetworkControllerCallback {
            newState.overrideVoiceService = mOverrideVoiceService.get();
            newState.isDataEnabled = mPhone.getDataSettingsManager().isDataEnabled();
            newState.isIwlanCrossSim = isCrossSimCallingRegistered(mPhone);
            newState.isNtn = mSatelliteController != null
                    ? mSatelliteController.isInSatelliteModeForCarrierRoaming(mPhone) : false;
            newState.isNtn = satelliteController != null
                    && satelliteController.isInSatelliteModeForCarrierRoaming(mPhone);
            TimestampedServiceState prevState =
                    mLastState.getAndSet(new TimestampedServiceState(newState, now));
            addServiceStateAndSwitch(