diff options
| author | 2019-11-11 10:14:32 +0900 | |
|---|---|---|
| committer | 2019-11-14 00:39:47 +0900 | |
| commit | 52cd06fc734fb58be98b3b67d5a320349d8cf3e1 (patch) | |
| tree | c2a29af7ba939c2cf709e0eb3a5b002134307bf0 /java | |
| parent | f9e10f944332a4d71867e09c899c05ab355277b4 (diff) | |
Reland: 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: I21ac24412b30c05afc03385655c6b196130dffe3
Diffstat (limited to 'java')
| -rw-r--r-- | java/androidmk.go | 5 | ||||
| -rw-r--r-- | java/app.go | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/java/androidmk.go b/java/androidmk.go index 05106806a..c97373926 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -262,6 +262,11 @@ func (binary *Binary) AndroidMkEntries() android.AndroidMkEntries { } func (app *AndroidApp) AndroidMkEntries() android.AndroidMkEntries { + if !app.IsForPlatform() { + return android.AndroidMkEntries{ + Disabled: true, + } + } return android.AndroidMkEntries{ Class: "APPS", OutputFile: android.OptionalPathForPath(app.outputFile), diff --git a/java/app.go b/java/app.go index d53d62614..e9ef9eb09 100644 --- a/java/app.go +++ b/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 @@ -217,7 +218,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. @@ -241,7 +243,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) { @@ -585,6 +587,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 } |