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

Commit 0f8d5fa0 authored by Zoey Chen's avatar Zoey Chen Committed by Android (Google) Code Review
Browse files

Merge "[5G] Plumb PhysicalChannelConfig all the way up."

parents 07f386d3 4240a111
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
@@ -235,6 +236,13 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
                barringInfo);
    }

    @Override
    public void notifyPhysicalChannelConfiguration(Phone sender,
                                                   List<PhysicalChannelConfig> configs) {
        int subId = sender.getSubId();
        mTelephonyRegistryMgr.notifyPhysicalChannelConfigurationForSubscriber(subId, configs);
    }

    /**
     * Convert the {@link DataActivityState} enum into the TelephonyManager.DATA_* constants for the
     * public API.
+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
@@ -116,4 +117,8 @@ public interface PhoneNotifier {

    /** Notify barring info has changed */
    void notifyBarringInfoChanged(Phone sender, @NonNull BarringInfo barringInfo);

    /** Notify of change to PhysicalChannelConfiguration. */
    void notifyPhysicalChannelConfiguration(Phone sender, List<PhysicalChannelConfig> configs);

}
+1 −1
Original line number Diff line number Diff line
@@ -2104,7 +2104,7 @@ public class ServiceStateTracker extends Handler {
    }

    private boolean isNrPhysicalChannelConfig(PhysicalChannelConfig config) {
        return config.getRat() == TelephonyManager.NETWORK_TYPE_NR;
        return config.getNetworkType() == TelephonyManager.NETWORK_TYPE_NR;
    }

    /**
+32 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify;

import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.emergency.EmergencyNumber;
@@ -35,6 +36,8 @@ import org.junit.runner.RunWith;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@@ -44,6 +47,8 @@ public class PhoneStateListenerTest extends TelephonyTest {
    private boolean mUserMobileDataState = false;
    private EmergencyNumber mCalledEmergencyNumber;
    private EmergencyNumber mTextedEmergencyNumber;
    private List<PhysicalChannelConfig> mPhysicalChannelConfigs;


    @Before
    public void setUp() throws Exception {
@@ -72,6 +77,12 @@ public class PhoneStateListenerTest extends TelephonyTest {
                logd("OutgoingSmsEmergencyNumber Changed");
                mTextedEmergencyNumber = emergencyNumber;
            }

            @Override
            public void onPhysicalChannelConfigurationChanged(List<PhysicalChannelConfig> configs) {
                logd("PhysicalChannelConfig Changed");
                mPhysicalChannelConfigs = configs;
            }
        };
        processAllMessages();
    }
@@ -155,4 +166,25 @@ public class PhoneStateListenerTest extends TelephonyTest {

        assertTrue(mTextedEmergencyNumber.equals(emergencyNumber));
    }

    @Test @SmallTest
    public void testTriggerPhysicalChannelConfigurationChanged() throws Exception {
        Field field = PhoneStateListener.class.getDeclaredField("callback");
        field.setAccessible(true);

        assertNull(mPhysicalChannelConfigs);

        PhysicalChannelConfig config = new PhysicalChannelConfig.Builder()
                .setCellConnectionStatus(PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING)
                .setCellBandwidthDownlinkKhz(20000 /* bandwidth */)
                .build();

        List<PhysicalChannelConfig> configs = Collections.singletonList(config);

        ((IPhoneStateListener) field.get(mPhoneStateListenerUT))
                .onPhysicalChannelConfigurationChanged(configs);
        processAllMessages();

        assertTrue(mPhysicalChannelConfigs.equals(configs));
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public class PhysicalChannelConfigTest {
                .setPhysicalCellId(PHYSICAL_CELL_ID)
                .build();

        assertThat(config.getRat()).isEqualTo(RAT);
        assertThat(config.getNetworkType()).isEqualTo(RAT);
        assertThat(config.getConnectionStatus()).isEqualTo(CONNECTION_STATUS);
        assertThat(config.getCellBandwidthDownlink()).isEqualTo(CELL_BANDWIDTH);
        assertThat(config.getFrequencyRange()).isEqualTo(FREQUENCY_RANGE);