JNI lib is always embedded for APKs in APEX
If a JNI lib is depended on by an APK that is included in an APEX, the lib is embedded inside the APK. This change also fixes a bug that APKs are not mutated for APEXes. Bug: 144135069 Test: m (apex_test.go amended) Change-Id: Icf490d2701a7ede8bcad7e671fc72be9c8d7c01e
This commit is contained in:
11
java/app.go
11
java/app.go
@@ -78,8 +78,9 @@ type appProperties struct {
|
||||
|
||||
// Store native libraries uncompressed in the APK and set the android:extractNativeLibs="false" manifest
|
||||
// flag so that they are used from inside the APK at runtime. Defaults to true for android_test modules unless
|
||||
// sdk_version or min_sdk_version is set to a version that doesn't support it (<23), defaults to false for other
|
||||
// module types where the native libraries are generally preinstalled outside the APK.
|
||||
// sdk_version or min_sdk_version is set to a version that doesn't support it (<23), defaults to true for
|
||||
// android_app modules that are embedded to APEXes, defaults to false for other module types where the native
|
||||
// libraries are generally preinstalled outside the APK.
|
||||
Use_embedded_native_libs *bool
|
||||
|
||||
// Store dex files uncompressed in the APK and set the android:useEmbeddedDex="true" manifest attribute so that
|
||||
@@ -216,7 +217,8 @@ func (a *AndroidApp) useEmbeddedNativeLibs(ctx android.ModuleContext) bool {
|
||||
ctx.PropertyErrorf("min_sdk_version", "invalid value %q: %s", a.minSdkVersion(), err)
|
||||
}
|
||||
|
||||
return minSdkVersion >= 23 && Bool(a.appProperties.Use_embedded_native_libs)
|
||||
return (minSdkVersion >= 23 && Bool(a.appProperties.Use_embedded_native_libs)) ||
|
||||
!a.IsForPlatform()
|
||||
}
|
||||
|
||||
// Returns whether this module should have the dex file stored uncompressed in the APK.
|
||||
@@ -240,7 +242,7 @@ func (a *AndroidApp) shouldUncompressDex(ctx android.ModuleContext) bool {
|
||||
|
||||
func (a *AndroidApp) shouldEmbedJnis(ctx android.BaseModuleContext) bool {
|
||||
return ctx.Config().UnbundledBuild() || Bool(a.appProperties.Use_embedded_native_libs) ||
|
||||
a.appProperties.AlwaysPackageNativeLibs
|
||||
!a.IsForPlatform() || a.appProperties.AlwaysPackageNativeLibs
|
||||
}
|
||||
|
||||
func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
||||
@@ -584,6 +586,7 @@ func AndroidAppFactory() android.Module {
|
||||
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
android.InitOverridableModule(module, &module.appProperties.Overrides)
|
||||
android.InitApexModule(module)
|
||||
|
||||
return module
|
||||
}
|
||||
|
Reference in New Issue
Block a user