Merge "Do verify_uses_libraries check for APKs after patching library names."
diff --git a/java/app_import.go b/java/app_import.go
index 59eb10a..d69dd10 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -244,10 +244,6 @@
srcApk := a.prebuilt.SingleSourcePath(ctx)
- if a.usesLibrary.enforceUsesLibraries() {
- srcApk = a.usesLibrary.verifyUsesLibrariesAPK(ctx, srcApk)
- }
-
// TODO: Install or embed JNI libraries
// Uncompress JNI libraries in the apk
@@ -276,6 +272,10 @@
a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries()
a.dexpreopter.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)
+ if a.usesLibrary.enforceUsesLibraries() {
+ srcApk = a.usesLibrary.verifyUsesLibrariesAPK(ctx, srcApk)
+ }
+
a.dexpreopter.dexpreopt(ctx, jnisUncompressed)
if a.dexpreopter.uncompressedDex {
dexUncompressed := android.PathForModuleOut(ctx, "dex-uncompressed", ctx.ModuleName()+".apk")
diff --git a/java/app_test.go b/java/app_test.go
index c5a618c..f41047a 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -2380,9 +2380,7 @@
// Test that all libraries are verified for an APK (library order matters).
verifyApkCmd := prebuilt.Rule("verify_uses_libraries").RuleParams.Command
- // TODO(b/132357300): "non-sdk-lib" should not be here
- // TODO(b/132357300): "com.non.sdk.lib" should be here
- verifyApkReqLibs := `uses_library_names="foo non-sdk-lib android.test.runner"`
+ verifyApkReqLibs := `uses_library_names="foo com.non.sdk.lib android.test.runner"`
verifyApkOptLibs := `optional_uses_library_names="bar baz"`
if !strings.Contains(verifyApkCmd, verifyApkReqLibs) {
t.Errorf("wanted %q in %q", verifyApkReqLibs, verifyApkCmd)