Merge "Refine WifiWakeupPreferenceController"

This commit is contained in:
TreeHugger Robot
2022-09-06 07:42:03 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 4 deletions

View File

@@ -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;