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

Commit deff49b9 authored by SongFerng Wang's avatar SongFerng Wang
Browse files

Fix the logic error

This error causes the mMobileNetworkLayout's background value is reset

Bug: 379003779
Change-Id: Ida6f635647d5f1151580c6635604118315ce307d
Test: Verify the UI and pass the atest InternetDialogDelegateTest
Flag: EXEMPT bugfix
parent 00b503d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -514,7 +514,7 @@ public class InternetDialogDelegateLegacy implements
    }

    private void setMobileDataLayout(InternetContent internetContent) {
        if (!internetContent.mShouldUpdateMobileNetwork && mDialog == null) {
        if (!internetContent.mShouldUpdateMobileNetwork || mDialog == null) {
            return;
        }
        setMobileDataLayout(mDialog, internetContent);
+34 −0
Original line number Diff line number Diff line
@@ -832,6 +832,40 @@ public class InternetDialogDelegateLegacyTest extends SysuiTestCase {
                });
    }

    @Test
    public void updateDialog_shouldUpdateMobileNetworkTrue_updateMobileDataLayout() {
        when(mInternetDetailsContentController.isCarrierNetworkActive()).thenReturn(false);
        when(mInternetDetailsContentController.isAirplaneModeEnabled()).thenReturn(false);
        when(mInternetDetailsContentController.hasActiveSubIdOnDds()).thenReturn(true);
        when(mInternetDetailsContentController.activeNetworkIsCellular()).thenReturn(false);
        mMobileDataLayout.setVisibility(View.GONE);

        mInternetDialogDelegateLegacy.updateDialog(true);
        mBgExecutor.runAllReady();

        mInternetDialogDelegateLegacy.mDataInternetContent.observe(
                mInternetDialogDelegateLegacy.mLifecycleOwner, i -> {
                    assertThat(mMobileDataLayout.getVisibility()).isEqualTo(View.VISIBLE);
                });
    }

    @Test
    public void updateDialog_shouldUpdateMobileNetworkFalse_doNotUpdateMobileDataLayout() {
        when(mInternetDetailsContentController.isCarrierNetworkActive()).thenReturn(false);
        when(mInternetDetailsContentController.isAirplaneModeEnabled()).thenReturn(false);
        when(mInternetDetailsContentController.hasActiveSubIdOnDds()).thenReturn(true);
        when(mInternetDetailsContentController.activeNetworkIsCellular()).thenReturn(false);
        mMobileDataLayout.setVisibility(View.GONE);

        mInternetDialogDelegateLegacy.updateDialog(false);
        mBgExecutor.runAllReady();

        mInternetDialogDelegateLegacy.mDataInternetContent.observe(
                mInternetDialogDelegateLegacy.mLifecycleOwner, i -> {
                    assertThat(mMobileDataLayout.getVisibility()).isEqualTo(View.GONE);
                });
    }

    private void setNetworkVisible(boolean ethernetVisible, boolean mobileDataVisible,
            boolean connectedWifiVisible) {
        mEthernet.setVisibility(ethernetVisible ? View.VISIBLE : View.GONE);