Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Don't access /dev/ashmem on newer Android versions #8955

Merged
merged 1 commit into from Jul 16, 2020

Conversation

JosJuice
Copy link
Member

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/ashmem starting with the new SDK version, but we can use the new (and simpler) ASharedMemory API instead.

While this change does fix the problem on Android 10, there is the problem that ASharedMemory was added in SDK version 26. We currently have minSdkVersion set 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 to ASharedMemory without increasing minSdkVersion (or its NDK equivalent, ANDROID_PLATFORM).

@JosJuice
Copy link
Member Author

Problem solved. Fortunately, Firefox used to have the exact same problem, and I was able to use the approach they used. (You'd think Google would've documented anything about how to use NDK APIs that are from a newer SDK than the minimum required version, especially when they're requiring us to use an API that was added in Android 8, but no...)

@JosJuice JosJuice marked this pull request as ready for review July 16, 2020 18:06
@JosJuice JosJuice changed the title [Do not merge] Android: Don't access /dev/ashmem on newer Android versions Android: Don't access /dev/ashmem on newer Android versions Jul 16, 2020
Fixes a critical regression where 95945a0 made us unable to
start emulation on Android 10 and newer. Android is restricting
direct access to /dev/ashmem starting with the new SDK version,
but we can use the new (and simpler) ASharedMemory API instead.
We have to keep using the /dev/ashmem approach on old versions
of Android, though.
@lioncash lioncash merged commit c596483 into dolphin-emu:master Jul 16, 2020
10 checks passed
@JosJuice JosJuice deleted the android-no-ashmem branch July 16, 2020 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants