Enforce <uses-library> checks for android_app and android_app_import.
Bug: 132357300
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Ib9653aa27a173f0f0c03c7c9b0963d8ea71bb155
diff --git a/java/app.go b/java/app.go
index 249313c..574472c 100755
--- a/java/app.go
+++ b/java/app.go
@@ -905,6 +905,8 @@
&module.appProperties,
&module.overridableAppProperties)
+ module.usesLibrary.enforce = true
+
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
android.InitOverridableModule(module, &module.appProperties.Overrides)
@@ -1175,6 +1177,9 @@
// with knowledge of their shared libraries.
type usesLibrary struct {
usesLibraryProperties UsesLibraryProperties
+
+ // Whether to enforce verify_uses_library check.
+ enforce bool
}
func (u *usesLibrary) addLib(lib string, optional bool) {
@@ -1241,7 +1246,7 @@
func (u *usesLibrary) enforceUsesLibraries() bool {
defaultEnforceUsesLibs := len(u.usesLibraryProperties.Uses_libs) > 0 ||
len(u.usesLibraryProperties.Optional_uses_libs) > 0
- return BoolDefault(u.usesLibraryProperties.Enforce_uses_libs, defaultEnforceUsesLibs)
+ return BoolDefault(u.usesLibraryProperties.Enforce_uses_libs, u.enforce || defaultEnforceUsesLibs)
}
// Freeze the value of `enforce_uses_libs` based on the current values of `uses_libs` and `optional_uses_libs`.