Ensure extracted JNIs are stored properly in APKs
If the android_app has the use_embedded_native_libs flag all its JNIs must be stored with the store compression method. The logic to add JNIs from ARR is as follows: 1) Extract JNI libs from AAR 2) Store JNI libs with deflate 3) Merge deflated JNI libs with APK This process produces a bogus APK that won't be loaded by the framework if the use_embedded_native_libs is set as the resulting APK will have all its merged entries stored as deflate. To solve the problem in case we merge JNIs with an app requiring uncompressed JNI we add an extra step to ensure they're compressed using the store method. Test: m, verify apk using jni_extract has stored libs Change-Id: Ic31d47f15412171b5898dd0e2a554cb6bf93293b
This commit is contained in:
parent
6ff7d9e532
commit
813de60e00
1 changed files with 13 additions and 1 deletions
|
@ -268,13 +268,25 @@ func TransformJniLibsToJar(
|
|||
Args: args,
|
||||
})
|
||||
if len(prebuiltJniPackages) > 0 {
|
||||
var mergeJniJarPath android.WritablePath = android.PathForModuleOut(ctx, "mergeJniJarOutput.zip")
|
||||
if !uncompressJNI {
|
||||
mergeJniJarPath = outputFile
|
||||
}
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: mergeAssetsRule,
|
||||
Description: "merge prebuilt JNI packages",
|
||||
Inputs: append(prebuiltJniPackages, jniJarPath),
|
||||
Output: mergeJniJarPath,
|
||||
})
|
||||
|
||||
if uncompressJNI {
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: uncompressEmbeddedJniLibsRule,
|
||||
Input: mergeJniJarPath,
|
||||
Output: outputFile,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
|
||||
|
|
Loading…
Reference in a new issue