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

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

Merge "[Telephony] PhoneStateListener redesign"

parents c73206d7 4d10e8ac
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -237,10 +237,10 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    }

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

    /**
+2 −1
Original line number Diff line number Diff line
@@ -2677,8 +2677,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    }

    /** Notify {@link PhysicalChannelConfig} changes. */
    public void notifyPhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
    public void notifyPhysicalChannelConfig(List<PhysicalChannelConfig> configs) {
        mPhysicalChannelConfigRegistrants.notifyRegistrants(new AsyncResult(null, configs, null));
        mNotifier.notifyPhysicalChannelConfig(this, configs);
    }

    public List<PhysicalChannelConfig> getPhysicalChannelConfigList() {
+2 −2
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ 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);
    /** Notify of change to PhysicalChannelConfig. */
    void notifyPhysicalChannelConfig(Phone sender, List<PhysicalChannelConfig> configs);

}
+1 −1
Original line number Diff line number Diff line
@@ -1702,7 +1702,7 @@ public class ServiceStateTracker extends Handler {
                        log("EVENT_PHYSICAL_CHANNEL_CONFIG: size=" + list.size() + " list="
                                + list);
                    }
                    mPhone.notifyPhysicalChannelConfiguration(list);
                    mPhone.notifyPhysicalChannelConfig(list);
                    mLastPhysicalChannelConfigList = list;
                    boolean hasChanged = false;
                    if (updateNrStateFromPhysicalChannelConfigs(list, mSS)) {
+0 −29
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ 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 {
@@ -77,12 +75,6 @@ public class PhoneStateListenerTest extends TelephonyTest {
                logd("OutgoingSmsEmergencyNumber Changed");
                mTextedEmergencyNumber = emergencyNumber;
            }

            @Override
            public void onPhysicalChannelConfigurationChanged(List<PhysicalChannelConfig> configs) {
                logd("PhysicalChannelConfig Changed");
                mPhysicalChannelConfigs = configs;
            }
        };
        processAllMessages();
    }
@@ -166,25 +158,4 @@ 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));
    }
}
Loading