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

Commit ece177a9 authored by Xin Li's avatar Xin Li
Browse files

Merge UP1A.230905.019

Merged-In: Id4909881f9f6ac509c60889557652632f00a8523
Change-Id: I0f81684f5b39a40bf34792b22bcaf34c58423ba5
parents c064b51a 52d0b067
Loading
Loading
Loading
Loading
+6 −49
Original line number Diff line number Diff line
@@ -180,7 +180,6 @@ public class ServiceStateTracker extends Handler {
    private long mLastCellInfoReqTime;
    private List<CellInfo> mLastCellInfoList = null;
    private List<PhysicalChannelConfig> mLastPhysicalChannelConfigList = null;
    private int mLastAnchorNrCellId = PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN;

    private final Set<Integer> mRadioPowerOffReasons = new HashSet();

@@ -1661,18 +1660,6 @@ public class ServiceStateTracker extends Handler {
                        log("EVENT_PHYSICAL_CHANNEL_CONFIG: list=" + list
                                + (list == null ? "" : ", list.size()=" + list.size()));
                    }
                    if ((list == null || list.isEmpty())
                            && mLastAnchorNrCellId != PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN
                            && mPhone.getContext().getSystemService(TelephonyManager.class)
                                    .isRadioInterfaceCapabilitySupported(TelephonyManager
                                            .CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED)
                            && !mCarrierConfig.getBoolean(CarrierConfigManager
                                    .KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL)
                            && mCarrierConfig.getBoolean(CarrierConfigManager
                                    .KEY_RATCHET_NR_ADVANCED_BANDWIDTH_IF_RRC_IDLE_BOOL)) {
                        log("Ignore empty PCC list when RRC idle.");
                        break;
                    }
                    mLastPhysicalChannelConfigList = list;
                    boolean hasChanged = false;
                    if (updateNrStateFromPhysicalChannelConfigs(list, mSS)) {
@@ -1683,34 +1670,8 @@ public class ServiceStateTracker extends Handler {
                        mNrFrequencyChangedRegistrants.notifyRegistrants();
                        hasChanged = true;
                    }
                    int anchorNrCellId = PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN;
                    if (list != null) {
                        anchorNrCellId = list
                                .stream()
                                .filter(config -> config.getNetworkType()
                                        == TelephonyManager.NETWORK_TYPE_NR
                                        && config.getConnectionStatus()
                                        == PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING)
                                .map(PhysicalChannelConfig::getPhysicalCellId)
                                .findFirst()
                                .orElse(PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN);
                    }
                    int[] bandwidths = new int[0];
                    if (list != null) {
                        bandwidths = getBandwidthsFromLastPhysicalChannelConfigs();
                    }
                    if (anchorNrCellId == mLastAnchorNrCellId
                            && anchorNrCellId != PhysicalChannelConfig.PHYSICAL_CELL_ID_UNKNOWN) {
                        log("Ratchet bandwidths since anchor NR cell is the same.");
                        hasChanged |= RatRatcheter.updateBandwidths(bandwidths, mSS);
                    } else {
                        log("Do not ratchet bandwidths since anchor NR cell is different ("
                                + mLastAnchorNrCellId + " -> " + anchorNrCellId
                                + "). New bandwidths are " + Arrays.toString(bandwidths));
                        mLastAnchorNrCellId = anchorNrCellId;
                        hasChanged |= !Arrays.equals(mSS.getCellBandwidths(), bandwidths);
                        mSS.setCellBandwidths(bandwidths);
                    }
                    hasChanged |= RatRatcheter
                            .updateBandwidths(getBandwidthsFromConfigs(list), mSS);

                    mPhone.notifyPhysicalChannelConfig(list);
                    // Notify NR frequency, NR connection status or bandwidths changed.
@@ -1790,12 +1751,8 @@ public class ServiceStateTracker extends Handler {
        return simAbsent;
    }

    private int[] getBandwidthsFromLastPhysicalChannelConfigs() {
        boolean includeLte = mCarrierConfig.getBoolean(
                CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL);
        return mLastPhysicalChannelConfigList.stream()
                .filter(config -> includeLte
                        || config.getNetworkType() == TelephonyManager.NETWORK_TYPE_NR)
    private static int[] getBandwidthsFromConfigs(List<PhysicalChannelConfig> list) {
        return list.stream()
                .map(PhysicalChannelConfig::getCellBandwidthDownlinkKhz)
                .mapToInt(Integer::intValue)
                .toArray();
@@ -2555,7 +2512,7 @@ public class ServiceStateTracker extends Handler {
            // Prioritize the PhysicalChannelConfig list because we might already be in carrier
            // aggregation by the time poll state is performed.
            if (primaryPcc != null) {
                bandwidths = getBandwidthsFromLastPhysicalChannelConfigs();
                bandwidths = getBandwidthsFromConfigs(mLastPhysicalChannelConfigList);
                for (int bw : bandwidths) {
                    if (!isValidLteBandwidthKhz(bw)) {
                        loge("Invalid LTE Bandwidth in RegistrationState, " + bw);
@@ -2591,7 +2548,7 @@ public class ServiceStateTracker extends Handler {
            // Prioritize the PhysicalChannelConfig list because we might already be in carrier
            // aggregation by the time poll state is performed.
            if (primaryPcc != null) {
                bandwidths = getBandwidthsFromLastPhysicalChannelConfigs();
                bandwidths = getBandwidthsFromConfigs(mLastPhysicalChannelConfigList);
                for (int bw : bandwidths) {
                    if (!isValidNrBandwidthKhz(bw)) {
                        loge("Invalid NR Bandwidth in RegistrationState, " + bw);
+1 −1
Original line number Diff line number Diff line
@@ -1687,7 +1687,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
    }

    public void loadFdnRecords() {
        if (mParentApp != null) {
        if (mParentApp != null && mAdnCache != null) {
            log("Loading FdnRecords");
            mAdnCache.requestLoadAllAdnLike(IccConstants.EF_FDN, EF_EXT2,
                    obtainMessage(EVENT_GET_FDN_DONE));
+6 −1
Original line number Diff line number Diff line
@@ -1274,7 +1274,12 @@ public class NetworkTypeControllerTest extends TelephonyTest {
        assertEquals("DefaultState", getCurrentState().getName());
        doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
        doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange();
        doReturn(new int[] {20001}).when(mServiceState).getCellBandwidths();
        List<PhysicalChannelConfig> lastPhysicalChannelConfigList = new ArrayList<>();
        lastPhysicalChannelConfigList.add(new PhysicalChannelConfig.Builder()
                .setNetworkType(TelephonyManager.NETWORK_TYPE_NR)
                .setCellBandwidthDownlinkKhz(20001)
                .build());
        doReturn(lastPhysicalChannelConfigList).when(mSST).getPhysicalChannelConfigList();
        mBundle.putInt(CarrierConfigManager.KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT, 20000);
        sendCarrierConfigChanged();

+3 −23
Original line number Diff line number Diff line
@@ -278,15 +278,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                // UMTS < GPRS < EDGE
                new String[]{"3,1,2"});

        mBundle.putBoolean(CarrierConfigManager.KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL,
                false);

        mBundle.putBoolean(CarrierConfigManager.KEY_RATCHET_NR_ADVANCED_BANDWIDTH_IF_RRC_IDLE_BOOL,
                true);

        doReturn(true).when(mTelephonyManager).isRadioInterfaceCapabilitySupported(
                TelephonyManager.CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED);

        mSimulatedCommands.setVoiceRegState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME);
        mSimulatedCommands.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
        mSimulatedCommands.setDataRegState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME);
@@ -374,9 +365,6 @@ public class ServiceStateTrackerTest extends TelephonyTest {
                    15, /* SIGNAL_STRENGTH_GOOD */
                    30  /* SIGNAL_STRENGTH_GREAT */
                });
        mBundle.putBoolean(
                CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL,
                true);

        sendCarrierConfigUpdate(PHONE_ID);
        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
@@ -2369,21 +2357,13 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    @Test
    public void testPhyChanBandwidthForNr() {
        mBundle.putBoolean(
                CarrierConfigManager.KEY_INCLUDE_LTE_FOR_NR_ADVANCED_THRESHOLD_BANDWIDTH_BOOL,
                false);
        // NR Cell with bandwidth = 10000
        CellIdentityNr nrCi = new CellIdentityNr(
                0, 0, 0, new int[]{10000}, "", "", 5, "", "", Collections.emptyList());
                0, 0, 0, new int[] {}, "", "", 5, "", "", Collections.emptyList());

        sendRegStateUpdateForNrCellId(nrCi);
        // should ratchet for NR
        sendPhyChanConfigChange(new int[] {10000, 5000}, TelephonyManager.NETWORK_TYPE_NR, 0);
        sendRegStateUpdateForNrCellId(nrCi);
        assertArrayEquals(new int[] {10000, 5000}, sst.mSS.getCellBandwidths());

        // should not ratchet for LTE
        sendPhyChanConfigChange(new int[] {100}, TelephonyManager.NETWORK_TYPE_LTE, 0);
        assertArrayEquals(new int[]{}, sst.mSS.getCellBandwidths());
    }

    /**
+12 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {

    private static final UserHandle FAKE_USER_HANDLE = new UserHandle(12);

    private static final UserHandle FAKE_MANAGED_PROFILE_USER_HANDLE = new UserHandle(13);

    // mocked
    private SubscriptionManagerServiceCallback mMockedSubscriptionManagerServiceCallback;
    private EuiccController mEuiccController;
@@ -213,6 +215,9 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {
        setIdentifierAccess(false);
        setPhoneNumberAccess(PackageManager.PERMISSION_DENIED);

        doReturn(true).when(mUserManager)
                .isManagedProfile(eq(FAKE_MANAGED_PROFILE_USER_HANDLE.getIdentifier()));

        logd("SubscriptionManagerServiceTest -Setup!");
    }

@@ -1103,6 +1108,13 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {

        assertThat(mSubscriptionManagerServiceUT.isSubscriptionAssociatedWithUser(1,
                FAKE_USER_HANDLE)).isEqualTo(true);

        // Work profile is not associated with any subscription
        associatedSubInfoList = mSubscriptionManagerServiceUT
                .getSubscriptionInfoListAssociatedWithUser(FAKE_MANAGED_PROFILE_USER_HANDLE);
        assertThat(associatedSubInfoList.size()).isEqualTo(0);
        assertThat(mSubscriptionManagerServiceUT.isSubscriptionAssociatedWithUser(1,
                FAKE_MANAGED_PROFILE_USER_HANDLE)).isEqualTo(false);
    }

    @Test