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:
@@ -54,10 +54,29 @@ public abstract class DeveloperOptionsPreferenceController extends
|
||||
/**
|
||||
* Called when developer options is enabled
|
||||
*/
|
||||
public abstract void onDeveloperOptionsEnabled();
|
||||
public void onDeveloperOptionsEnabled() {
|
||||
if (isAvailable()) {
|
||||
onDeveloperOptionsSwitchEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when developer options is disabled
|
||||
*/
|
||||
public abstract void onDeveloperOptionsDisabled();
|
||||
public void onDeveloperOptionsDisabled() {
|
||||
if (isAvailable()) {
|
||||
onDeveloperOptionsSwitchDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when developer options is enabled and the preference is available
|
||||
*/
|
||||
protected abstract void onDeveloperOptionsSwitchEnabled();
|
||||
|
||||
/**
|
||||
* Called when developer options is disabled and the preference is available
|
||||
*/
|
||||
protected abstract void onDeveloperOptionsSwitchDisabled();
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user