Loading tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java +14 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.settings.datetime; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING; import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.spy; Loading @@ -23,10 +28,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.time.Capabilities; import android.app.time.LocationTimeZoneAlgorithmStatus; import android.app.time.TelephonyTimeZoneAlgorithmStatus; import android.app.time.TimeManager; import android.app.time.TimeZoneCapabilities; import android.app.time.TimeZoneCapabilitiesAndConfig; import android.app.time.TimeZoneConfiguration; import android.app.time.TimeZoneDetectorStatus; import android.content.Context; import android.os.UserHandle; Loading Loading @@ -215,6 +223,11 @@ public class AutoTimeZonePreferenceControllerTest { private static TimeZoneCapabilitiesAndConfig createCapabilitiesAndConfig( boolean autoSupported, boolean autoEnabled) { TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING, new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING), new LocationTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING, PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_PRESENT, null)); int configureAutoDetectionEnabledCapability = autoSupported ? Capabilities.CAPABILITY_POSSESSED : Capabilities.CAPABILITY_NOT_SUPPORTED; Loading @@ -227,6 +240,6 @@ public class AutoTimeZonePreferenceControllerTest { .setAutoDetectionEnabled(autoEnabled) .setGeoDetectionEnabled(false) .build(); return new TimeZoneCapabilitiesAndConfig(capabilities, config); return new TimeZoneCapabilitiesAndConfig(status, capabilities, config); } } tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java +44 −28 Original line number Diff line number Diff line Loading @@ -19,6 +19,11 @@ package com.android.settings.datetime; import static android.app.time.Capabilities.CAPABILITY_NOT_APPLICABLE; import static android.app.time.Capabilities.CAPABILITY_NOT_SUPPORTED; import static android.app.time.Capabilities.CAPABILITY_POSSESSED; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING; import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY; import static com.google.common.truth.Truth.assertThat; Loading @@ -27,18 +32,20 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import android.app.time.Capabilities; import android.app.time.Capabilities.CapabilityState; import android.app.time.LocationTimeZoneAlgorithmStatus; import android.app.time.TelephonyTimeZoneAlgorithmStatus; import android.app.time.TimeManager; import android.app.time.TimeZoneCapabilities; import android.app.time.TimeZoneCapabilitiesAndConfig; import android.app.time.TimeZoneConfiguration; import android.app.time.TimeZoneDetectorStatus; import android.content.Context; import android.location.LocationManager; import android.os.UserHandle; import com.android.settings.R; import com.android.settings.core.InstrumentedPreferenceFragment; import com.android.settingslib.core.lifecycle.Lifecycle; import org.junit.Before; import org.junit.Test; Loading @@ -59,8 +66,6 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { private LocationTimeZoneDetectionPreferenceController mController; @Mock(answer = Answers.RETURNS_DEEP_STUBS) private InstrumentedPreferenceFragment mFragment; @Mock private Lifecycle mLifecycle; @Before public void setUp() { Loading Loading @@ -116,11 +121,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { @Test public void testLocationTimeZoneDetection_supported_shouldBeShown() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_POSSESSED); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_POSSESSED); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); assertThat(mController.isAvailable()).isTrue(); Loading @@ -128,11 +130,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { @Test public void testLocationTimeZoneDetection_unsupported_shouldNotBeShown() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_NOT_SUPPORTED); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_NOT_SUPPORTED); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); assertThat(mController.isAvailable()).isFalse(); Loading @@ -143,11 +142,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { */ @Test public void testLocationTimeZoneDetection_summary_geoDetectionEnabled() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_POSSESSED); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_POSSESSED); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); assertThat(mController.getSummary()).isEqualTo( Loading @@ -156,11 +152,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { @Test public void testLocationTimeZoneDetection_toggleIsOn_whenGeoDetectionEnabledAnsMlsIsOff() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_NOT_APPLICABLE); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_NOT_APPLICABLE); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); when(mLocationManager.isLocationEnabled()).thenReturn(false); Loading @@ -170,20 +163,43 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { mContext.getString(R.string.location_app_permission_summary_location_off)); } private static TimeZoneCapabilities createTimeZoneCapabilities( @Capabilities.CapabilityState int geoDetectionCapability) { private static TimeZoneCapabilitiesAndConfig createTimeZoneCapabilitiesAndConfig( @CapabilityState int configureGeoDetectionEnabledCapability) { // Create a status that matches the user's capability state. LocationTimeZoneAlgorithmStatus locationAlgorithmStatus; switch (configureGeoDetectionEnabledCapability) { case CAPABILITY_NOT_SUPPORTED: locationAlgorithmStatus = new LocationTimeZoneAlgorithmStatus( DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED, PROVIDER_STATUS_NOT_PRESENT, null, PROVIDER_STATUS_NOT_PRESENT, null); break; case CAPABILITY_NOT_APPLICABLE: case CAPABILITY_POSSESSED: locationAlgorithmStatus = new LocationTimeZoneAlgorithmStatus( DETECTION_ALGORITHM_STATUS_RUNNING, PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_READY, null); break; default: throw new AssertionError( "Unsupported capability state: " + configureGeoDetectionEnabledCapability); } TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING, new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING), locationAlgorithmStatus); UserHandle arbitraryUserHandle = UserHandle.of(123); return new TimeZoneCapabilities.Builder(arbitraryUserHandle) TimeZoneCapabilities capabilities = new TimeZoneCapabilities.Builder(arbitraryUserHandle) .setConfigureAutoDetectionEnabledCapability(CAPABILITY_POSSESSED) .setConfigureGeoDetectionEnabledCapability(geoDetectionCapability) .setConfigureGeoDetectionEnabledCapability(configureGeoDetectionEnabledCapability) .setSetManualTimeZoneCapability(CAPABILITY_NOT_APPLICABLE) .build(); } private static TimeZoneConfiguration createTimeZoneConfig(boolean geoDetectionEnabled) { return new TimeZoneConfiguration.Builder() TimeZoneConfiguration configuration = new TimeZoneConfiguration.Builder() .setAutoDetectionEnabled(true) .setGeoDetectionEnabled(geoDetectionEnabled) .setGeoDetectionEnabled(true) .build(); return new TimeZoneCapabilitiesAndConfig(status, capabilities, configuration); } } tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java +14 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.settings.datetime; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING; import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.doReturn; Loading @@ -23,10 +28,13 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import android.app.time.Capabilities; import android.app.time.LocationTimeZoneAlgorithmStatus; import android.app.time.TelephonyTimeZoneAlgorithmStatus; import android.app.time.TimeManager; import android.app.time.TimeZoneCapabilities; import android.app.time.TimeZoneCapabilitiesAndConfig; import android.app.time.TimeZoneConfiguration; import android.app.time.TimeZoneDetectorStatus; import android.content.Context; import android.os.UserHandle; Loading Loading @@ -97,6 +105,11 @@ public class TimeZonePreferenceControllerTest { private static TimeZoneCapabilitiesAndConfig createCapabilitiesAndConfig( boolean suggestManualAllowed) { TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING, new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING), new LocationTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING, PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_PRESENT, null)); int suggestManualCapability = suggestManualAllowed ? Capabilities.CAPABILITY_POSSESSED : Capabilities.CAPABILITY_NOT_SUPPORTED; TimeZoneCapabilities capabilities = new TimeZoneCapabilities.Builder(UserHandle.SYSTEM) Loading @@ -108,6 +121,6 @@ public class TimeZonePreferenceControllerTest { .setAutoDetectionEnabled(!suggestManualAllowed) .setGeoDetectionEnabled(false) .build(); return new TimeZoneCapabilitiesAndConfig(capabilities, config); return new TimeZoneCapabilitiesAndConfig(status, capabilities, config); } } Loading
tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java +14 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.settings.datetime; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING; import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.spy; Loading @@ -23,10 +28,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.time.Capabilities; import android.app.time.LocationTimeZoneAlgorithmStatus; import android.app.time.TelephonyTimeZoneAlgorithmStatus; import android.app.time.TimeManager; import android.app.time.TimeZoneCapabilities; import android.app.time.TimeZoneCapabilitiesAndConfig; import android.app.time.TimeZoneConfiguration; import android.app.time.TimeZoneDetectorStatus; import android.content.Context; import android.os.UserHandle; Loading Loading @@ -215,6 +223,11 @@ public class AutoTimeZonePreferenceControllerTest { private static TimeZoneCapabilitiesAndConfig createCapabilitiesAndConfig( boolean autoSupported, boolean autoEnabled) { TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING, new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING), new LocationTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING, PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_PRESENT, null)); int configureAutoDetectionEnabledCapability = autoSupported ? Capabilities.CAPABILITY_POSSESSED : Capabilities.CAPABILITY_NOT_SUPPORTED; Loading @@ -227,6 +240,6 @@ public class AutoTimeZonePreferenceControllerTest { .setAutoDetectionEnabled(autoEnabled) .setGeoDetectionEnabled(false) .build(); return new TimeZoneCapabilitiesAndConfig(capabilities, config); return new TimeZoneCapabilitiesAndConfig(status, capabilities, config); } }
tests/robotests/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceControllerTest.java +44 −28 Original line number Diff line number Diff line Loading @@ -19,6 +19,11 @@ package com.android.settings.datetime; import static android.app.time.Capabilities.CAPABILITY_NOT_APPLICABLE; import static android.app.time.Capabilities.CAPABILITY_NOT_SUPPORTED; import static android.app.time.Capabilities.CAPABILITY_POSSESSED; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING; import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY; import static com.google.common.truth.Truth.assertThat; Loading @@ -27,18 +32,20 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import android.app.time.Capabilities; import android.app.time.Capabilities.CapabilityState; import android.app.time.LocationTimeZoneAlgorithmStatus; import android.app.time.TelephonyTimeZoneAlgorithmStatus; import android.app.time.TimeManager; import android.app.time.TimeZoneCapabilities; import android.app.time.TimeZoneCapabilitiesAndConfig; import android.app.time.TimeZoneConfiguration; import android.app.time.TimeZoneDetectorStatus; import android.content.Context; import android.location.LocationManager; import android.os.UserHandle; import com.android.settings.R; import com.android.settings.core.InstrumentedPreferenceFragment; import com.android.settingslib.core.lifecycle.Lifecycle; import org.junit.Before; import org.junit.Test; Loading @@ -59,8 +66,6 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { private LocationTimeZoneDetectionPreferenceController mController; @Mock(answer = Answers.RETURNS_DEEP_STUBS) private InstrumentedPreferenceFragment mFragment; @Mock private Lifecycle mLifecycle; @Before public void setUp() { Loading Loading @@ -116,11 +121,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { @Test public void testLocationTimeZoneDetection_supported_shouldBeShown() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_POSSESSED); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_POSSESSED); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); assertThat(mController.isAvailable()).isTrue(); Loading @@ -128,11 +130,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { @Test public void testLocationTimeZoneDetection_unsupported_shouldNotBeShown() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_NOT_SUPPORTED); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_NOT_SUPPORTED); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); assertThat(mController.isAvailable()).isFalse(); Loading @@ -143,11 +142,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { */ @Test public void testLocationTimeZoneDetection_summary_geoDetectionEnabled() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_POSSESSED); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_POSSESSED); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); assertThat(mController.getSummary()).isEqualTo( Loading @@ -156,11 +152,8 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { @Test public void testLocationTimeZoneDetection_toggleIsOn_whenGeoDetectionEnabledAnsMlsIsOff() { TimeZoneCapabilities capabilities = createTimeZoneCapabilities(CAPABILITY_NOT_APPLICABLE); TimeZoneConfiguration configuration = createTimeZoneConfig(/* geoDetectionEnabled= */ true); TimeZoneCapabilitiesAndConfig capabilitiesAndConfig = new TimeZoneCapabilitiesAndConfig(capabilities, configuration); createTimeZoneCapabilitiesAndConfig(CAPABILITY_NOT_APPLICABLE); when(mTimeManager.getTimeZoneCapabilitiesAndConfig()).thenReturn(capabilitiesAndConfig); when(mLocationManager.isLocationEnabled()).thenReturn(false); Loading @@ -170,20 +163,43 @@ public class LocationTimeZoneDetectionPreferenceControllerTest { mContext.getString(R.string.location_app_permission_summary_location_off)); } private static TimeZoneCapabilities createTimeZoneCapabilities( @Capabilities.CapabilityState int geoDetectionCapability) { private static TimeZoneCapabilitiesAndConfig createTimeZoneCapabilitiesAndConfig( @CapabilityState int configureGeoDetectionEnabledCapability) { // Create a status that matches the user's capability state. LocationTimeZoneAlgorithmStatus locationAlgorithmStatus; switch (configureGeoDetectionEnabledCapability) { case CAPABILITY_NOT_SUPPORTED: locationAlgorithmStatus = new LocationTimeZoneAlgorithmStatus( DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED, PROVIDER_STATUS_NOT_PRESENT, null, PROVIDER_STATUS_NOT_PRESENT, null); break; case CAPABILITY_NOT_APPLICABLE: case CAPABILITY_POSSESSED: locationAlgorithmStatus = new LocationTimeZoneAlgorithmStatus( DETECTION_ALGORITHM_STATUS_RUNNING, PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_READY, null); break; default: throw new AssertionError( "Unsupported capability state: " + configureGeoDetectionEnabledCapability); } TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING, new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING), locationAlgorithmStatus); UserHandle arbitraryUserHandle = UserHandle.of(123); return new TimeZoneCapabilities.Builder(arbitraryUserHandle) TimeZoneCapabilities capabilities = new TimeZoneCapabilities.Builder(arbitraryUserHandle) .setConfigureAutoDetectionEnabledCapability(CAPABILITY_POSSESSED) .setConfigureGeoDetectionEnabledCapability(geoDetectionCapability) .setConfigureGeoDetectionEnabledCapability(configureGeoDetectionEnabledCapability) .setSetManualTimeZoneCapability(CAPABILITY_NOT_APPLICABLE) .build(); } private static TimeZoneConfiguration createTimeZoneConfig(boolean geoDetectionEnabled) { return new TimeZoneConfiguration.Builder() TimeZoneConfiguration configuration = new TimeZoneConfiguration.Builder() .setAutoDetectionEnabled(true) .setGeoDetectionEnabled(geoDetectionEnabled) .setGeoDetectionEnabled(true) .build(); return new TimeZoneCapabilitiesAndConfig(status, capabilities, configuration); } }
tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java +14 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,11 @@ package com.android.settings.datetime; import static android.app.time.DetectorStatusTypes.DETECTION_ALGORITHM_STATUS_RUNNING; import static android.app.time.DetectorStatusTypes.DETECTOR_STATUS_RUNNING; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_PRESENT; import static android.app.time.LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_NOT_READY; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.doReturn; Loading @@ -23,10 +28,13 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import android.app.time.Capabilities; import android.app.time.LocationTimeZoneAlgorithmStatus; import android.app.time.TelephonyTimeZoneAlgorithmStatus; import android.app.time.TimeManager; import android.app.time.TimeZoneCapabilities; import android.app.time.TimeZoneCapabilitiesAndConfig; import android.app.time.TimeZoneConfiguration; import android.app.time.TimeZoneDetectorStatus; import android.content.Context; import android.os.UserHandle; Loading Loading @@ -97,6 +105,11 @@ public class TimeZonePreferenceControllerTest { private static TimeZoneCapabilitiesAndConfig createCapabilitiesAndConfig( boolean suggestManualAllowed) { TimeZoneDetectorStatus status = new TimeZoneDetectorStatus(DETECTOR_STATUS_RUNNING, new TelephonyTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING), new LocationTimeZoneAlgorithmStatus(DETECTION_ALGORITHM_STATUS_RUNNING, PROVIDER_STATUS_NOT_READY, null, PROVIDER_STATUS_NOT_PRESENT, null)); int suggestManualCapability = suggestManualAllowed ? Capabilities.CAPABILITY_POSSESSED : Capabilities.CAPABILITY_NOT_SUPPORTED; TimeZoneCapabilities capabilities = new TimeZoneCapabilities.Builder(UserHandle.SYSTEM) Loading @@ -108,6 +121,6 @@ public class TimeZonePreferenceControllerTest { .setAutoDetectionEnabled(!suggestManualAllowed) .setGeoDetectionEnabled(false) .build(); return new TimeZoneCapabilitiesAndConfig(capabilities, config); return new TimeZoneCapabilitiesAndConfig(status, capabilities, config); } }