Add platform_apis property to APEX module type
The property is used to allow non-updatable APEXes to use platform APIs
(e.g. symbols marked as "# platform-only").
Bug: 191637950
Test: m com.android.virt com.android.compos
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
Change-Id: Id2410b4e38a78ec2146a42298840954381a7c472
(cherry picked from commit fb63625a7f
)
This commit is contained in:
12
apex/apex.go
12
apex/apex.go
@@ -130,6 +130,10 @@ type apexBundleProperties struct {
|
||||
// symlinking to the system libs. Default is true.
|
||||
Updatable *bool
|
||||
|
||||
// Whether this APEX can use platform APIs or not. Can be set to true only when `updatable:
|
||||
// false`. Default is false.
|
||||
Platform_apis *bool
|
||||
|
||||
// Whether this APEX is installable to one of the partitions like system, vendor, etc.
|
||||
// Default: true.
|
||||
Installable *bool
|
||||
@@ -919,6 +923,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||
MinSdkVersion: minSdkVersion,
|
||||
RequiredSdks: a.RequiredSdks(),
|
||||
Updatable: a.Updatable(),
|
||||
UsePlatformApis: a.UsePlatformApis(),
|
||||
InApexVariants: []string{mctx.ModuleName()}, // could be com.android.foo
|
||||
InApexModules: []string{a.Name()}, // could be com.mycompany.android.foo
|
||||
ApexContents: []*android.ApexContents{apexContents},
|
||||
@@ -1321,6 +1326,10 @@ func (a *apexBundle) Updatable() bool {
|
||||
return proptools.BoolDefault(a.properties.Updatable, true)
|
||||
}
|
||||
|
||||
func (a *apexBundle) UsePlatformApis() bool {
|
||||
return proptools.BoolDefault(a.properties.Platform_apis, false)
|
||||
}
|
||||
|
||||
// getCertString returns the name of the cert that should be used to sign this APEX. This is
|
||||
// basically from the "certificate" property, but could be overridden by the device config.
|
||||
func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string {
|
||||
@@ -2374,6 +2383,9 @@ func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
|
||||
if String(a.properties.Min_sdk_version) == "" {
|
||||
ctx.PropertyErrorf("updatable", "updatable APEXes should set min_sdk_version as well")
|
||||
}
|
||||
if a.UsePlatformApis() {
|
||||
ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
|
||||
}
|
||||
a.checkJavaStableSdkVersion(ctx)
|
||||
a.checkClasspathFragments(ctx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user