diff options
author | 2021-02-04 17:49:45 +0000 | |
---|---|---|
committer | 2021-02-07 10:58:24 +0000 | |
commit | 219b177279c703eeb3caa58e3c868a9203417117 (patch) | |
tree | a40182cbab3c6b990899d568675bee45df1d0fc8 /java/hiddenapi.go | |
parent | 01289a24076289369e8eb6995d35d276f225d18e (diff) |
Remove duplicate entries from hiddenapi files
Prevents the hiddenapi files index and metadata files from including
duplicate entries.
Bug: 178361284
Test: m droid
Compared hiddenapi files before and after change
Verified that the only differences were due to the removal of duplicates
Used sort -u to remove duplicates from before file and compared with after file
Change-Id: I0b9e420aec42cdcf4584099a7ffd2ed9c3715d6d
Diffstat (limited to 'java/hiddenapi.go')
-rw-r--r-- | java/hiddenapi.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/java/hiddenapi.go b/java/hiddenapi.go index eafbf5df0..ada11c341 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -108,9 +108,18 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, name string, primary bo // not on the list then that will cause failures in the CtsHiddenApiBlacklist... // tests. if inList(bootJarName, ctx.Config().BootJars()) { - // Create ninja rules to generate various CSV files needed by hiddenapi and store the paths - // in the hiddenAPI structure. - h.hiddenAPIGenerateCSV(ctx, implementationJar) + // More than one library with the same classes may need to be encoded but only one should be + // used as a source of information for hidden API processing otherwise it will result in + // duplicate entries in the files. + if primary { + // Create ninja rules to generate various CSV files needed by hiddenapi and store the paths + // in the hiddenAPI structure. + h.hiddenAPIGenerateCSV(ctx, implementationJar) + + // Save the unencoded dex jar so it can be used when generating the + // hiddenAPISingletonPathsStruct.stubFlags file. + h.bootDexJarPath = dexJar + } // If this module is actually on the boot jars list and not providing // hiddenapi information for a module on the boot jars list then encode @@ -118,13 +127,6 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, name string, primary bo if name == bootJarName { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar").OutputPath - // More than one library with the same classes can be encoded but only one can - // be added to the global set of flags, otherwise it will result in duplicate - // classes which is an error. Therefore, only add the dex jar of one of them - // to the global set of flags. - if primary { - h.bootDexJarPath = dexJar - } hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) dexJar = hiddenAPIJar } |