commit | 16097eaa2166bff45370adbe4ad139f31e280d45 | [log] [tgz] |
---|---|---|
author | Anton Hansson <hansson@google.com> | Tue Jan 12 20:34:32 2021 +0000 |
committer | Anton Hansson <hansson@google.com> | Mon Jan 18 12:50:28 2021 +0000 |
tree | 65c9d56e16cf245f25af7c089380f7047f50a095 | |
parent | 572968a42fbef67c5c460980e4c3667105be40d6 [diff] |
Update sdk derivation logic Add logic to read the extension database and update the logic that figures out the current SDK level based on the modules present. For each extension (R, S etc), we find the highest version where all the modules in that extension fulfil the requirements, and set the extension sysprops accordingly. This follows the design in go/mainline-sdk-versioning-impl. Update the derive_sdk_test with a few more interesting cases (though no multi-extension tests yet, that's coming next). For the java tests, add a database that is compatible with the existing test apexes. Future changes will add more apex versions into the mix to make the tests more interesting. Bug: 173188089 Test: atest --test-mapping packages/modules/SdkExtensions Change-Id: I8b550f18c19330b65d250ffc6d7db43976cf6f80
SdkExtensions is a module that decides the extension SDK level of the device, and provides APIs for applications to query the extension SDK level.
The module is packaged in an apex, com.android.sdkext
, and has two components:
bin/derive_sdk
: Native binary that runs early in the device boot process and reads metadata of other modules, to set system properties relating to the extension SDK (for instance build.version.extensions.r
).javalib/framework-sdkextension.jar
: This is a jar on the bootclasspath that exposes APIs to applications to query the extension SDK level.derive_sdk
is a program that reads metadata stored in other apex modules, in the form of binary protobuf files in subpath etc/sdkinfo.binarypb
inside each apex. The structure of this protobuf can be seen here. The exact steps for converting a set of metadata files to actual extension versions is likely to change over time, and should not be depended upon.
The module exposes a java class SdkExtensions
in the package android.os.ext
. The method getExtensionVersion(int)
can be used to read the version of a particular sdk extension, e.g. getExtensionVersion(Build.VERSION_CODES.R)
.
For every new Android SDK level a new extension version should be defined. These are the steps necessary to do that:
SdkExtensions.getExtensionVersion
API support the new extensions.RollbackManagerServiceImpl#getExtensionVersions
to account for the new extension version.TODO(b/173188089): expand this section when derive_sdk is reimplemented