Android: Don't access /dev/ashmem on newer Android versions #8955
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.
Fixes a critical regression where PR #8953 made us unable to start emulation on Android 10 and newer. Android is restricting direct access to
/dev/ashmemstarting with the new SDK version, but we can use the new (and simpler)ASharedMemoryAPI instead.While this change does fix the problem on Android 10, there is the problem that
ASharedMemorywas added in SDK version 26. We currently haveminSdkVersionset to 21, and I do not want to increase it to as much as 26 unless it is absolutely necessary. My hope was that I could select between the two APIs at runtime, like we are able to do in Java, but it does not seem to be possible to link toASharedMemorywithout increasingminSdkVersion(or its NDK equivalent,ANDROID_PLATFORM).