Clean-up after com.android.settings.flags.revamp_toggles rollout

Flag: EXEMPT refactoring / flag clean-up
Test: refactoring CL. Existing unit tests still pass.
Bug: 296835792

Change-Id: Ib57ee270c8b5d540cb19997fe1863dd6d782cbe4
This commit is contained in:
Geoffrey Boullanger
2024-11-21 11:54:47 +00:00
parent efcb4dfddf
commit 842a337291
12 changed files with 21 additions and 439 deletions

View File

@@ -32,7 +32,6 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.core.TogglePreferenceController;
import com.android.settings.flags.Flags;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
@@ -68,7 +67,7 @@ public class LocationTimeZoneDetectionPreferenceController
// forceRefresh set to true as the location toggle may have been turned off by switching off
// automatic time zone
TimeZoneCapabilitiesAndConfig capabilitiesAndConfig =
getTimeZoneCapabilitiesAndConfig(/*forceRefresh=*/ Flags.revampToggles());
getTimeZoneCapabilitiesAndConfig(/*forceRefresh=*/ true);
TimeZoneConfiguration configuration = capabilitiesAndConfig.getConfiguration();
return configuration.isGeoDetectionEnabled();
}
@@ -137,11 +136,7 @@ public class LocationTimeZoneDetectionPreferenceController
if (capability == CAPABILITY_NOT_SUPPORTED || capability == CAPABILITY_NOT_ALLOWED) {
return UNSUPPORTED_ON_DEVICE;
} else if (capability == CAPABILITY_NOT_APPLICABLE || capability == CAPABILITY_POSSESSED) {
if (Flags.revampToggles()) {
return isAutoTimeZoneEnabled() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
} else {
return AVAILABLE;
}
return isAutoTimeZoneEnabled() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
} else {
throw new IllegalStateException("Unknown capability=" + capability);
}
@@ -151,10 +146,8 @@ public class LocationTimeZoneDetectionPreferenceController
public void updateState(Preference preference) {
super.updateState(preference);
if (Flags.revampToggles()) {
// enable / disable the toggle based on automatic time zone being enabled or not
preference.setEnabled(isAutoTimeZoneEnabled());
}
// enable / disable the toggle based on automatic time zone being enabled or not
preference.setEnabled(isAutoTimeZoneEnabled());
}
@Override