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:
@@ -100,19 +100,6 @@ public class StayAwakePreferenceController extends DeveloperOptionsPreferenceCon
|
||||
mPreference.setChecked(stayAwakeMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeveloperOptionsEnabled() {
|
||||
mPreference.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeveloperOptionsDisabled() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, SETTING_VALUE_OFF);
|
||||
mPreference.setChecked(false);
|
||||
mPreference.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (mPreference != null) {
|
||||
@@ -127,6 +114,19 @@ public class StayAwakePreferenceController extends DeveloperOptionsPreferenceCon
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchEnabled() {
|
||||
mPreference.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, SETTING_VALUE_OFF);
|
||||
mPreference.setChecked(false);
|
||||
mPreference.setEnabled(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
RestrictedLockUtils.EnforcedAdmin checkIfMaximumTimeToLockSetByAdmin() {
|
||||
// A DeviceAdmin has specified a maximum time until the device
|
||||
|
Reference in New Issue
Block a user