Do not show toggle for location tz detection in search. am: 6be940f396

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14293706

Change-Id: Iece2512d68ee9c4a8b2e8c1d0d2d90c109c24aac
This commit is contained in:
Almaz Mingaleev
2021-04-23 11:53:54 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 0 deletions

View File

@@ -109,6 +109,14 @@ public class LocationTimeZoneDetectionPreferenceController
mTimeManager.removeTimeZoneDetectorListener(this); mTimeManager.removeTimeZoneDetectorListener(this);
} }
@Override
public boolean isSliceable() {
// Prevent use in a slice, which would enable search to display a toggle in the search
// results: LocationToggleDisabledDialogFragment has to be shown under some circumstances
// which doesn't work when embedded in search. b/185906072
return false;
}
@Override @Override
public int getAvailabilityStatus() { public int getAvailabilityStatus() {
TimeZoneCapabilities timeZoneCapabilities = TimeZoneCapabilities timeZoneCapabilities =

View File

@@ -86,6 +86,11 @@ public class LocationTimeZoneDetectionPreferenceControllerTest {
verify(mTimeManager).updateTimeZoneConfiguration(expectedConfiguration); verify(mTimeManager).updateTimeZoneConfiguration(expectedConfiguration);
} }
@Test
public void isNotSliceable() {
assertThat(mController.isSliceable()).isFalse();
}
@Test @Test
public void setChecked_withTrue_shouldDoNothing_whenLocationIsDisabled() { public void setChecked_withTrue_shouldDoNothing_whenLocationIsDisabled() {
when(mLocationManager.isLocationEnabled()).thenReturn(false); when(mLocationManager.isLocationEnabled()).thenReturn(false);