Make metered wifi controller resilient to null config

Apparently the wifi config can sometimes come back as null
initially when the device auto-connects to a network. This CL simply
makes the controller resilient to that so that it doesn't crash the
app.

Test: robotests
Bug: 73076869
Change-Id: I99098f35df9cd902f5f244a872cce9b71c17c224
This commit is contained in:
Salvador Martinez
2018-03-29 15:39:55 -07:00
parent 49d0205749
commit 0ba2b2bd83
2 changed files with 16 additions and 3 deletions

View File

@@ -83,4 +83,12 @@ public class WifiMeteredPreferenceControllerTest {
assertThat(mDropDownPreference.getEntry()).isEqualTo("Detect automatically");
}
@Test
public void testController_resilientToNullConfig() {
mPreferenceController = spy(new WifiMeteredPreferenceController(mContext, null));
mPreferenceController.getMeteredOverride();
mPreferenceController.onPreferenceChange(mDropDownPreference, new Integer(1));
}
}