Backports to fix CTS tests on non-debug devices

Backports: http://ag/15090523, http://ag/15243454, http://ag/14748431

This is mainly to address bug 193146231 reported against T, which looks
like it will be an issue for S CTS tests too.

TL;DR - a shell command used by tests cannot be used on non-debug (i.e.
user) builds.

There have been various improvements made on master that are being
backported here at the same time.

The shell_util code copied from master has been adjusted slightly to
account for command-line differences in "cmd device_config". On S,
get_sync_disabled_for_tests doesn't exist, and
is_sync_disabled_for_tests must be used instead.

----------

Original comment for http://ag/15090523:

Extract common code for time shell commands

There is a mix of instrumentation and host tests that cover time and
time zone system server code. This commit extracts the common shell
command details into shared code to reduce duplication and make it
easier to write new tests in future commits.

Bug: 188780558

----------

Original comment for http://ag/15243454:

Stop using cmd device_config reset

Stop using "adb cmd device_config reset" after tests to reset
device_config state because it is not suitable for use during tests, as
it requires root. Instead, tests now take a snapshot of device_config
key/values and return them to what they were when the test ends.

Bug: 193146231

----------
Flag CTS time tests as debuggable

Debugging tests is useful. The absence wasted time because only some
breakpoints triggered.

Bug: 188532369

----

Confirmed (silent) command failure with old CTS code on a -user build.

Also, CtsLocationTimeZoneManagerHostTest leaves device_config flags set
on -user devices without this change.

Test: [user build] atest CtsLocationTimeZoneManagerHostTest
Test: [user build] atest CtsTimeTestCases
Bug: 193146231
Bug: 193398340
Merged-In: I0b17e893ca1428f504b97a04e6a094af3d55ca44
Change-Id: I552bb73e9fd39455ed01769bdb15356156138055
21 files changed