Loading src/java/com/android/internal/telephony/DefaultPhoneNotifier.java +8 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading src/java/com/android/internal/telephony/PhoneNotifier.java +5 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } src/java/com/android/internal/telephony/ServiceStateTracker.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; } /** Loading tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading @@ -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 { Loading Loading @@ -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(); } Loading Loading @@ -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)); } } tests/telephonytests/src/com/android/internal/telephony/PhysicalChannelConfigTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading Loading
src/java/com/android/internal/telephony/DefaultPhoneNotifier.java +8 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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. Loading
src/java/com/android/internal/telephony/PhoneNotifier.java +5 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); }
src/java/com/android/internal/telephony/ServiceStateTracker.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; } /** Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading @@ -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 { Loading Loading @@ -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(); } Loading Loading @@ -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)); } }
tests/telephonytests/src/com/android/internal/telephony/PhysicalChannelConfigTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading