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