Fix the availability of UseOpenWifiPreferenceController.

Right now, it crashes if mEnableUseWifiComponentName is disabled by the
open wifi app.

Bug: 150773571
Test: manual - along with ag/10741759, verified that disabling
mEnableUseWifiComponentName hides the toggle instead of causing crash.
Test: make RunSettingsRoboTests ROBOTEST_FILTER=UseOpenWifiPreferenceControllerTest

Change-Id: I47e36fab411e4e4d1a23b7c91504139f124222e1
This commit is contained in:
Varun Anand
2020-03-17 15:53:15 -07:00
parent 6c9cad2caf
commit 310ddbb79f
2 changed files with 17 additions and 1 deletions

View File

@@ -100,6 +100,10 @@ public class UseOpenWifiPreferenceController extends TogglePreferenceController
@Override
public int getAvailabilityStatus() {
// It is possible that mEnableUseWifiComponentName is no longer enabled by
// USE_OPEN_WIFI_PACKAGE. So update this component to reflect correct availability.
updateEnableUseWifiComponentName();
checkForFeatureSupportedScorers();
return mDoFeatureSupportedScorersExist ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}