Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Implement OS::get_processor_name() for Android

m96-chan188501c23387
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 2909cbea55d..924be854072 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -472,7 +472,7 @@
<return type="String" />
<description>
Returns the full name of the CPU model on the host machine (e.g. [code]"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz"[/code]).
- [b]Note:[/b] This method is only implemented on Windows, macOS, Linux and iOS. On Android and Web, [method get_processor_name] returns an empty string.
+ [b]Note:[/b] This method is only implemented on Windows, macOS, Linux, Android (API level 31+), and iOS. On Web, [method get_processor_name] returns an empty string.
</description>
</method>
<method name="get_restart_on_exit_arguments" qualifiers="const">
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index c562013bacc..60597021a45 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -487,6 +487,10 @@ String OS_Android::get_model_name() const {
return OS_Unix::get_model_name();
}
+String OS_Android::get_processor_name() const {
+ return get_system_property("ro.soc.model");
+}
+
String OS_Android::get_data_path() const {
return OS::get_user_data_dir();
}
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index df9c4e3ff06..59033fb89c4 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -151,6 +151,7 @@ public:
virtual String get_resource_dir() const override;
virtual String get_locale() const override;
virtual String get_model_name() const override;
+ virtual String get_processor_name() const override;
virtual String get_unique_id() const override;