Return to the initial screen state after each test

Some tests may leave the screen in the "dirty" state. For some tests
this is not a problem. But there are tests which are affected by such
behavior. For example, the following consequence leads to failure:
$ run cts-dev -m CtsAppSecurityHostTestCases \
              -t android.appsecurity.cts.PermissionsHostTest#\
                 testRevokePropagatedOnUpgradeOldToNewModel
$ run cts-dev -m CtsAppSecurityHostTestCases \
              -t android.appsecurity.cts.PermissionsHostTest#\
                 testCompatRevoked22
As far as the sequence of tests may be different for different
cts-tradefed sessions it leads to unstable test results.

Actually there are two kinds of problems with the tests:
- some tests do not perform properly cleanup step after its execution;
- some tests do not perform properly cleanup step before its execution.
In this patch it is proposed to fix the post-execution cleanup step.

These changes are essential for automotive configurations only. Because
test failures are reproduced with CarSettings application only. With
the Settings application the behavior the same but it does not lead to
test failures.
As far as these changes do not affect tests with the usual Settings
application it is proposed to use it without any conditions for all
types of devices but not for automotive only.

Bug: 141924185
Test: $ run cts-dev -m CtsAppSecurityHostTestCases \
                    -t android.appsecurity.cts.PermissionsHostTest#\
                       testRevokePropagatedOnUpgradeOldToNewModel
      $ run cts-dev -m CtsAppSecurityHostTestCases \
                    -t android.appsecurity.cts.PermissionsHostTest#\
                       testGranted23
      Launch tests and ensure that they leave a screen in the initial
      state.
Change-Id: Ibe0fac62462a814bf000961942b9978c1d2b7cd4
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
(cherry picked from commit 66d789a3e65b86f084c1e20a39eec86c7b21f7f8)
1 file changed