Update Android SDK 31 astubx models #1054
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I did not have the artifacts from building SDK 31 from source available to me, so I couldn't run JarInfer on them directly. Instead, I wrote this code to convert our extant astubx file to the new format. The main change is that now method signatures use qualified type names. To do the conversion, I looked up methods from the astubx file in the android.jar stubs file (using WALA) and then got the qualified type names from there.
Not every method present in the previous astubx file is present in the android.jar stubs, as many methods in AOSP are hidden and cannot be invoked (at least not easily), but those methods were included in our previous astubx. This explains why the new astubx is smaller. I did my best to carefully debug and make sure we weren't missing other methods unnecessarily.
This is not a long-term solution. We will probably want to continue to evolve the astubx format, and we'll need a new conversion script each time. Eventually we should create a new astubx for the latest Android SDK and possibly deprecate these artifacts for older SDKs. But, this solution unblocks us, as our current astubx for SDK 31 is unusable with the main branch astubx parsing code.