Android: Don't enable MMAP beyond the device's own policy

setMMapEnabled(true) doesn't mean "allow it", it sets the process's MMAP
policy to AUTO, overriding a device whose aaudio.mmap_policy disables
MMAP. Since #22766 we did that on every audio start, and a Xiaomi Pad 5
Pro (Android 13) has been stuck on a blank screen at launch since then.
The likely cause, not yet confirmed on the device: opening a stream on a
MMAP path the vendor turned off, from the UI thread.

Now the checkbox can only turn MMAP off, as on the Bluetooth TV.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-25 13:49:04 +01:00
1 parent 68c85fd694
commit 5cdf4df765
1 file changed
+4 -2
+4 -2
View File
@@ -21,8 +21,10 @@ public:
if (g_Config.iAndroidAudioApi == (int)AndroidAudioApi::AAUDIO && oboe::AudioStreamBuilder::isAAudioRecommended()) {
audioApi_ = oboe::AudioApi::AAudio;
}
// Global in Oboe, and only read when an AAudio stream is opened.
oboe::OboeExtensions::setMMapEnabled(g_Config.bAndroidAudioMMap);
// Global in Oboe, and only read when an AAudio stream is opened. Never enable it beyond what
// the device's aaudio.mmap_policy allows: setMMapEnabled(true) forces the policy to AUTO, and
// a Xiaomi Pad 5 Pro (Android 13) got stuck on a blank screen at launch after we started doing that.
oboe::OboeExtensions::setMMapEnabled(g_Config.bAndroidAudioMMap && oboe::OboeExtensions::isMMapSupported());
}
bool StartOutput() {