Give a phone without a Qualcomm SoC the generic WebGPU runtime

The APK's ONNX Runtime is the QNN build, which carries no WebGPU, so a
non-Qualcomm phone had nothing above the CPU provider. The APK now also
carries Microsoft's stock onnxruntime-android 1.29.0 (32 MB) as
libonnxruntime_generic.so, and the app offers it after the QNN build.

The runtime search stops at a perfect fit, so on a Qualcomm device the
QNN build — listed first — is all that is opened, and the generic build
never loads beside it. A Qualcomm SoC is read from ro.soc.manufacturer
or, before Android 12, from Qualcomm's FastRPC library being present:
a Qualcomm device mistaken for another would trade its Hexagon for the
generic rung.
This commit is contained in:
2026-10-04 21:00:15 -04:00
parent cb97ebe7ac
commit 43402bfe5b
6 changed files with 59 additions and 19 deletions
+5 -3
View File
@@ -263,10 +263,12 @@ cp "${DEX}" "${OUT}/staging/classes.dex"
# native library directory. The build links none of it — the app dlopens
# `libonnxruntime.so` at launch and runs on tract if it is not there — so an
# APK without these is a slower app, not a broken one, and `RUNTIME_DIR=none`
# builds exactly that. 174 MB for the default set; the script says which
# Hexagon generations that buys.
# builds exactly that. 206 MB for the default set — 32 MB of it the generic
# WebGPU build for a phone without a Qualcomm SoC; the script says which
# Hexagon generations the rest buys.
if [[ "${RUNTIME_DIR}" != "none" ]]; then
if [[ ! -f "${RUNTIME_DIR}/lib/libonnxruntime.so" ]]; then
if [[ ! -f "${RUNTIME_DIR}/lib/libonnxruntime.so" \
|| ! -f "${RUNTIME_DIR}/lib/libonnxruntime_generic.so" ]]; then
"${REPO}/tools/fetch-android-runtime.sh" "${RUNTIME_DIR}"
fi
cp "${RUNTIME_DIR}"/lib/*.so "${OUT}/staging/lib/${ABI}/"