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 list of allowed 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_different_certificate
34  com.android.apex.cts.shim.v2_with_pre_install_hook \
35  com.android.apex.cts.shim.v2_with_post_install_hook \
36  com.android.apex.cts.shim.v2_wrong_sha \
37  com.android.apex.cts.shim.v1 \
38  com.android.apex.cts.shim_not_pre_installed \
39```
40
41Generated apexes will be located in the following folders.
42
43*   out/target/product/${DEVICE}/obj/ETC/com.android.apex.cts.shim.v1_intermediates/com.android.apex.cts.shim.v1.apex
44*   out/target/product/${DEVICE}/obj/ETC/com.android.apex.cts.shim.v2_intermediates/com.android.apex.cts.shim.v2.apex
45*   out/target/product/${DEVICE}/obj/ETC/com.android.apex.cts.shim.v2_wrong_sha_intermediates/com.android.apex.cts.shim.v2_wrong_sha.apex
46*   etc.
47
48## Updating shim apexes
49
50Shim apex files should be built on a build server and then downloaded from it
51into following directories:
52
53*   system/apex/shim
54*   cts/hostsidetests/stagedinstall/testdata/apex
55