Harden required import picker for Android 13

This commit is contained in:
anxiousintrovert
2026-08-15 10:04:43 -05:00
parent 5198b35945
commit 52efdabf61
2 changed files with 37 additions and 1 deletions
@@ -55,4 +55,24 @@ check(not source:find("QuestActivity", 1, true) and
not source:find("QuestBridge", 1, true),
"generic Android activity must not require Quest classes")
-- Required mod files use Android's Storage Access Framework, which works with
-- Android 13 scoped storage without broad media/storage permissions. Keep the
-- native destination distinct so it cannot be consumed as a game ROM.
check(source:find('PICKED_REQUIRED_IMPORT_FILENAME = "picked_required_import.bin"',
1, true), "required imports use their own Android picker destination")
check(source:find("showRequiredImportFilePicker", 1, true),
"Android exposes a required-import picker entry point")
check(source:find("Intent.ACTION_OPEN_DOCUMENT", 1, true)
and source:find("Intent.FLAG_GRANT_READ_URI_PERMISSION", 1, true),
"Android 13 uses SAF with an explicit read grant")
local systemPath = "mobile/android/love/src/jni/love/src/modules/system/System.cpp"
local systemFile = assert(io.open(systemPath, "rb"))
local system = systemFile:read("*a")
systemFile:close()
check(system:find('strcmp(kind, "required_import")', 1, true)
and system:find('dest = "picked_required_import.bin"', 1, true)
and system:find('return "rom,mod,sav,required_import"', 1, true),
"native Android bridge advertises and routes required imports")
print("android_host_extension_test: ok")