1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Respect system user setting for (un)installing APK

This commit is contained in:
RedMser
2024-12-30 17:37:24 +01:00
parent 2582793d40
commit bb76e721e9

View File

@@ -2177,6 +2177,10 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
args.push_back("-s"); args.push_back("-s");
args.push_back(devices[p_device].id); args.push_back(devices[p_device].id);
args.push_back("uninstall"); args.push_back("uninstall");
if ((bool)EDITOR_GET("export/android/force_system_user") && devices[p_device].api_level >= 17) {
args.push_back("--user");
args.push_back("0");
}
args.push_back(get_package_name(package_name)); args.push_back(get_package_name(package_name));
output.clear(); output.clear();
@@ -2193,6 +2197,10 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
args.push_back("-s"); args.push_back("-s");
args.push_back(devices[p_device].id); args.push_back(devices[p_device].id);
args.push_back("install"); args.push_back("install");
if ((bool)EDITOR_GET("export/android/force_system_user") && devices[p_device].api_level >= 17) {
args.push_back("--user");
args.push_back("0");
}
args.push_back("-r"); args.push_back("-r");
args.push_back(tmp_export_path); args.push_back(tmp_export_path);
@@ -2268,7 +2276,7 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
args.push_back("shell"); args.push_back("shell");
args.push_back("am"); args.push_back("am");
args.push_back("start"); args.push_back("start");
if ((bool)EDITOR_GET("export/android/force_system_user") && devices[p_device].api_level >= 17) { // Multi-user introduced in Android 17 if ((bool)EDITOR_GET("export/android/force_system_user") && devices[p_device].api_level >= 17) {
args.push_back("--user"); args.push_back("--user");
args.push_back("0"); args.push_back("0");
} }