Fix CtsRootPermissionTestCases NoSuchMethodError before U.

We fixed the test issue on U by skipping it when SdkLevel.isAtLeastV()
returns false. However, despite that the SdkLevel is a class bundled in
a static library for our testcase APK, our test is instrumenting against
the system server which has its own copy of SdkLevel with a higher
priority in default class loading, and that copy could be stale on
older platforms so we are seeing the NoSuchMethodError.

Instead of trying to fight with class loading, a simpler and more
reliable way is to use @SdkSuppress instead.

This also adds the explicit numeric SDK versions for the test helper
apps so that an in-development W version of the test won't fail on
stable V platform in the future.

Bug: 348576508
Flag: TEST_ONLY
Test: m gts && gts-tradefed run gts-root -m CtsRootPermissionTestCases
Test: on R/S/V platforms
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2f0f363de37e6db91dac89646c121bb4c1de91d1)
Merged-In: I887e6456d4b48edb2994d5059772cbf9fcb94bc4
Change-Id: I887e6456d4b48edb2994d5059772cbf9fcb94bc4
2 files changed
tree: 7c95ce98f8b951167ef9da53fbd69d0957850198
  1. hostsidetests/
  2. tests/
  3. tools/
  4. OWNERS
  5. PREUPLOAD.cfg
  6. README.md
README.md

Android Compatibility Test Suite - Root extension (CTS-Root)

This is an extension the main CTS test suite, for general compatibility tests that require root privileges or a debuggable device.

Note that the name of this suite in the build system is CTS_ROOT (with an underscore), so this is built with m cts_root and tests must be tagged with cts_root in their test_suites to be included.

However in tradefed the name is cts-root (with a hyphen), so use cts-root-tradefed to run it, and run cts-root to run the default cts-root plan.