CTS test for <uses-sdk> parsing

In the case of multiple <uses-sdk> tags, the platform has historically
taken the last tag in the manifest. This codifies this behavior.

A python script genrule was added to facilitate easier and faster test
iteration for future parsing tests. This allows a Kotlin triple quoted
string literal to be transformed automatically into a signed test APK
that can be retrieved from the host jar at runtime and installed on
the device under test.

This allows the test to pretend to install a manifest directly from a
string, without needing to configure or keep track of Android.bp
android_test_helper_app entries.

The added functionality is extremely limited and only supports true
string constants. Kotlin triple quotes are defined to include all of
the characters encompassed in the source file, including indents and
new lines, so this allows the script to compare the strings via hash
code to know which APK must be installed.

A better implementation may be to associate them based on file index
and use an annotation processor to transform the test class to
reference the indexed ID, but there doesn't seem to be a class
transformation available with vanilla Java annotation processors.

Because it uses hash code, it is possible to have conflicts, but that
will fail the build of that target, so it should be caught during
development.

Bug: 187110971

Test: atest android.content.pm.parsing.cts.host.ApkParsingTest

Change-Id: Ibe1df25a7231181fb09d4ae9faa7c75454bebd51
9 files changed