Add isAvailable check to devOptionsController

- This avoids the null check for PreferenceControllers where isAvailable()
 is not always true

Bug: 34203528
Test: make RunSettingsRoboTests -j40
Change-Id: Ibed8bc6a2a812355c521620d77fb571c1fd8a649
This commit is contained in:
jeffreyhuang
2017-09-19 10:44:30 -07:00
parent ff3971038e
commit f5539a1969
4 changed files with 38 additions and 23 deletions

View File

@@ -122,12 +122,12 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
}
@Override
public void onDeveloperOptionsEnabled() {
protected void onDeveloperOptionsSwitchEnabled() {
handleDeveloperOptionsToggled();
}
@Override
public void onDeveloperOptionsDisabled() {
protected void onDeveloperOptionsSwitchDisabled() {
handleDeveloperOptionsToggled();
}
@@ -143,10 +143,6 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
}
private void handleDeveloperOptionsToggled() {
if (mPreference == null) {
return;
}
mPreference.setEnabled(enableOemUnlockPreference());
if (mPreference.isEnabled()) {
// Check restriction, disable mEnableOemUnlock and apply policy transparency.