Dario Freni 2fc64882f7 Convert Android.mk to Android.bp for CtsShim*
Bug: 138429615
Test: File was mostly auto-generated via `androidmk`, except the
manifest generation bit. All modules verified to be compiling, and
correct hash verified beign present in the CtsShimPriv manifest:

$ sha512sum -b \
out/soong/.intermediates/frameworks/base/packages/CtsShim/build/CtsShimPrivUpgrade/android_common/CtsShimPrivUpgrade.apk
88828701aa191d9cfd7fe839bc0d0ba159e3c21dd85fb5bcd7d15e9e66ea7d88d8f6e2369a911b567571a6750e424f3c1424a927f8fde559535c7329778b7eb9

$ sha512sum -b \
out/soong/.intermediates/frameworks/base/packages/CtsShim/build/CtsShimPrivUpgradeWrongSHA/android_common/CtsShimPrivUpgradeWrongSHA.apk
55df1add673f13671e35de14540b427320f52fafff593c56e6dcc81d8b4fbde508d596edf8a326f764c58b70bcb94b63c6baacba1f8c6e4940c179a77dfc1ab1

$ aapt2 dump xmltree --file AndroidManifest.xml \
out/soong/.intermediates/frameworks/base/packages/CtsShim/build/CtsShimPriv/android_common/CtsShimPriv.apk \
| grep hash
        A:
	http://schemas.android.com/apk/res/android:hash(0x01010526)="88828701aa191d9cfd7fe839bc0d0ba159e3c21dd85fb5bcd7d15e9e66ea7d88d8f6e2369a911b567571a6750e424f3c1424a927f8fde559535c7329778b7eb9"
	(Raw:
	"88828701aa191d9cfd7fe839bc0d0ba159e3c21dd85fb5bcd7d15e9e66ea7d88d8f6e2369a911b567571a6750e424f3c1424a927f8fde559535c7329778b7eb9")

Change-Id: I9bb44a007324ab29ea60fb3ee06fc9ead42cdeba
Merged-In: Ie6e0df9f4f1365b5194e9748b325b421f838c65b
2019-11-16 17:37:16 +08:00
..

The CTS shim is a package that resides on a device's /system partition in order
to verify certain upgrade scenarios. Not only must it not contain code, but, it
must specify the singular APK that can be used to upgrade it.

NOTE: The need to include a binary on the system image may be deprecated if a
solution involving a temporarily writable /system partition is implemented.

For local testing, build the apk and put them in the following folders.
This is for arm:
    $ tapas CtsShim CtsShimPriv CtsShimPrivUpgrade CtsShimPrivUpgradeWrongSHA arm64
    $ m
    $ cp $OUT/system/priv-app/CtsShimPrivUpgrade/CtsShimPrivUpgrade.apk \
        cts/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm
    $ cp $OUT/system/priv-app/CtsShimPrivUpgrade/CtsShimPrivUpgrade.apk \
        vendor/xts/gts-tests/hostsidetests/packagemanager/app/apk/arm/GtsShimPrivUpgrade.apk
    $ cp $OUT/system/priv-app/CtsShimPrivUpgradeWrongSHA/CtsShimPrivUpgradeWrongSHA.apk \
        cts/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm
    $ cp $OUT/system/priv-app/CtsShimPriv/CtsShimPriv.apk \
        frameworks/base/packages/CtsShim/apk/arm
    $ cp $OUT/system/app/CtsShim/CtsShim.apk \
        frameworks/base/packages/CtsShim/apk/arm

This is for x86:
    $ tapas CtsShim CtsShimPriv CtsShimPrivUpgrade CtsShimPrivUpgradeWrongSHA x86_64
    $ m
    $ cp $OUT/system/priv-app/CtsShimPrivUpgrade/CtsShimPrivUpgrade.apk \
        cts/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86
    $ cp $OUT/system/priv-app/CtsShimPrivUpgrade/CtsShimPrivUpgrade.apk \
        vendor/xts/gts-tests/hostsidetests/packagemanager/app/apk/x86/GtsShimPrivUpgrade.apk
    $ cp $OUT/system/priv-app/CtsShimPrivUpgradeWrongSHA/CtsShimPrivUpgradeWrongSHA.apk \
        cts/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86
    $ cp $OUT/system/priv-app/CtsShimPriv/CtsShimPriv.apk \
        frameworks/base/packages/CtsShim/apk/x86
    $ cp $OUT/system/app/CtsShim/CtsShim.apk \
        frameworks/base/packages/CtsShim/apk/x86

For final submission, the APKs should be downloaded from the build server, then
submitted to the cts/ and frameworks/base/ repos.