Refine WifiWakeupPreferenceController
- Move the check for mFragment to a suitable location to avoid unnecessary checks. Bug: 235421460 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=WifiWakeupPreferenceControllerTest Change-Id: I638cc6f2399b1332ee7a7092854d1e2442cacccd
This commit is contained in:
@@ -109,11 +109,11 @@ public class WifiWakeupPreferenceController extends TogglePreferenceController i
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
if (mFragment == null) {
|
||||
throw new IllegalStateException("No fragment to start activity");
|
||||
}
|
||||
|
||||
if (!getLocationEnabled()) {
|
||||
if (mFragment == null) {
|
||||
throw new IllegalStateException("No fragment to start activity");
|
||||
}
|
||||
|
||||
final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
mFragment.startActivityForResult(intent, WIFI_WAKEUP_REQUEST_CODE);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user