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. MAKING THE PREBUILTS In order to generate the upgrade key, the shim directory needs to be built multiple times. First to generate the upgrade APK [so its hash can be obtained] and again once the hash has been included as part of the pre-installed APK. build: $ mmm frameworks/base/packages/CtsShim/build update the manifest: $ sed -i -e "s/__HASH__/`sha512sum out/target/product/shamu/system/priv-app/CtsShimPrivUpgrade/CtsShimPrivUpgrade.apk | cut -d' ' -f1`/" \ frameworks/base/packages/CtsShim/build/shim_priv/AndroidManifest.xml build: $ mmm frameworks/base/packages/CtsShim/build update prebuilts: $ cp out/target/product/shamu/system/priv-app/CtsShimPrivUpgrade/CtsShimPrivUpgrade.apk \ cts/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp $ cp out/target/product/shamu/system/priv-app/CtsShimPriv/CtsShimPriv.apk \ frameworks/base/packages/CtsShim revert manifest: $ pushd frameworks/base && git checkout -- packages/CtsShim/build/shim_priv/AndroidManifest.xml && popd Finally, upload and submit both the cts/ and frameworks/base/ repos.