Automatic timezone support on non-telephony devices
Adding to the Settings UI in order to simplify timezone on non-telephony devices. Test: on-device testing, additional unit tests Change-Id: I58ece9542a7b80823092bd082d4bd8c224b29634 Bug: 253015306
This commit is contained in:
@@ -29,8 +29,10 @@ import android.content.Context;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
@@ -99,6 +101,25 @@ public class AutoTimeZonePreferenceController extends AbstractPreferenceControll
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
// If auto time zone cannot enable telephony fallback and is capable of location, then auto
|
||||
// time zone must use location.
|
||||
if (LocationProviderStatusPreferenceController.hasLocationTimeZoneNoTelephonyFallback(
|
||||
mTimeManager.getTimeZoneCapabilitiesAndConfig().getDetectorStatus())) {
|
||||
return mContext.getResources().getString(R.string.auto_zone_requires_location_summary);
|
||||
}
|
||||
// If the user has a dedicated toggle to control location use, the summary can
|
||||
// be empty because the use of location is explicit.
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
refreshSummary(screen.findPreference(getPreferenceKey()));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean isEnabled() {
|
||||
TimeZoneConfiguration config = getTimeZoneCapabilitiesAndConfig().getConfiguration();
|
||||
|
Reference in New Issue
Block a user