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

Commit 2de4e218 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Check WWAN is in service before exiting hysteresis timeout.

Bug: 338116155
Test: b/338116155#comment13
Change-Id: I8ce9b982380fcdb5202a6b8ad0ee86a34cec230e
parent 86c47b74
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Telephony;
import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.DropBoxManagerLoggerBackend;
import android.telephony.NetworkRegistrationInfo;
@@ -133,7 +134,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -2882,7 +2882,7 @@ public class SatelliteController extends Handler {
            return true;
        }

        if (serviceState.getState() == ServiceState.STATE_IN_SERVICE) {
        if (getWwanIsInService(serviceState)) {
            // Device is connected to terrestrial network which has coverage
            resetCarrierRoamingSatelliteModeParams(subId);
            return false;
@@ -4349,7 +4349,7 @@ public class SatelliteController extends Handler {
                    }
                } else {
                    Boolean connected = mWasSatelliteConnectedViaCarrier.get(subId);
                    if (serviceState.getState() == ServiceState.STATE_IN_SERVICE) {
                    if (getWwanIsInService(serviceState)) {
                        resetCarrierRoamingSatelliteModeParams(subId);
                    } else if (connected != null && connected) {
                        // The device just got disconnected from a satellite network
@@ -4858,6 +4858,25 @@ public class SatelliteController extends Handler {
        return mDemoPointingNotAlignedDurationMillis;
    }

    private boolean getWwanIsInService(ServiceState serviceState) {
        List<NetworkRegistrationInfo> nriList = serviceState
                .getNetworkRegistrationInfoListForTransportType(
                        AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        for (NetworkRegistrationInfo nri : nriList) {
            if (nri.isInService()) {
                logv("getWwanIsInService: return true");
                return true;
            }
        }

        logv("getWwanIsInService: return false");
        return false;
    }

    private static void logv(@NonNull String log) {
        Rlog.v(TAG, log);
    }

    private static void logd(@NonNull String log) {
        Rlog.d(TAG, log);
    }