1*33f37583SAndroid Build Coastguard Worker# Cts Shim Apex 2*33f37583SAndroid Build Coastguard Worker 3*33f37583SAndroid Build Coastguard Worker## Overview 4*33f37583SAndroid Build Coastguard Worker 5*33f37583SAndroid Build Coastguard WorkerA shim apex is an apex that doesn't provide any functionality as it's sole 6*33f37583SAndroid Build Coastguard Workerpurpose is to enable CTS testing of APEX-related APIs. 7*33f37583SAndroid Build Coastguard Worker 8*33f37583SAndroid Build Coastguard WorkerA cts shim apex has following restrictions: 9*33f37583SAndroid Build Coastguard Worker 10*33f37583SAndroid Build Coastguard Worker* Its name is equal to `com.android.apex.cts.shim` 11*33f37583SAndroid Build Coastguard Worker* It is signed with a throw-away key. 12*33f37583SAndroid Build Coastguard Worker* First version (i.e. `com.android.apex.cts.shim.apex`) should be 13*33f37583SAndroid Build Coastguard Worker pre-installed on the /system/partition. 14*33f37583SAndroid Build Coastguard Worker* `apex_payload.img` of the pre-installed shim apexcontains a single text 15*33f37583SAndroid Build Coastguard Worker file called `hash.txt` with a list of allowed SHA512 hashes of versions shim 16*33f37583SAndroid Build Coastguard Worker apex can be upgraded to. 17*33f37583SAndroid Build Coastguard Worker* `apex_payload.img` of all other versions contains SHA512 hash of 18*33f37583SAndroid Build Coastguard Worker `/dev/null`. 19*33f37583SAndroid Build Coastguard Worker 20*33f37583SAndroid Build Coastguard Worker 21*33f37583SAndroid Build Coastguard Worker## Building shim apexes 22*33f37583SAndroid Build Coastguard Worker 23*33f37583SAndroid Build Coastguard WorkerModules to build shim apexes are defined in the 24*33f37583SAndroid Build Coastguard Workersystem/apex/shim/build/Android.bp blueprint file. 25*33f37583SAndroid Build Coastguard Worker 26*33f37583SAndroid Build Coastguard WorkerTo build shim apexes simply run 27*33f37583SAndroid Build Coastguard Worker 28*33f37583SAndroid Build Coastguard Worker``` 29*33f37583SAndroid Build Coastguard Workerm com.android.apex.cts.shim.v3 \ 30*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2 \ 31*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_additional_file \ 32*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_additional_folder \ 33*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_different_certificate \ 34*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_different_package_name \ 35*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_with_pre_install_hook \ 36*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_with_post_install_hook \ 37*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v2_wrong_sha \ 38*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim.v1 \ 39*33f37583SAndroid Build Coastguard Worker com.android.apex.cts.shim_not_pre_installed \ 40*33f37583SAndroid Build Coastguard Worker``` 41*33f37583SAndroid Build Coastguard Worker 42*33f37583SAndroid Build Coastguard WorkerGenerated apexes will be located in the following folders. 43*33f37583SAndroid Build Coastguard Worker 44*33f37583SAndroid Build Coastguard Worker* out/target/product/${DEVICE}/obj/ETC/com.android.apex.cts.shim.v1_intermediates/com.android.apex.cts.shim.v1.apex 45*33f37583SAndroid Build Coastguard Worker* out/target/product/${DEVICE}/obj/ETC/com.android.apex.cts.shim.v2_intermediates/com.android.apex.cts.shim.v2.apex 46*33f37583SAndroid Build Coastguard Worker* out/target/product/${DEVICE}/obj/ETC/com.android.apex.cts.shim.v2_wrong_sha_intermediates/com.android.apex.cts.shim.v2_wrong_sha.apex 47*33f37583SAndroid Build Coastguard Worker* etc. 48*33f37583SAndroid Build Coastguard Worker 49*33f37583SAndroid Build Coastguard Worker## Updating shim apexes 50*33f37583SAndroid Build Coastguard Worker 51*33f37583SAndroid Build Coastguard WorkerShim apex files should be built on a build server and then downloaded from it 52*33f37583SAndroid Build Coastguard Workerinto following directories: 53*33f37583SAndroid Build Coastguard Worker 54*33f37583SAndroid Build Coastguard Worker* system/apex/shim 55*33f37583SAndroid Build Coastguard Worker* cts/hostsidetests/stagedinstall/testdata/apex 56