diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-03-20 11:28:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-20 11:28:15 +0100 |
commit | 6066b236aac2aa7896f6212cc29874e359e1b74e (patch) | |
tree | 87dc293809fd6e21eec25896cae34067501ec413 /platform/android/export/export.cpp | |
parent | a238e53da99c50491cc9567b36ac664a26b0f43f (diff) | |
parent | 4e378aeeb874b596fa08d079d9e107b2863f1144 (diff) | |
download | redot-engine-6066b236aac2aa7896f6212cc29874e359e1b74e.tar.gz |
Merge pull request #17645 from volzhs/android-device-info
Fix getting Android device information
Diffstat (limited to 'platform/android/export/export.cpp')
-rw-r--r-- | platform/android/export/export.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 6b4d0ff8c4..6d9f0a7e9a 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -301,8 +301,7 @@ class EditorExportAndroid : public EditorExportPlatform { args.push_back("-s"); args.push_back(d.id); args.push_back("shell"); - args.push_back("cat"); - args.push_back("/system/build.prop"); + args.push_back("getprop"); int ec; String dp; @@ -315,7 +314,14 @@ class EditorExportAndroid : public EditorExportPlatform { d.api_level = 0; for (int j = 0; j < props.size(); j++) { + // got information by `shell cat /system/build.prop` before and its format is "property=value" + // it's now changed to use `shell getporp` because of permission issue with Android 8.0 and above + // its format is "[property]: [value]" so changed it as like build.prop String p = props[j]; + p = p.replace("]: ", "="); + p = p.replace("[", ""); + p = p.replace("]", ""); + if (p.begins_with("ro.product.model=")) { device = p.get_slice("=", 1).strip_edges(); } else if (p.begins_with("ro.product.brand=")) { |