summaryrefslogtreecommitdiff
path: root/java/hiddenapi_singleton.go
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2019-07-18 17:00:45 +0900
committerJiyong Park <jiyong@google.com>2019-07-23 20:32:14 +0900
commitaa53324ac8308d974435cf2c8566835b87e3e05d (patch)
tree61c0c20ed58c5469c5d672671c775fdd06918d4f /java/hiddenapi_singleton.go
parent1ecfa940d1fefdeab2df661778498b64bf81d8bb (diff)
Split Java libraries per apex
Just like native libs, a java library that is included in an APEX is mutated for the APEX. This allows us to infer the context (e.g. sdk_version, etc.) for building a java library in an APEX. Bug: 138182343 Test: apex_test added Change-Id: I9292ea097b98e74a8a794f164bd2bed3921d6337
Diffstat (limited to 'java/hiddenapi_singleton.go')
-rw-r--r--java/hiddenapi_singleton.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index c83dda143..8379f5397 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -152,6 +152,14 @@ func stubFlagsRule(ctx android.SingletonContext) {
// Collect dex jar paths for modules that had hiddenapi encode called on them.
if h, ok := module.(hiddenAPIIntf); ok {
if jar := h.bootDexJar(); jar != nil {
+ // For a java lib included in an APEX, only take the one built for
+ // the platform variant, and skip the variants for APEXes.
+ // Otherwise, the hiddenapi tool will complain about duplicated classes
+ if a, ok := module.(android.ApexModule); ok {
+ if android.InAnyApex(module.Name()) && !a.IsForPlatform() {
+ return
+ }
+ }
bootDexJars = append(bootDexJars, jar)
}
}