Loading packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateLegacy.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateLegacyTest.java +34 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateLegacy.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading
packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegateLegacyTest.java +34 −0 Original line number Diff line number Diff line Loading @@ -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); Loading