Fix CTS tests to work on devices without telephony

The tests try to reset the device to have automatic time zone detection
set the way it was before a test ran. It does this by just setting the
value to the original value unconditionally. On devices without any auto
time zone detection mechanisms, i.e. ones without telephony and no
location-based time zone detection, like AOSP and GSI builds, the
time_zone_detector service is smart enough to fail the request to change
the auto detection setting, which causes the test to fail.

As a fix, the test teardown now checks to see if it needs to change the
value and doesn't try if the value is already what is needed.

Bug: 230307604
Bug: 215044363
Test: atest android.time.cts.host.LocationTimeZoneManagerHostTest
Change-Id: Ia955905d3d67a6ec0bf9ac1f56bc2a5938af975e
(cherry picked from commit f2eff834925bf0875d01eaa73b9b78e3008a68c9)
2 files changed