[Settings] Data roaming warning only when turn ON

handlePreferenceTreeClick() goes after setChecked() however
configuration may have been altered within setChecked().

Follow same design within MobileDataPreferenceController to fix this
issue. A boolean state will be maintained as the condition when warning
dialog is required when click.

Bug: 148491064
Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=RoamingPreferenceControllerTest
Change-Id: I63c4e2149b0e9efa16fd9ee402652c67eb9c5a4d
This commit is contained in:
Bonian Chen
2020-02-03 21:31:24 +08:00
parent 040c548d81
commit 19135546a3
2 changed files with 5 additions and 16 deletions

View File

@@ -117,10 +117,10 @@ public class RoamingPreferenceControllerTest {
}
@Test
public void handlePreferenceTreeClick_needDialog_showDialog() {
public void setChecked_needDialog_showDialog() {
doReturn(true).when(mController).isDialogNeeded();
mController.handlePreferenceTreeClick(mPreference);
mController.setChecked(true);
verify(mFragmentManager).beginTransaction();
}