Tweak status display logic and tests
The existing logic and tests looks incorrect. Tests have been tidied up to reflect real cases. For example, it's not really possible for the provider to report being "blocked", but for it to report it is "certain" at the same time. Bug: 266921482 Test: atest tests/robotests/src/com/android/settings/datetime/LocationProviderStatusPreferenceControllerTest.java Change-Id: I1a0faa44ed7dd09828ff758db9e40f5d5e010ab0
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.settings.datetime;
|
||||
|
||||
import static android.service.timezone.TimeZoneProviderStatus.DEPENDENCY_STATUS_OK;
|
||||
|
||||
import android.app.time.DetectorStatusTypes;
|
||||
import android.app.time.LocationTimeZoneAlgorithmStatus;
|
||||
import android.app.time.TelephonyTimeZoneAlgorithmStatus;
|
||||
@@ -95,22 +97,16 @@ public class LocationProviderStatusPreferenceController
|
||||
.getLocationTimeZoneAlgorithmStatus();
|
||||
TimeZoneProviderStatus primary = status.getPrimaryProviderReportedStatus();
|
||||
TimeZoneProviderStatus secondary = status.getSecondaryProviderReportedStatus();
|
||||
if (primary == null && secondary == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (primary == null) {
|
||||
return secondary;
|
||||
} else if (secondary == null) {
|
||||
if (primary != null && secondary != null) {
|
||||
if (primary.getLocationDetectionDependencyStatus() == DEPENDENCY_STATUS_OK) {
|
||||
return secondary;
|
||||
}
|
||||
return primary;
|
||||
}
|
||||
|
||||
if (status.getPrimaryProviderStatus()
|
||||
!= LocationTimeZoneAlgorithmStatus.PROVIDER_STATUS_IS_CERTAIN) {
|
||||
} else if (primary != null) {
|
||||
return primary;
|
||||
} else {
|
||||
return secondary;
|
||||
}
|
||||
|
||||
return primary;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user