Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
derive_classpath/ | 03-May-2024 | - | 1,071 | 744 | ||
derive_sdk/ | 03-May-2024 | - | 581 | 419 | ||
gen_sdk/ | 03-May-2024 | - | 755 | 644 | ||
java/ | 03-May-2024 | - | 425 | 242 | ||
javatests/ | 03-May-2024 | - | 1,425 | 1,001 | ||
Android.bp | D | 03-May-2024 | 2.8 KiB | 91 | 80 | |
OWNERS | D | 03-May-2024 | 151 | 6 | 4 | |
PREUPLOAD.cfg | D | 03-May-2024 | 422 | 13 | 10 | |
README.md | D | 03-May-2024 | 3.4 KiB | 70 | 58 | |
TEST_MAPPING | D | 03-May-2024 | 246 | 19 | 18 | |
com.android.sdkext.avbpubkey | D | 03-May-2024 | 1 KiB | |||
com.android.sdkext.pem | D | 03-May-2024 | 3.2 KiB | 52 | 51 | |
com.android.sdkext.pk8 | D | 03-May-2024 | 2.3 KiB | |||
com.android.sdkext.x509.pem | D | 03-May-2024 | 2.1 KiB | 36 | 35 | |
manifest.json | D | 03-May-2024 | 59 | 5 | 4 |
README.md
1# SdkExtensions module 2 3SdkExtensions module is responsible for: 4- deciding the extension SDK level of the device; 5- providing APIs for applications to query the extension SDK level; 6- determining the values for the BOOTCLASSPATH, DEX2OATBOOTCLASSPATH, and 7 SYSTEMSERVERCLASSPATH environment variables. 8 9## General information 10 11### Structure 12 13The module is packaged in an apex, `com.android.sdkext`, and has several 14components: 15- `bin/derive_classpath`: a native binary that runs early in the device boot 16 process. It reads individual classpath configs files from the system and 17 other modules, merges them, and defines the definition of *CLASSPATH environ 18 variables. 19- `bin/derive_sdk`: native binary that runs early in the device boot process and 20 reads metadata of other modules, to set system properties relating to the 21 extension SDK (for instance `build.version.extensions.r`). 22- `javalib/framework-sdkextension.jar`: this is a jar on the bootclasspath that 23 exposes APIs to applications to query the extension SDK level. 24 25### Deriving extension SDK level 26`derive_sdk` is a program that reads metadata stored in other apex modules, in 27the form of binary protobuf files in subpath `etc/sdkinfo.pb` inside each 28apex. The structure of this protobuf can be seen [here][sdkinfo-proto]. The 29exact steps for converting a set of metadata files to actual extension versions 30is likely to change over time, and should not be depended upon. 31 32### Reading extension SDK level 33The module exposes a java class [`SdkExtensions`][sdkextensions-java] in the 34package `android.os.ext`. The method `getExtensionVersion(int)` can be used to 35read the version of a particular sdk extension, e.g. 36`getExtensionVersion(Build.VERSION_CODES.R)`. 37 38### Deriving classpaths 39`derive_classpath` service reads and merges individual config files in the 40`/system/etc/classpaths/` and `/apex/*/etc/classpaths`. Each config stores 41protobuf message from [`classpaths.proto`] in a proto binary format. Exact 42merging algorithm that determines the order of the classpath entries is 43described in [`derive_classpath.cpp`] and may change over time. 44 45[`classpaths.proto`]: packages/modules/SdkExtensions/proto/classpaths.proto 46[`derive_classpath.cpp`]: packages/modules/SdkExtensions/derive_classpath/derive_classpath.cpp 47[sdkinfo-proto]: packages/modules/SdkExtensions/proto/sdk.proto 48[sdkextensions-java]: framework/java/android/os/ext/SdkExtensions.java 49 50## Developer information 51 52### Adding a new extension 53An extension is a way to group a set of modules so that they are versioned 54together. We currently define a new extension for every Android SDK level 55that introduces new modules. Every module shipped in previous versions are 56also part of the new extension. For example, all the R modules are part of 57both the R extensions and the S extensions. 58 59The steps to define a new extension are: 60- Add any new modules to the SdkModule enum in sdk.proto. 61- Add the binary "current sdk version" proto to the apexes of the new modules. 62- Update `derive_sdk.cpp` by: 63 * mapping the modules' package names to the new enum values 64 * creating a new set with the new enum values of the modules relevant for 65 this extension. 66 * set a new sysprop to the value of `GetSdkLevel` with the new enum set 67 * add a unit test to `derive_sdk_test.cpp` verifying the new extensions work 68- Make the `SdkExtensions.getExtensionVersion` API support the new extensions. 69- Extend the CTS test to verify the above two behaviors. 70