Make WifiTether listen to datasaver
Wifi Tethering is already turned off when appropriate. However if you re-enable it you still can't toggle the tether switchbar. This CL makes it so that if you disable data saver the toggle becomes enabled again. Test: robotests Bug: 77860936 Change-Id: I03fa74c21674678a90cde7bd20fa68167f02ae3c
This commit is contained in:
committed by
Andrew Sapperstein
parent
8a3bcaa3e3
commit
7ba65c39ae
@@ -88,4 +88,20 @@ public class WifiTetherSwitchBarControllerTest {
|
||||
assertThat(mSwitchBar.isChecked()).isFalse();
|
||||
assertThat(mSwitchBar.isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnDataSaverChanged_setsEnabledCorrectly() {
|
||||
assertThat(mSwitchBar.isEnabled()).isTrue();
|
||||
|
||||
// try to turn data saver on
|
||||
when(mNetworkPolicyManager.getRestrictBackground()).thenReturn(true);
|
||||
mController.onDataSaverChanged(true);
|
||||
assertThat(mSwitchBar.isEnabled()).isFalse();
|
||||
|
||||
// lets turn data saver off again
|
||||
when(mNetworkPolicyManager.getRestrictBackground()).thenReturn(false);
|
||||
mController.onDataSaverChanged(false);
|
||||
assertThat(mSwitchBar.isEnabled()).isTrue();
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user