hiddenapi: Prevent libraries for Q/R from include S+ flags.

The Q and R runtimes can handle Q/R flags but not S flags. So, this
change verifies that any library that can run on Q/R
(min_sdk_version <= R) by adding --max-hiddenapi-level=max-target-r
to the "hiddenapi encode" command. That will cause a failure if any
S+ flags are found in the flags to encode.

Bug: 172453495
Test: m droid && launch_cvd
      Cherry pick changes in https://r.android.com/q/topic:max-target-s
      Add @UnsupportedAppUsage maxTargetSdk=S in classes in framework-permission (for r/q)
      and framework-permission-s (nominally for S+). I had to incresed the min_sdk_version
      in the latter to 31 (S) as it was still set at 30 (R).
Change-Id: Ie0f68482603adc7b4e3d7a5c81bf203d81a84a9e
This commit is contained in:
Paul Duffin
2022-04-28 17:45:11 +01:00
parent fcf0b686aa
commit 09817d66de
3 changed files with 25 additions and 3 deletions

View File

@@ -2211,6 +2211,13 @@ func (module *SdkLibraryImport) UniqueApexVariations() bool {
return module.uniqueApexVariations()
}
// MinSdkVersion - Implements hiddenAPIModule
func (module *SdkLibraryImport) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
return android.SdkSpecNone
}
var _ hiddenAPIModule = (*SdkLibraryImport)(nil)
func (module *SdkLibraryImport) OutputFiles(tag string) (android.Paths, error) {
return module.commonOutputFiles(tag)
}