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

Commit 1bd1d7ff authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7592414 from 4a4eae4f to sc-v2-release

Change-Id: I0fe65605a2e5dffb0439ba1adc620fad425fb2c9
parents 50113c94 4a4eae4f
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -2315,7 +2315,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * Loads the allowed network type from subscription database.
     */
    public void loadAllowedNetworksFromSubscriptionDatabase() {
        mIsAllowedNetworkTypesLoadedFromDb = false;
        // Try to load ALLOWED_NETWORK_TYPES from SIMINFO.
        if (SubscriptionController.getInstance() == null) {
            return;
@@ -2324,6 +2323,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        String result = SubscriptionController.getInstance().getSubscriptionProperty(
                getSubId(),
                SubscriptionManager.ALLOWED_NETWORK_TYPES);
        // After fw load network type from DB, do unlock if subId is valid.
        mIsAllowedNetworkTypesLoadedFromDb = SubscriptionManager.isValidSubscriptionId(getSubId());
        if (result == null) {
            return;
        }
@@ -2355,7 +2356,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                    }
                }
            }
            mIsAllowedNetworkTypesLoadedFromDb = true;
        } catch (NumberFormatException e) {
            Rlog.e(LOG_TAG, "allowedNetworkTypes NumberFormat exception" + e);
        }
@@ -2426,12 +2426,18 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        int subId = getSubId();
        if (!TelephonyManager.isValidAllowedNetworkTypesReason(reason)) {
            loge("setAllowedNetworkTypes: Invalid allowed network type reason: " + reason);
            AsyncResult.forMessage(response, null,
                    new CommandException(CommandException.Error.INVALID_ARGUMENTS));
            response.sendToTarget();
            return;
        }
        if (!SubscriptionManager.isUsableSubscriptionId(subId)
                || !mIsAllowedNetworkTypesLoadedFromDb) {
            loge("setAllowedNetworkTypes: no sim or network type is not loaded. SubscriptionId: "
                    + subId + ", isNetworkTypeLoaded" + mIsAllowedNetworkTypesLoadedFromDb);
            AsyncResult.forMessage(response, null,
                    new CommandException(CommandException.Error.MISSING_RESOURCE));
            response.sendToTarget();
            return;
        }
        String mapAsString = "";
@@ -5037,4 +5043,16 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    private static String pii(String s) {
        return Rlog.pii(LOG_TAG, s);
    }

    /**
     * Used in unit tests to set whether the AllowedNetworkTypes is loaded from Db.  Should not
     * be used otherwise.
     *
     * @return {@code true} if the AllowedNetworkTypes is loaded from Db,
     * {@code false} otherwise.
     */
    @VisibleForTesting
    public boolean isAllowedNetworkTypesLoadedFromDb() {
        return mIsAllowedNetworkTypesLoadedFromDb;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -457,10 +457,10 @@ public class SubscriptionInfoUpdater extends Handler {
            // At this phase, the subscription list is accessible. Treating NOT_READY
            // as equivalent to ABSENT, once the rest of the system can handle it.
            sIccId[phoneId] = ICCID_STRING_FOR_NO_SIM;
            updateSubscriptionInfoByIccId(phoneId, false /* updateEmbeddedSubs */);
        } else {
            sIccId[phoneId] = null;
        }
        updateSubscriptionInfoByIccId(phoneId, false /* updateEmbeddedSubs */);

        broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_NOT_READY,
                null);
+19 −6
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.telephony.DataFailCause;
import android.telephony.data.ApnSetting;
import android.telephony.data.DataCallResponse;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.DctConstants;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.dataconnection.DataConnection.UpdateLinkPropertyResult;
@@ -89,8 +90,8 @@ public class DcController extends Handler {
    /**
     * Aggregated physical link state from all data connections. This reflects the device's RRC
     * connection state.
     * // TODO: Instead of tracking the RRC state here, we should make PhysicalChannelConfig work in
     *          S.
     * If {@link CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL} is true,
     * then This reflects "internet data connection" instead of RRC state.
     */
    private @PhysicalLinkState int mPhysicalLinkState = PHYSICAL_LINK_UNKNOWN;

@@ -229,6 +230,7 @@ public class DcController extends Handler {

        boolean isAnyDataCallDormant = false;
        boolean isAnyDataCallActive = false;
        boolean isInternetDataCallActive = false;

        for (DataCallResponse newState : dcsList) {

@@ -249,6 +251,11 @@ public class DcController extends Handler {
                    log("onDataStateChanged: Found ConnId=" + newState.getId()
                            + " newState=" + newState.toString());
                }
                if (apnContexts.stream().anyMatch(
                        i -> ApnSetting.TYPE_DEFAULT_STRING.equals(i.getApnType()))
                        && newState.getLinkStatus() == DataConnActiveStatus.ACTIVE) {
                    isInternetDataCallActive = true;
                }
                if (newState.getLinkStatus() == DataConnActiveStatus.INACTIVE) {
                    if (mDct.isCleanupRequired.get()) {
                        apnsToCleanup.addAll(apnContexts);
@@ -360,7 +367,11 @@ public class DcController extends Handler {

        if (mDataServiceManager.getTransportType()
                == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
            int physicalLinkState = isAnyDataCallActive
            boolean isPhysicalLinkStateFocusingOnInternetData =
                    mDct.getLteEndcUsingUserDataForIdleDetection();
            int physicalLinkState =
                    (isPhysicalLinkStateFocusingOnInternetData
                            ? isInternetDataCallActive : isAnyDataCallActive)
                            ? PHYSICAL_LINK_ACTIVE : PHYSICAL_LINK_NOT_ACTIVE;
            if (mPhysicalLinkState != physicalLinkState) {
                mPhysicalLinkState = physicalLinkState;
@@ -409,11 +420,13 @@ public class DcController extends Handler {

    /**
     * Register for physical link state (i.e. RRC state) changed event.
     *
     * if {@link CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL} is true,
     * then physical link state is focusing on "internet data connection" instead of RRC state.
     * @param h The handler
     * @param what The event
     */
    void registerForPhysicalLinkStateChanged(Handler h, int what) {
    @VisibleForTesting
    public void registerForPhysicalLinkStateChanged(Handler h, int what) {
        mPhysicalLinkStateChangedRegistrants.addUnique(h, what, null);
    }

+11 −0
Original line number Diff line number Diff line
@@ -352,6 +352,9 @@ public class DcTracker extends Handler {
    private boolean mNrSaSub6Unmetered = false;
    private boolean mNrNsaRoamingUnmetered = false;

    // it effect the PhysicalLinkStateChanged
    private boolean mLteEndcUsingUserDataForRrcDetection = false;

    // stats per data call recovery event
    private DataStallRecoveryStats mDataStallRecoveryStats;

@@ -5597,13 +5600,21 @@ public class DcTracker extends Handler {
                        CarrierConfigManager.KEY_UNMETERED_NR_SA_SUB6_BOOL);
                mNrNsaRoamingUnmetered = b.getBoolean(
                        CarrierConfigManager.KEY_UNMETERED_NR_NSA_WHEN_ROAMING_BOOL);
                mLteEndcUsingUserDataForRrcDetection = b.getBoolean(
                        CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL);
            }
        }
        updateLinkBandwidths(bandwidths, useLte);
    }

    public boolean getLteEndcUsingUserDataForIdleDetection() {
        return mLteEndcUsingUserDataForRrcDetection;
    }

    /**
     * Register for physical link state (i.e. RRC state) changed event.
     * if {@link CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL} is true,
     * then physical link state is focusing on "internet data connection" instead of RRC state.
     *
     * @param h The handler
     * @param what The event
+29 −0
Original line number Diff line number Diff line
@@ -1622,4 +1622,33 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        assertEquals(LinkCapacityEstimate.INVALID, lce3.getUplinkCapacityKbps());
        assertEquals(LinkCapacityEstimate.LCE_TYPE_COMBINED, lce3.getType());
    }

    @Test
    @SmallTest
    public void testLoadAllowedNetworksFromSubscriptionDatabase_loadTheNullValue_isLoadedTrue() {
        int subId = 1;
        doReturn(subId).when(mSubscriptionController).getSubIdUsingPhoneId(anyInt());

        doReturn(null).when(mSubscriptionController).getSubscriptionProperty(anyInt(),
                eq(SubscriptionManager.ALLOWED_NETWORK_TYPES));

        mPhoneUT.loadAllowedNetworksFromSubscriptionDatabase();

        assertEquals(true,  mPhoneUT.isAllowedNetworkTypesLoadedFromDb());
    }

    @Test
    @SmallTest
    public void testLoadAllowedNetworksFromSubscriptionDatabase_subIdNotValid_isLoadedFalse() {
        int subId = -1;
        doReturn(subId).when(mSubscriptionController).getSubIdUsingPhoneId(anyInt());

        when(mSubscriptionController.getSubscriptionProperty(anyInt(),
                eq(SubscriptionManager.ALLOWED_NETWORK_TYPES))).thenReturn(null);


        mPhoneUT.loadAllowedNetworksFromSubscriptionDatabase();

        assertEquals(false, mPhoneUT.isAllowedNetworkTypesLoadedFromDb());
    }
}
Loading