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:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user