Skip to content

Commit

Permalink
Merge pull request #100938 from RedMser/system-user-adb
Browse files Browse the repository at this point in the history
Respect system user setting for (un)installing APK
  • Loading branch information
akien-mga committed Jan 2, 2025
2 parents 21e6671 + bb76e72 commit d28c416
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,10 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
args.push_back("-s");
args.push_back(devices[p_device].id);
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));

output.clear();
Expand All @@ -2193,6 +2197,10 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
args.push_back("-s");
args.push_back(devices[p_device].id);
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(tmp_export_path);

Expand Down Expand Up @@ -2268,7 +2276,7 @@ Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset,
args.push_back("shell");
args.push_back("am");
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("0");
}
Expand Down

0 comments on commit d28c416

Please sign in to comment.