From 92d95eb7107faf2d7fbb1375bd9aa21e995e3790 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Thu, 14 Nov 2024 20:57:29 +0100 Subject: [PATCH 01/61] project: first add of android support hope it won't end as windows lol --- Makefile | 2 +- include/config.hpp | 2 +- include/platform.hpp | 26 +++++ include/query.hpp | 1 + include/util.hpp | 5 + src/query/android/gpu.cpp | 45 ++++++++ src/query/android/system.cpp | 146 +++++++++++++++++++++++ src/query/android/theme.cpp | 62 ++++++++++ src/query/android/user.cpp | 118 +++++++++++++++++++ src/query/unix/cpu.cpp | 216 +++++++++++++++++++++++++++++++---- src/query/unix/gpu.cpp | 5 + src/query/unix/system.cpp | 5 + src/query/unix/theme.cpp | 5 + src/query/unix/user.cpp | 5 + src/util.cpp | 14 +++ 15 files changed, 633 insertions(+), 24 deletions(-) create mode 100644 include/platform.hpp create mode 100644 src/query/android/gpu.cpp create mode 100644 src/query/android/system.cpp create mode 100644 src/query/android/theme.cpp create mode 100644 src/query/android/user.cpp diff --git a/Makefile b/Makefile index 880143f3..45279b00 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ TARGET = $(NAME) OLDVERSION = 0.10.1 VERSION = 0.10.2 BRANCH = $(shell git rev-parse --abbrev-ref HEAD) -SRC = $(wildcard src/*.cpp src/query/unix/*.cpp src/query/unix/utils/*.cpp) +SRC = $(wildcard src/*.cpp src/query/unix/*.cpp src/query/android/*.cpp src/query/unix/utils/*.cpp) OBJ = $(SRC:.cpp=.o) LDFLAGS += -L./$(BUILDDIR)/fmt -lfmt -ldl CXXFLAGS ?= -mtune=generic -march=native diff --git a/include/config.hpp b/include/config.hpp index cd6f4d1b..a7c76b82 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -338,7 +338,7 @@ pkg-managers = ["pacman", "dpkg", "flatpak"] # # If you don't know what these ares, leave them by default settings pacman-dirs = ["/var/lib/pacman/local/"] -dpkg-files = ["/var/lib/dpkg/status"] +dpkg-files = ["/var/lib/dpkg/status", "/data/data/com.termux/files/usr/var/lib/dpkg/status"] flatpak-dirs = ["/var/lib/flatpak/app/", "~/.local/share/flatpak/app/"] apk-files = ["/var/lib/apk/db/installed"] diff --git a/include/platform.hpp b/include/platform.hpp new file mode 100644 index 00000000..141219e9 --- /dev/null +++ b/include/platform.hpp @@ -0,0 +1,26 @@ +#ifndef _PLATFORM_H +#define _PLATFORM_H + +#if (defined(unix) || defined(__unix) || defined(__unix__)) +# define CF_UNIX 1 +#else +# define CF_UNIX 0 +#endif + +#if (defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)) +# define CF_WINDOWS 1 +#else +# define CF_WINDOWS 0 +#endif + +#if (defined(__ANDROID__) || defined(ANDROID_API)) +# define CF_ANDROID 1 +#else +# define CF_ANDROID 0 +#endif + +#if !(CF_UNIX || CF_ANDROID) || CF_WINDOWS +# error "Platform currently not supported, only Unix and Android" +#endif + +#endif // _PLATFORM_H diff --git a/include/query.hpp b/include/query.hpp index eb4b1625..a5535e97 100644 --- a/include/query.hpp +++ b/include/query.hpp @@ -107,6 +107,7 @@ class User public: struct User_t { + std::string shell_path{ UNKNOWN }; std::string shell_name{ UNKNOWN }; std::string shell_version{ UNKNOWN }; std::string wm_name{ MAGIC_LINE }; diff --git a/include/util.hpp b/include/util.hpp index b53f9db8..ab9a80ac 100644 --- a/include/util.hpp +++ b/include/util.hpp @@ -35,6 +35,7 @@ #include "fmt/color.h" #include "fmt/core.h" +#include "platform.hpp" // clang-format off constexpr std::size_t operator""_len(const char*, std::size_t ln) noexcept @@ -106,6 +107,10 @@ std::string getHomeConfigDir(); std::string getConfigDir(); std::vector split(const std::string_view text, char delim); +#if CF_ANDROID +std::string get_android_property(const std::string_view name); +#endif + template void error(const std::string_view fmt, Args&&... args) noexcept { diff --git a/src/query/android/gpu.cpp b/src/query/android/gpu.cpp new file mode 100644 index 00000000..d2991765 --- /dev/null +++ b/src/query/android/gpu.cpp @@ -0,0 +1,45 @@ +/* + * Copyright 2024 Toni500git + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "platform.hpp" +#if CF_ANDROID + +#include "query.hpp" + +using namespace Query; + +GPU::GPU(const std::uint16_t id, std::vector& queried_gpus) +{ + m_gpu_infos.name = m_gpu_infos.vendor = MAGIC_LINE; +} + +// clang-format off +std::string& GPU::name() noexcept +{ return m_gpu_infos.name; } + +std::string& GPU::vendor() noexcept +{ return m_gpu_infos.vendor; } + +#endif diff --git a/src/query/android/system.cpp b/src/query/android/system.cpp new file mode 100644 index 00000000..a92852d6 --- /dev/null +++ b/src/query/android/system.cpp @@ -0,0 +1,146 @@ +/* + * Copyright 2024 Toni500git + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "platform.hpp" +#if CF_ANDROID + +#include "query.hpp" +#include "util.hpp" + +#include +#include +#include +#include + +#include "../unix/utils/packages.hpp" + +using namespace Query; + +static System::System_t get_system_infos() +{ + System::System_t ret; + + ret.os_name = "Android"; + ret.os_id = "android"; + ret.os_version_id = get_android_property("ro.build.version.release"); + ret.os_version_codename = get_android_property("ro.build.version.codename"); + ret.os_pretty_name = "Android " + ret.os_version_codename + " " + ret.os_version_id; + + const std::array properties_name = {"ro.product.marketname", "ro.vendor.product.display", "ro.config.devicename", "ro.config.marketing_name", "ro.product.vendor.model", "ro.product.oppo_model", "ro.oppo.market.name", "ro.product.brand"}; + for (const std::string_view name : properties_name) + { + if (ret.host_modelname.empty() || ret.host_modelname == UNKNOWN) + ret.host_modelname = get_android_property(name); + else + break; + } + + ret.host_vendor = get_android_property("ro.product.manufacturer"); + ret.host_version = get_android_property("ro.product.model"); + if (access("/system/bin/init", F_OK) == 0) + { + ret.os_initsys_name = "init"; + ret.os_initsys_version.clear(); + } + + return ret; +} + +System::System() +{ + if (!m_bInit) + { + if (uname(&m_uname_infos) != 0) + die("uname() failed: {}\nCould not get system infos", strerror(errno)); + + if (sysinfo(&m_sysInfos) != 0) + die("sysinfo() failed: {}\nCould not get system infos", strerror(errno)); + + m_system_infos = get_system_infos(); + } + m_bInit = true; + +} + +// clang-format off +std::string System::kernel_name() noexcept +{ return m_uname_infos.sysname; } + +std::string System::kernel_version() noexcept +{ return m_uname_infos.release; } + +std::string System::hostname() noexcept +{ return m_uname_infos.nodename; } + +std::string System::arch() noexcept +{ return m_uname_infos.machine; } + +long& System::uptime() noexcept +{ return m_sysInfos.uptime; } + +std::string& System::os_pretty_name() noexcept +{ return m_system_infos.os_pretty_name; } + +std::string& System::os_name() noexcept +{ return m_system_infos.os_name; } + +std::string& System::os_id() noexcept +{ return m_system_infos.os_id; } + +std::string& System::os_versionid() noexcept +{ return m_system_infos.os_version_id; } + +std::string& System::os_version_codename() noexcept +{ return m_system_infos.os_version_codename; } + +std::string& System::host_modelname() noexcept +{ return m_system_infos.host_modelname; } + +std::string& System::host_vendor() noexcept +{ return m_system_infos.host_vendor; } + +std::string& System::host_version() noexcept +{ return m_system_infos.host_version; } + +std::string& System::os_initsys_name() +{ return m_system_infos.os_initsys_name; } + +std::string& System::os_initsys_version() +{ return m_system_infos.os_initsys_version; } + +std::string& System::pkgs_installed(const Config& config) +{ + static bool done = false; + if (!done) + { + m_system_infos.pkgs_installed = get_all_pkgs(config); + + done = true; + } + + return m_system_infos.pkgs_installed; +} + +#endif diff --git a/src/query/android/theme.cpp b/src/query/android/theme.cpp new file mode 100644 index 00000000..835aff99 --- /dev/null +++ b/src/query/android/theme.cpp @@ -0,0 +1,62 @@ +/* + * Copyright 2024 Toni500git + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "platform.hpp" +#if CF_ANDROID + +#include "query.hpp" +#include "util.hpp" + +using namespace Query; + +Theme::Theme(const std::uint8_t ver, systemInfo_t& queried_themes, std::vector& queried_themes_names, + const std::string& theme_name_version, const Config& config, const bool gsettings_only) + : m_queried_themes(queried_themes), + m_theme_name_version(theme_name_version) +{ + m_theme_infos.cursor = m_theme_infos.gtk_font = m_theme_infos.cursor_size = m_theme_infos.gtk_theme_name = m_theme_infos.gtk_icon_theme = MAGIC_LINE; +} + +Theme::Theme(systemInfo_t& queried_themes, const Config& config, const bool gsettings_only) : m_queried_themes(queried_themes) +{ + m_theme_infos.cursor = m_theme_infos.gtk_font = m_theme_infos.cursor_size = m_theme_infos.gtk_theme_name = m_theme_infos.gtk_icon_theme = MAGIC_LINE; +} + +std::string Theme::gtk_theme() noexcept +{ return m_theme_infos.gtk_theme_name; } + +std::string Theme::gtk_icon_theme() noexcept +{ return m_theme_infos.gtk_icon_theme; } + +std::string Theme::gtk_font() noexcept +{ return m_theme_infos.gtk_font; } + +std::string& Theme::cursor() noexcept +{ return m_theme_infos.cursor; } + +std::string& Theme::cursor_size() noexcept +{ return m_theme_infos.cursor_size; } + +#endif diff --git a/src/query/android/user.cpp b/src/query/android/user.cpp new file mode 100644 index 00000000..304d97c9 --- /dev/null +++ b/src/query/android/user.cpp @@ -0,0 +1,118 @@ +/* + * Copyright 2024 Toni500git + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "platform.hpp" +#if CF_ANDROID + +#include "query.hpp" +#include "util.hpp" +#include "fmt/format.h" + +#include +#include +#include +#include + +using namespace Query; + +static std::string get_shell_version(const std::string_view shell_name) +{ + std::string ret; + + if (shell_name == "nu") + ret = read_shell_exec("nu -c \"version | get version\""); + else + ret = read_shell_exec(fmt::format("{} -c 'echo \"${}_VERSION\"'", shell_name, str_toupper(shell_name.data()))); + + strip(ret); + return ret; +} + +static std::string get_shell_name(const std::string_view shell_path) +{ + return shell_path.substr(shell_path.rfind('/') + 1).data(); +} + +User::User() noexcept +{ + if (!m_bInit) + { + const uid_t uid = getuid(); + + if (m_pPwd = getpwuid(uid), !m_pPwd) + die("getpwent failed: {}\nCould not get user infos", std::strerror(errno)); + + char buf[PATH_MAX]; + if (getenv("TERMUX_VERSION") || getenv("TERMUX_MAIN_PACKAGE_FORMAT")) + { + m_users_infos.shell_path = realpath(fmt::format("/proc/{}/exe", getpid()).c_str(), buf); + m_users_infos.shell_name = get_shell_name(m_users_infos.shell_path); + m_users_infos.shell_version = get_shell_version(m_users_infos.shell_name); + m_users_infos.term_name = "Termux"; + m_users_infos.term_version = getenv("TERMUX_VERSION"); + } + else + { + m_users_infos.shell_path = m_pPwd->pw_shell; + } + + m_users_infos.wm_name = m_users_infos.wm_version = m_users_infos.de_name = m_users_infos.de_version = m_users_infos.m_wm_path = MAGIC_LINE; + } + m_bInit = true; + +} + +// clang-format off +std::string User::name() noexcept +{ return m_pPwd->pw_name; } + +std::string User::shell_path() noexcept +{ return m_users_infos.shell_path; } + +std::string& User::shell_name() noexcept +{ return m_users_infos.shell_name; } + +std::string& User::shell_version(const std::string_view shell_name) +{ return m_users_infos.shell_version; } + +std::string& User::term_name() +{ return m_users_infos.term_name; } + +std::string& User::term_version(const std::string_view term_name) +{ return m_users_infos.term_version; } + +std::string& User::wm_name(bool dont_query_dewm, const std::string_view term_name) +{ return m_users_infos.wm_name; } + +std::string& User::wm_version(bool dont_query_dewm, const std::string_view term_name) +{ return m_users_infos.wm_version; } + +std::string& User::de_name(bool dont_query_dewm, const std::string_view term_name, const std::string_view wm_name) +{ return m_users_infos.de_name; } + +std::string& User::de_version(const std::string_view de_name) +{ return m_users_infos.de_version; } + +#endif diff --git a/src/query/unix/cpu.cpp b/src/query/unix/cpu.cpp index 59c1be35..8f27879b 100644 --- a/src/query/unix/cpu.cpp +++ b/src/query/unix/cpu.cpp @@ -1,25 +1,25 @@ /* * Copyright 2024 Toni500git - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following * disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ @@ -31,11 +31,159 @@ #include #include "fmt/format.h" +#include "platform.hpp" #include "query.hpp" +#include "switch_fnv1a.hpp" #include "util.hpp" using namespace Query; +// https://en.wikipedia.org/wiki/List_of_Qualcomm_Snapdragon_systems_on_chips +#if CF_ANDROID +static std::string detect_qualcomm(const std::string& model_name) +{ + std::string cpuname = "Qualcomm "; + switch (fnv1a16::hash(model_name)) + { + case "SM8750-AB"_fnv1a16: cpuname += "Snapdragon 8 Elite"; break; + case "SM8635"_fnv1a16: cpuname += "Snapdragon 8s Gen 3"; break; + case "SM8650-AC"_fnv1a16: cpuname += "Snapdragon 8 Gen 3 for Galaxy"; break; + case "SM8650"_fnv1a16: cpuname += "Snapdragon 8 Gen 3"; break; + case "SM8550-AC"_fnv1a16: cpuname += "Snapdragon 8 Gen 2 for Galaxy"; break; + case "SM8550"_fnv1a16: cpuname += "Snapdragon 8 Gen 2"; break; + case "SM8475"_fnv1a16: cpuname += "Snapdragon 8+ Gen 1"; break; + case "SM8450"_fnv1a16: cpuname += "Snapdragon 8 Gen 1"; break; + + case "SM7450-AB"_fnv1a16: cpuname += "Snapdragon 7 Gen 1"; break; + case "SM7475-AB"_fnv1a16: cpuname += "Snapdragon 7+ Gen 2"; break; + case "SM7435-AB"_fnv1a16: cpuname += "Snapdragon 7s Gen 2"; break; + case "SM7550-AB"_fnv1a16: cpuname += "Snapdragon 7 Gen 3"; break; + case "SM7675-AB"_fnv1a16: cpuname += "Snapdragon 7+ Gen 3"; break; + case "SM7635"_fnv1a16: cpuname += "Snapdragon 7s Gen 3"; break; + + case "SM6375-AC"_fnv1a16: cpuname += "Snapdragon 6s Gen 3"; break; + case "SM6475-AB"_fnv1a16: cpuname += "Snapdragon 6 Gen 3"; break; + case "SM6115-AC"_fnv1a16: cpuname += "Snapdragon 6s Gen 1"; break; + case "SM6450"_fnv1a16: cpuname += "Snapdragon 6 Gen 1"; break; + + case "SM4635"_fnv1a16: cpuname += "Snapdragon 4s Gen 2"; break; + case "SM4450"_fnv1a16: cpuname += "Snapdragon 4 Gen 2"; break; + case "SM4375"_fnv1a16: cpuname += "Snapdragon 4 Gen 1"; break; + + // adding fastfetch's many missing chips names + case "MSM8225Q"_fnv1a16: + case "MSM8625Q"_fnv1a16: + case "MSM8210"_fnv1a16: + case "MSM8610"_fnv1a16: + case "MSM8212"_fnv1a16: + case "MSM8612"_fnv1a16: cpuname += "Snapdragon 200"; break; + + case "MSM8905"_fnv1a16: cpuname += "205"; break; // Qualcomm 205 break; + case "MSM8208"_fnv1a16: cpuname += "Snapdragon 208"; break; + case "MSM8909"_fnv1a16: cpuname += "Snapdragon 210"; break; + case "MSM8909AA"_fnv1a16: cpuname += "Snapdragon 212"; break; + case "QM215"_fnv1a16: cpuname += "215"; break; + + // holy crap + case "APQ8026"_fnv1a16: + case "MSM8226"_fnv1a16: + case "MSM8926"_fnv1a16: + case "APQ8028"_fnv1a16: + case "MSM8228"_fnv1a16: + case "MSM8628"_fnv1a16: + case "MSM8928"_fnv1a16: + case "MSM8230"_fnv1a16: + case "MSM8630"_fnv1a16: + case "MSM8930"_fnv1a16: + case "MSM8930AA"_fnv1a16: + case "APQ8030AB"_fnv1a16: + case "MSM8230AB"_fnv1a16: + case "MSM8630AB"_fnv1a16: + case "MSM8930AB"_fnv1a16: cpuname += "Snapdragon 400"; break; + + case "APQ8016"_fnv1a16: + case "MSM8916"_fnv1a16: cpuname += "Snapdragon 410"; break; + case "MSM8929"_fnv1a16: cpuname += "Snapdragon 415"; break; + case "MSM8917"_fnv1a16: cpuname += "Snapdragon 425"; break; + case "MSM8920"_fnv1a16: cpuname += "Snapdragon 427"; break; + case "MSM8937"_fnv1a16: cpuname += "Snapdragon 430"; break; + case "MSM8940"_fnv1a16: cpuname += "Snapdragon 435"; break; + case "SDM429"_fnv1a16: cpuname += "Snapdragon 429"; break; + case "SDM439"_fnv1a16: cpuname += "Snapdragon 439"; break; + case "SDM450"_fnv1a16: cpuname += "Snapdragon 450"; break; + case "SM4250-AA"_fnv1a16: cpuname += "Snapdragon 460"; break; + case "SM4350"_fnv1a16: cpuname += "Snapdragon 480"; break; + case "SM4350-AC"_fnv1a16: cpuname += "Snapdragon 480+"; break; + + case "APQ8064-1AA"_fnv1a16: + case "APQ8064M"_fnv1a16: + case "APQ8064T"_fnv1a16: + case "APQ8064AB"_fnv1a16: cpuname += "Snapdragon 600"; break; + + case "MSM8936"_fnv1a16: cpuname += "Snapdragon 610"; break; + case "MSM8939"_fnv1a16: cpuname += "Snapdragon 615"; break; + case "MSM8952"_fnv1a16: cpuname += "Snapdragon 617"; break; + case "MSM8953"_fnv1a16: cpuname += "Snapdragon 625"; break; + case "SDM630"_fnv1a16: cpuname += "Snapdragon 630"; break; + case "SDM632"_fnv1a16: cpuname += "Snapdragon 632"; break; + case "SDM636"_fnv1a16: cpuname += "Snapdragon 636"; break; + case "MSM8956"_fnv1a16: cpuname += "Snapdragon 650"; break; + case "MSM8976"_fnv1a16: cpuname += "Snapdragon 652"; break; + case "SDA660"_fnv1a16: + case "SDM660"_fnv1a16: cpuname += "Snapdragon 660"; break; + case "SM6115"_fnv1a16: cpuname += "Snapdragon 662"; break; + case "SM6125"_fnv1a16: cpuname += "Snapdragon 665"; break; + case "SDM670"_fnv1a16: cpuname += "Snapdragon 670"; break; + case "SM6150"_fnv1a16: cpuname += "Snapdragon 675"; break; + case "SM6150-AC"_fnv1a16: cpuname += "Snapdragon 678"; break; + case "SM6225"_fnv1a16: cpuname += "Snapdragon 680"; break; + case "SM6225-AD"_fnv1a16: cpuname += "Snapdragon 685"; break; + case "SM6350"_fnv1a16: cpuname += "Snapdragon 690"; break; + case "SM6375"_fnv1a16: cpuname += "Snapdragon 695"; break; + + case "SDM710"_fnv1a16: cpuname += "Snapdragon 710"; break; + case "SDM712"_fnv1a16: cpuname += "Snapdragon 712"; break; + case "SM7125"_fnv1a16: cpuname += "Snapdragon 720G"; break; + case "SM7150-AA"_fnv1a16: cpuname += "Snapdragon 730"; break; + case "SM7150-AB"_fnv1a16: cpuname += "Snapdragon 730G"; break; + case "SM7150-AC"_fnv1a16: cpuname += "Snapdragon 732G"; break; + case "SM7225"_fnv1a16: cpuname += "Snapdragon 750G"; break; + case "SM7250-AA"_fnv1a16: cpuname += "Snapdragon 765"; break; + case "SM7250-AB"_fnv1a16: cpuname += "Snapdragon 765G"; break; + case "SM7250-AC"_fnv1a16: cpuname += "Snapdragon 768G"; break; + case "SM7325"_fnv1a16: cpuname += "Snapdragon 778G"; break; + case "SM7325-AE"_fnv1a16: cpuname += "Snapdragon 778G+"; break; + case "SM7350-AB"_fnv1a16: cpuname += "Snapdragon 780G"; break; + case "SM7325-AF"_fnv1a16: cpuname += "Snapdragon 782G"; break; + + case "APQ8074AA"_fnv1a16: + case "MSM8274AA"_fnv1a16: + case "MSM8674AA"_fnv1a16: + case "MSM8974AA"_fnv1a16: + case "MSM8274AB"_fnv1a16: cpuname += "Snapdragon 800"; break; + + case "APQ8084"_fnv1a16: cpuname += "Snapdragon 805"; break; + case "MSM8992"_fnv1a16: cpuname += "Snapdragon 808"; break; + case "MSM8994"_fnv1a16: cpuname += "Snapdragon 810"; break; + case "MSM8996"_fnv1a16: cpuname += "Snapdragon 820"; break; + case "MSM8998"_fnv1a16: cpuname += "Snapdragon 835"; break; + case "SDM845"_fnv1a16: cpuname += "Snapdragon 845"; break; + case "SM8150"_fnv1a16: cpuname += "Snapdragon 855"; break; + case "SM8150P"_fnv1a16: + case "SM8150-AC"_fnv1a16: cpuname += "Snapdragon 855+"; break; // both 855+ and 860 break; + case "SM8250"_fnv1a16: cpuname += "Snapdragon 865"; break; + case "SM8250-AB"_fnv1a16: cpuname += "Snapdragon 865+"; break; + case "SM8250-AC"_fnv1a16: cpuname += "Snapdragon 870"; break; + case "SM8350"_fnv1a16: cpuname += "Snapdragon 888"; break; + case "SM8350-AC"_fnv1a16: cpuname += "Snapdragon 888+"; break; + + default: return UNKNOWN; + } + + return cpuname + " [" + model_name + "]"; +} +#endif + static std::string get_from_text(std::string& line) { std::string amount = line.substr(line.find(':') + 1); @@ -62,10 +210,10 @@ static CPU::CPU_t get_cpu_infos() if (hasStart(line, "model name")) ret.name = get_from_text(line); - if (hasStart(line, "processor")) + else if (hasStart(line, "processor")) ret.nproc = get_from_text(line); - if (hasStart(line, "cpu MHz")) + else if (hasStart(line, "cpu MHz")) { double tmp = std::stof(get_from_text(line)); if (tmp > cpu_mhz) @@ -73,6 +221,30 @@ static CPU::CPU_t get_cpu_infos() } } +#if CF_ANDROID + if (ret.name == UNKNOWN) + { + std::string vendor; + ret.name = get_android_property("ro.soc.model"); + if (ret.name.empty()) + { + vendor = "MTK"; + ret.name = get_android_property("ro.mediatek.platform"); + } + if (vendor.empty()) + { + vendor = get_android_property("ro.soc.manufacturer"); + if (vendor.empty()) + vendor = get_android_property("ro.soc.manufacturer"); + } + + if ((vendor == "QTI" || vendor == "QUALCOMM") && + (hasStart(ret.name, "SM") || hasStart(ret.name, "APQ") || hasStart(ret.name, "MSM") || + hasStart(ret.name, "SDM") || hasStart(ret.name, "QM"))) + ret.name = detect_qualcomm(ret.name); + } +#endif + // sometimes /proc/cpuinfo at model name // the name will contain the min freq // happens on intel cpus especially @@ -89,7 +261,7 @@ static CPU::CPU_t get_cpu_infos() const std::string freq_dir = "/sys/devices/system/cpu/cpu0/cpufreq"; if (std::filesystem::exists(freq_dir)) { - std::ifstream cpu_bios_limit_f(freq_dir + "/bios_limit"); + std::ifstream cpu_bios_limit_f(freq_dir + "/bios_limit"); std::ifstream cpu_scaling_cur_f(freq_dir + "/scaling_cur_freq"); std::ifstream cpu_scaling_max_f(freq_dir + "/scaling_max_freq"); std::ifstream cpu_scaling_min_f(freq_dir + "/scaling_min_freq"); @@ -112,19 +284,17 @@ static CPU::CPU_t get_cpu_infos() static double get_cpu_temp() { - for (const auto& dir : std::filesystem::directory_iterator{"/sys/class/hwmon/"}) +#if CF_ANDROID + for (const auto& dir : std::filesystem::directory_iterator{ "/sys/class/hwmon/" }) { const std::string& name = read_by_syspath((dir.path() / "name").string()); debug("name = {}", name); - // if only !continue - if (name == "cpu" || - name == "k10temp" || - name == "coretemp"){} - else + if (name != "cpu" && name != "k10temp" && name != "coretemp") continue; - const std::string& temp_file = std::filesystem::exists(dir.path() / "temp1_input") ? dir.path() / "temp1_input" : - dir.path() / "device/temp1_input"; + const std::string& temp_file = std::filesystem::exists(dir.path() / "temp1_input") + ? dir.path() / "temp1_input" + : dir.path() / "device/temp1_input"; if (!std::filesystem::exists(temp_file)) continue; @@ -133,6 +303,7 @@ static double get_cpu_temp() return ret / 1000.0; } +#endif return 0.0; } @@ -146,6 +317,7 @@ CPU::CPU() noexcept } } +// clang-format off std::string& CPU::name() noexcept { return m_cpu_infos.name; } diff --git a/src/query/unix/gpu.cpp b/src/query/unix/gpu.cpp index afe2c7d1..9422c7ec 100644 --- a/src/query/unix/gpu.cpp +++ b/src/query/unix/gpu.cpp @@ -23,6 +23,9 @@ * */ +#include "platform.hpp" +#if CF_UNIX + #include #include #include @@ -111,3 +114,5 @@ std::string& GPU::name() noexcept std::string& GPU::vendor() noexcept { return m_gpu_infos.vendor; } + +#endif diff --git a/src/query/unix/system.cpp b/src/query/unix/system.cpp index c17d048e..1d31135f 100644 --- a/src/query/unix/system.cpp +++ b/src/query/unix/system.cpp @@ -23,6 +23,9 @@ * */ +#include "platform.hpp" +#if CF_UNIX + #include #include @@ -312,3 +315,5 @@ std::string& System::pkgs_installed(const Config& config) return m_system_infos.pkgs_installed; } + +#endif diff --git a/src/query/unix/theme.cpp b/src/query/unix/theme.cpp index 703b3b16..eb21747b 100644 --- a/src/query/unix/theme.cpp +++ b/src/query/unix/theme.cpp @@ -23,6 +23,9 @@ * */ +#include "platform.hpp" +#if CF_UNIX + #include #include @@ -562,3 +565,5 @@ std::string& Theme::cursor() noexcept std::string& Theme::cursor_size() noexcept { return m_theme_infos.cursor_size; } + +#endif diff --git a/src/query/unix/user.cpp b/src/query/unix/user.cpp index 1bb86f25..22c31875 100644 --- a/src/query/unix/user.cpp +++ b/src/query/unix/user.cpp @@ -23,6 +23,9 @@ * */ +#include "platform.hpp" +#if CF_UNIX + #include #include @@ -532,3 +535,5 @@ std::string& User::term_version(const std::string_view term_name) return m_users_infos.term_version; } + +#endif diff --git a/src/util.cpp b/src/util.cpp index 9bb04bb7..f949d2d7 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -48,6 +48,7 @@ #include "fmt/color.h" #include "fmt/ranges.h" #include "pci.ids.hpp" +#include "platform.hpp" // https://stackoverflow.com/questions/874134/find-out-if-string-ends-with-another-string-in-c#874160 bool hasEnding(const std::string_view fullString, const std::string_view ending) @@ -342,6 +343,19 @@ std::string get_data_dir(const std::string_view dir) return get_relative_path(dir, "XDG_DATA_DIRS", S_IFDIR); } +#if CF_ANDROID +#include +std::string get_android_property(const std::string_view name) +{ + char ret[PROP_VALUE_MAX]; + const int len = __system_property_get(name.data(), ret); + if (len <= 0) + return ""; + + return ret; +} +#endif + // https://gist.github.com/GenesisFR/cceaf433d5b42dcdddecdddee0657292 void replace_str(std::string& str, const std::string_view from, const std::string_view to) { From 39105e568bc1e30b1c4a831b6475af69a3567bc5 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Thu, 14 Nov 2024 21:03:59 +0100 Subject: [PATCH 02/61] little linking fix (hopefully) --- include/platform.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/platform.hpp b/include/platform.hpp index 141219e9..a6226f73 100644 --- a/include/platform.hpp +++ b/include/platform.hpp @@ -1,7 +1,13 @@ #ifndef _PLATFORM_H #define _PLATFORM_H -#if (defined(unix) || defined(__unix) || defined(__unix__)) +#if (defined(__ANDROID__) || defined(ANDROID_API)) +# define CF_ANDROID 1 +#else +# define CF_ANDROID 0 +#endif + +#if (defined(unix) || defined(__unix) || defined(__unix__)) && !CF_ANDROID # define CF_UNIX 1 #else # define CF_UNIX 0 @@ -13,12 +19,6 @@ # define CF_WINDOWS 0 #endif -#if (defined(__ANDROID__) || defined(ANDROID_API)) -# define CF_ANDROID 1 -#else -# define CF_ANDROID 0 -#endif - #if !(CF_UNIX || CF_ANDROID) || CF_WINDOWS # error "Platform currently not supported, only Unix and Android" #endif From b1e0a584fcf2a035a564eb4ddd00acbb720bb3cb Mon Sep 17 00:00:00 2001 From: Toni500git Date: Thu, 14 Nov 2024 21:22:10 +0100 Subject: [PATCH 03/61] minor fixes and tweaks --- include/pci.ids.hpp | 12 +++++++++++- src/query/android/user.cpp | 2 +- src/query/unix/cpu.cpp | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/pci.ids.hpp b/include/pci.ids.hpp index 204e65eb..e8eaf655 100644 --- a/include/pci.ids.hpp +++ b/include/pci.ids.hpp @@ -1,6 +1,9 @@ #ifndef _PCI_IDS_HPP #define _PCI_IDS_HPP +#include "platform.hpp" +#if !CF_ANDROID + #include #include @@ -39087,5 +39090,12 @@ C ff Unassigned class inline const std::string& all_ids = get_pci_ids(); inline constexpr std::array pci_vendors_array = get_pci_vendors_array(); inline constexpr std::array pci_vendors_location_array = get_pci_vendors_location_array(); +#else + +inline const std::string& all_ids = {}; +inline constexpr std::array pci_vendors_array = {}; +inline constexpr std::array pci_vendors_location_array = {}; + +#endif // !CF_ANDROID -#endif // _PCI_IDS_HPP \ No newline at end of file +#endif // _PCI_IDS_HPP diff --git a/src/query/android/user.cpp b/src/query/android/user.cpp index 304d97c9..09d452c9 100644 --- a/src/query/android/user.cpp +++ b/src/query/android/user.cpp @@ -67,7 +67,7 @@ User::User() noexcept char buf[PATH_MAX]; if (getenv("TERMUX_VERSION") || getenv("TERMUX_MAIN_PACKAGE_FORMAT")) { - m_users_infos.shell_path = realpath(fmt::format("/proc/{}/exe", getpid()).c_str(), buf); + m_users_infos.shell_path = realpath(fmt::format("/proc/{}/exe", getppid()).c_str(), buf); m_users_infos.shell_name = get_shell_name(m_users_infos.shell_path); m_users_infos.shell_version = get_shell_version(m_users_infos.shell_name); m_users_infos.term_name = "Termux"; diff --git a/src/query/unix/cpu.cpp b/src/query/unix/cpu.cpp index 8f27879b..93c6bc42 100644 --- a/src/query/unix/cpu.cpp +++ b/src/query/unix/cpu.cpp @@ -284,7 +284,7 @@ static CPU::CPU_t get_cpu_infos() static double get_cpu_temp() { -#if CF_ANDROID +#if !CF_ANDROID for (const auto& dir : std::filesystem::directory_iterator{ "/sys/class/hwmon/" }) { const std::string& name = read_by_syspath((dir.path() / "name").string()); From 04a0e48145d13a6a8a158771f05026ad8d934b84 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Thu, 14 Nov 2024 21:48:14 +0100 Subject: [PATCH 04/61] clang-format src/query/android/ --- src/query/android/system.cpp | 24 +++++++++++++----------- src/query/android/theme.cpp | 13 ++++++++----- src/query/android/user.cpp | 23 ++++++++++++----------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/query/android/system.cpp b/src/query/android/system.cpp index a92852d6..2dfcbf71 100644 --- a/src/query/android/system.cpp +++ b/src/query/android/system.cpp @@ -26,15 +26,15 @@ #include "platform.hpp" #if CF_ANDROID -#include "query.hpp" -#include "util.hpp" - -#include #include +#include + #include #include #include "../unix/utils/packages.hpp" +#include "query.hpp" +#include "util.hpp" using namespace Query; @@ -42,13 +42,16 @@ static System::System_t get_system_infos() { System::System_t ret; - ret.os_name = "Android"; - ret.os_id = "android"; - ret.os_version_id = get_android_property("ro.build.version.release"); + ret.os_name = "Android"; + ret.os_id = "android"; + ret.os_version_id = get_android_property("ro.build.version.release"); ret.os_version_codename = get_android_property("ro.build.version.codename"); - ret.os_pretty_name = "Android " + ret.os_version_codename + " " + ret.os_version_id; + ret.os_pretty_name = "Android " + ret.os_version_codename + " " + ret.os_version_id; - const std::array properties_name = {"ro.product.marketname", "ro.vendor.product.display", "ro.config.devicename", "ro.config.marketing_name", "ro.product.vendor.model", "ro.product.oppo_model", "ro.oppo.market.name", "ro.product.brand"}; + const std::array properties_name = { "ro.product.marketname", "ro.vendor.product.display", + "ro.config.devicename", "ro.config.marketing_name", + "ro.product.vendor.model", "ro.product.oppo_model", + "ro.oppo.market.name", "ro.product.brand" }; for (const std::string_view name : properties_name) { if (ret.host_modelname.empty() || ret.host_modelname == UNKNOWN) @@ -57,7 +60,7 @@ static System::System_t get_system_infos() break; } - ret.host_vendor = get_android_property("ro.product.manufacturer"); + ret.host_vendor = get_android_property("ro.product.manufacturer"); ret.host_version = get_android_property("ro.product.model"); if (access("/system/bin/init", F_OK) == 0) { @@ -81,7 +84,6 @@ System::System() m_system_infos = get_system_infos(); } m_bInit = true; - } // clang-format off diff --git a/src/query/android/theme.cpp b/src/query/android/theme.cpp index 835aff99..d6534fa0 100644 --- a/src/query/android/theme.cpp +++ b/src/query/android/theme.cpp @@ -33,17 +33,20 @@ using namespace Query; Theme::Theme(const std::uint8_t ver, systemInfo_t& queried_themes, std::vector& queried_themes_names, const std::string& theme_name_version, const Config& config, const bool gsettings_only) - : m_queried_themes(queried_themes), - m_theme_name_version(theme_name_version) + : m_queried_themes(queried_themes), m_theme_name_version(theme_name_version) { - m_theme_infos.cursor = m_theme_infos.gtk_font = m_theme_infos.cursor_size = m_theme_infos.gtk_theme_name = m_theme_infos.gtk_icon_theme = MAGIC_LINE; + m_theme_infos.cursor = m_theme_infos.gtk_font = m_theme_infos.cursor_size = m_theme_infos.gtk_theme_name = + m_theme_infos.gtk_icon_theme = MAGIC_LINE; } -Theme::Theme(systemInfo_t& queried_themes, const Config& config, const bool gsettings_only) : m_queried_themes(queried_themes) +Theme::Theme(systemInfo_t& queried_themes, const Config& config, const bool gsettings_only) + : m_queried_themes(queried_themes) { - m_theme_infos.cursor = m_theme_infos.gtk_font = m_theme_infos.cursor_size = m_theme_infos.gtk_theme_name = m_theme_infos.gtk_icon_theme = MAGIC_LINE; + m_theme_infos.cursor = m_theme_infos.gtk_font = m_theme_infos.cursor_size = m_theme_infos.gtk_theme_name = + m_theme_infos.gtk_icon_theme = MAGIC_LINE; } +// clang-format off std::string Theme::gtk_theme() noexcept { return m_theme_infos.gtk_theme_name; } diff --git a/src/query/android/user.cpp b/src/query/android/user.cpp index 09d452c9..78693a06 100644 --- a/src/query/android/user.cpp +++ b/src/query/android/user.cpp @@ -26,14 +26,15 @@ #include "platform.hpp" #if CF_ANDROID -#include "query.hpp" -#include "util.hpp" -#include "fmt/format.h" - -#include #include #include + #include +#include + +#include "fmt/format.h" +#include "query.hpp" +#include "util.hpp" using namespace Query; @@ -67,21 +68,21 @@ User::User() noexcept char buf[PATH_MAX]; if (getenv("TERMUX_VERSION") || getenv("TERMUX_MAIN_PACKAGE_FORMAT")) { - m_users_infos.shell_path = realpath(fmt::format("/proc/{}/exe", getppid()).c_str(), buf); - m_users_infos.shell_name = get_shell_name(m_users_infos.shell_path); + m_users_infos.shell_path = realpath(fmt::format("/proc/{}/exe", getppid()).c_str(), buf); + m_users_infos.shell_name = get_shell_name(m_users_infos.shell_path); m_users_infos.shell_version = get_shell_version(m_users_infos.shell_name); - m_users_infos.term_name = "Termux"; - m_users_infos.term_version = getenv("TERMUX_VERSION"); + m_users_infos.term_name = "Termux"; + m_users_infos.term_version = getenv("TERMUX_VERSION"); } else { m_users_infos.shell_path = m_pPwd->pw_shell; } - m_users_infos.wm_name = m_users_infos.wm_version = m_users_infos.de_name = m_users_infos.de_version = m_users_infos.m_wm_path = MAGIC_LINE; + m_users_infos.wm_name = m_users_infos.wm_version = m_users_infos.de_name = m_users_infos.de_version = + m_users_infos.m_wm_path = MAGIC_LINE; } m_bInit = true; - } // clang-format off From abfc751f9989cfcc601af8e9d87a33a78cc26624 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Thu, 14 Nov 2024 23:11:43 +0100 Subject: [PATCH 05/61] query: cpu: add android support for cpu.temp --- src/query/unix/cpu.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/query/unix/cpu.cpp b/src/query/unix/cpu.cpp index 93c6bc42..e24dde22 100644 --- a/src/query/unix/cpu.cpp +++ b/src/query/unix/cpu.cpp @@ -25,10 +25,12 @@ #include +#include #include #include #include #include +#include #include "fmt/format.h" #include "platform.hpp" @@ -284,7 +286,43 @@ static CPU::CPU_t get_cpu_infos() static double get_cpu_temp() { -#if !CF_ANDROID +#if CF_ANDROID + // https://github.com/kamgurgul/cpu-info/blob/master/shared/src/androidMain/kotlin/com/kgurgul/cpuinfo/data/provider/TemperatureProvider.android.kt#L119 + constexpr std::array temp_paths = { + "/sys/devices/system/cpu/cpu0/cpufreq/cpu_temp", + "/sys/devices/system/cpu/cpu0/cpufreq/FakeShmoo_cpu_temp", + "/sys/class/thermal/thermal_zone0/temp", + "/sys/class/i2c-adapter/i2c-4/4-004c/temperature", + "/sys/devices/platform/tegra-i2c.3/i2c-4/4-004c/temperature", + "/sys/devices/platform/omap/omap_temp_sensor.0/temperature", + "/sys/devices/platform/tegra_tmon/temp1_input", + "/sys/kernel/debug/tegra_thermal/temp_tj", + "/sys/devices/platform/s5p-tmu/temperature", + "/sys/class/thermal/thermal_zone1/temp", + "/sys/class/hwmon/hwmon0/device/temp1_input", + "/sys/devices/virtual/thermal/thermal_zone1/temp", + "/sys/devices/virtual/thermal/thermal_zone0/temp", + "/sys/class/thermal/thermal_zone3/temp", + "/sys/class/thermal/thermal_zone4/temp", + "/sys/class/hwmon/hwmonX/temp1_input", + "/sys/devices/platform/s5p-tmu/curr_temp", + "/sys/htc/cpu_temp", + "/sys/devices/platform/tegra-i2c.3/i2c-4/4-004c/ext_temperature", + "/sys/devices/platform/tegra-tsensor/tsensor_temperature", + }; + for (const std::string_view path : temp_paths) + { + debug("checking {}", path); + if (!std::filesystem::exists(path)) + continue; + + const double ret = std::stod(read_by_syspath(path)) / 1000.0; + debug("cpu temp ret = {}", ret); + + if (ret >= -1.0 && ret <= 250.0) + return ret; + } +#else for (const auto& dir : std::filesystem::directory_iterator{ "/sys/class/hwmon/" }) { const std::string& name = read_by_syspath((dir.path() / "name").string()); From a0597a5ba24ce44069b3054eefa79ca6ba674af2 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Fri, 15 Nov 2024 13:17:21 +0100 Subject: [PATCH 06/61] query: gpu: add android support for the gpus --- include/query.hpp | 7 ++ src/query/android/gpu.cpp | 175 +++++++++++++++++++++++++++++++++++++- src/query/unix/cpu.cpp | 31 ++++--- 3 files changed, 199 insertions(+), 14 deletions(-) diff --git a/include/query.hpp b/include/query.hpp index a5535e97..91e574b7 100644 --- a/include/query.hpp +++ b/include/query.hpp @@ -188,12 +188,19 @@ class CPU // private: double freq_max_cpuinfo = 0; + std::string modelname; + std::string vendor; }; CPU() noexcept; std::string& name() noexcept; std::string& nproc() noexcept; + + // only in Android + std::string& vendor() noexcept; + std::string& modelname() noexcept; + double& freq_max() noexcept; double& freq_min() noexcept; double& freq_cur() noexcept; diff --git a/src/query/android/gpu.cpp b/src/query/android/gpu.cpp index d2991765..d7dab59d 100644 --- a/src/query/android/gpu.cpp +++ b/src/query/android/gpu.cpp @@ -26,13 +26,186 @@ #include "platform.hpp" #if CF_ANDROID +#include + #include "query.hpp" +#include "switch_fnv1a.hpp" +#include "util.hpp" using namespace Query; +// https://en.wikipedia.org/wiki/List_of_Qualcomm_Snapdragon_systems_on_chips +static std::string detect_adreno(const std::string& cpu_model_name) +{ + switch (fnv1a16::hash(cpu_model_name)) + { + case "MSM8225Q"_fnv1a16: + case "MSM8625Q"_fnv1a16: return "Adreno (TM) 203"; + + case "MSM8210"_fnv1a16: + case "MSM8610"_fnv1a16: + case "MSM8212"_fnv1a16: + case "MSM8612"_fnv1a16: return "Adreno (TM) 302"; + + case "MSM8905"_fnv1a16: + case "MSM8208"_fnv1a16: + case "MSM8909"_fnv1a16: + case "MSM8909AA"_fnv1a16: return "Adreno (TM) 304"; + + case "APQ8026"_fnv1a16: + case "MSM8226"_fnv1a16: + case "MSM8926"_fnv1a16: + case "APQ8028"_fnv1a16: + case "MSM8228"_fnv1a16: + case "MSM8628"_fnv1a16: + case "MSM8928"_fnv1a16: + case "MSM8230"_fnv1a16: + case "MSM8630"_fnv1a16: + case "MSM8930"_fnv1a16: + case "MSM8930AA"_fnv1a16: + case "APQ8030AB"_fnv1a16: + case "MSM8230AB"_fnv1a16: + case "MSM8630AB"_fnv1a16: + case "MSM8930AB"_fnv1a16: return "Adreno (TM) 305"; + + case "APQ8016"_fnv1a16: + case "MSM8916"_fnv1a16: return "Adreno (TM) 306"; + + case "QM215"_fnv1a16: + case "MSM8917"_fnv1a16: + case "MSM8920"_fnv1a16: return "Adreno (TM) 308"; + + case "APQ8064M"_fnv1a16: + case "APQ8064T"_fnv1a16: + case "APQ8064AB"_fnv1a16: return "Adreno (TM) 320"; + + case "APQ8074AA"_fnv1a16: + case "MSM8274AA"_fnv1a16: + case "MSM8674AA"_fnv1a16: + case "MSM8974AA"_fnv1a16: + case "MSM8274AB"_fnv1a16: return "Adreno (TM) 330"; + + case "MSM8936"_fnv1a16: + case "MSM8939"_fnv1a16: + case "MSM8952"_fnv1a16: + case "MSM8929"_fnv1a16: return "Adreno (TM) 405"; + + case "MSM8992"_fnv1a16: return "Adreno (TM) 418"; + case "APQ8084"_fnv1a16: return "Adreno (TM) 420"; + case "MSM8994"_fnv1a16: return "Adreno (TM) 430"; + + case "SDM429"_fnv1a16: return "Adreno (TM) 504"; + + case "SDM439"_fnv1a16: + case "SDM450"_fnv1a16: + case "MSM8937"_fnv1a16: + case "MSM8940"_fnv1a16: return "Adreno (TM) 505"; + + case "MSM8953"_fnv1a16: + case "SDM632"_fnv1a16: return "Adreno (TM) 506"; + case "SDM630"_fnv1a16: return "Adreno (TM) 508"; + case "SDM636"_fnv1a16: return "Adreno (TM) 509"; + + case "MSM8956"_fnv1a16: + case "MSM8976"_fnv1a16: return "Adreno (TM) 510"; + + case "SDM660"_fnv1a16: return "Adreno (TM) 512"; + case "MSM8996"_fnv1a16: return "Adreno (TM) 530"; + case "MSM8998"_fnv1a16: return "Adreno (TM) 540"; + + case "SM6225"_fnv1a16: + case "SM6115"_fnv1a16: + case "SM6125"_fnv1a16: + case "SM6115-AC"_fnv1a16: + case "SM6225-AD"_fnv1a16: + case "SM4250-AA"_fnv1a16: return "Adreno (TM) 610"; + + case "SM4635"_fnv1a16: return "Adreno (TM) 611"; + case "SM6150"_fnv1a16: + case "SM6150-AC"_fnv1a16: return "Adreno (TM) 612"; + case "SM4450"_fnv1a16: return "Adreno (TM) 613"; + case "SDM670"_fnv1a16: return "Adreno (TM) 615"; + + case "SDM710"_fnv1a16: + case "SDM712"_fnv1a16: return "Adreno (TM) 616"; + + case "SM7125"_fnv1a16: + case "SM7150-AA"_fnv1a16: + case "SM7150-AB"_fnv1a16: + case "SM7150-AC"_fnv1a16: return "Adreno (TM) 618"; + + case "SM4375"_fnv1a16: + case "SM4350"_fnv1a16: + case "SM6375"_fnv1a16: + case "SM7225"_fnv1a16: + case "SM6375-AC"_fnv1a16: + case "SM4350-AC"_fnv1a16: return "Adreno (TM) 619"; + + case "SM6350"_fnv1a16: return "Adreno (TM) 619L"; + + case "SM7250-AA"_fnv1a16: + case "SM7250-AB"_fnv1a16: + case "SM7250-AC"_fnv1a16: return "Adreno (TM) 620"; + + case "SDM845"_fnv1a16: return "Adreno (TM) 630"; + + case "SM8150"_fnv1a16: + case "SM8150-AC"_fnv1a16: + case "SM8150P"_fnv1a16: return "Adreno (TM) 640"; + + case "SM7350-AB"_fnv1a16: return "Adreno (TM) 642"; + + case "SM7325"_fnv1a16: + case "SM7325-AF"_fnv1a16: + case "SM7325-AE"_fnv1a16: return "Adreno (TM) 642L"; + case "SM7450-AB"_fnv1a16: return "Adreno (TM) 644"; + + case "SM8250"_fnv1a16: + case "SM8250-AB"_fnv1a16: + case "SM8250-AC"_fnv1a16: return "Adreno (TM) 650"; + + case "SM8350"_fnv1a16: + case "SM8350-AC"_fnv1a16: return "Adreno (TM) 660"; + + case "SM7435-AB"_fnv1a16: + case "SM6475-AB"_fnv1a16: + case "SM6450"_fnv1a16: return "Adreno (TM) 710"; + + case "SM7550-AB"_fnv1a16: return "Adreno (TM) 720"; + case "SM7475-AB"_fnv1a16: return "Adreno (TM) 725"; + + case "SM8450"_fnv1a16: + case "SM8475"_fnv1a16: + case "SM8425-100-AC"_fnv1a16: return "Adreno (TM) 730"; + + case "SM7675-AB"_fnv1a16: return "Adreno (TM) 732"; + case "SM8635"_fnv1a16: return "Adreno (TM) 735"; + + case "SM8550-AB"_fnv1a16: + case "SM8550-AC"_fnv1a16: return "Adreno (TM) 740"; + + case "SM8650-AB"_fnv1a16: + case "SM8650-AC"_fnv1a16: return "Adreno (TM) 750"; + + case "SM7635"_fnv1a16: return "Adreno (TM) 810"; + case "SM8750-AB"_fnv1a16: return "Adreno (TM) 830"; + } + + return MAGIC_LINE; +} + GPU::GPU(const std::uint16_t id, std::vector& queried_gpus) { - m_gpu_infos.name = m_gpu_infos.vendor = MAGIC_LINE; + CPU query_cpu; + if (query_cpu.vendor() == "QUALCOMM" || query_cpu.vendor() == "QTI") + { + m_gpu_infos.vendor = "Qualcomm"; + m_gpu_infos.name = detect_adreno(query_cpu.modelname()); + } + else + { + m_gpu_infos.name = m_gpu_infos.vendor = MAGIC_LINE; + } } // clang-format off diff --git a/src/query/unix/cpu.cpp b/src/query/unix/cpu.cpp index e24dde22..33963a4f 100644 --- a/src/query/unix/cpu.cpp +++ b/src/query/unix/cpu.cpp @@ -226,24 +226,23 @@ static CPU::CPU_t get_cpu_infos() #if CF_ANDROID if (ret.name == UNKNOWN) { - std::string vendor; - ret.name = get_android_property("ro.soc.model"); - if (ret.name.empty()) + ret.modelname = get_android_property("ro.soc.model"); + if (ret.modelname.empty()) { - vendor = "MTK"; - ret.name = get_android_property("ro.mediatek.platform"); + ret.vendor = "MTK"; + ret.modelname = get_android_property("ro.mediatek.platform"); } - if (vendor.empty()) + if (ret.vendor.empty()) { - vendor = get_android_property("ro.soc.manufacturer"); - if (vendor.empty()) - vendor = get_android_property("ro.soc.manufacturer"); + ret.vendor = get_android_property("ro.soc.manufacturer"); + if (ret.vendor.empty()) + ret.vendor = get_android_property("ro.product.product.manufacturer"); } - if ((vendor == "QTI" || vendor == "QUALCOMM") && - (hasStart(ret.name, "SM") || hasStart(ret.name, "APQ") || hasStart(ret.name, "MSM") || - hasStart(ret.name, "SDM") || hasStart(ret.name, "QM"))) - ret.name = detect_qualcomm(ret.name); + if ((ret.vendor == "QTI" || ret.vendor == "QUALCOMM") && + (hasStart(ret.modelname, "SM") || hasStart(ret.modelname, "APQ") || hasStart(ret.modelname, "MSM") || + hasStart(ret.modelname, "SDM") || hasStart(ret.modelname, "QM"))) + ret.name = detect_qualcomm(ret.modelname); } #endif @@ -362,6 +361,12 @@ std::string& CPU::name() noexcept std::string& CPU::nproc() noexcept { return m_cpu_infos.nproc; } +std::string& CPU::vendor() noexcept +{ return m_cpu_infos.vendor; } + +std::string& CPU::modelname() noexcept +{ return m_cpu_infos.modelname; } + double& CPU::freq_bios_limit() noexcept { return m_cpu_infos.freq_bios_limit; } From 63a9b9b2006e4082cde45bae2a613ff6a9ad5371 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Wed, 20 Nov 2024 21:45:27 +0100 Subject: [PATCH 07/61] add experimental android widget application yes, I went away for almost a week so I could try to make this revolutionary thing. still very very WIP and could take some time but we going to be there --- Makefile | 32 ++- android/.gitignore | 15 ++ android/.idea/.gitignore | 3 + android/.idea/.name | 1 + android/.idea/compiler.xml | 6 + android/.idea/deploymentTargetSelector.xml | 13 ++ android/.idea/gradle.xml | 20 ++ android/.idea/kotlinc.xml | 6 + android/.idea/migrations.xml | 10 + android/.idea/misc.xml | 9 + android/.idea/runConfigurations.xml | 17 ++ android/.idea/vcs.xml | 6 + android/app/.gitignore | 1 + android/app/build.gradle.kts | 65 ++++++ android/app/proguard-rules.pro | 21 ++ android/app/src/main/AndroidManifest.xml | 49 +++++ android/app/src/main/cpp/CMakeLists.txt | 38 ++++ .../app/src/main/cpp/customfetch_android.cpp | 20 ++ .../customfetch_android/SettingsActivity.kt | 34 ++++ .../customfetch_android/widget/customfetch.kt | 54 +++++ .../widget/customfetchConfigureActivity.kt | 98 ++++++++++ .../example_appwidget_preview.png | Bin 0 -> 3522 bytes .../drawable-v21/app_widget_background.xml | 10 + .../app_widget_inner_view_background.xml | 10 + .../drawable-v24/ic_launcher_foreground.xml | 30 +++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ .../app/src/main/res/layout/customfetch.xml | 18 ++ .../main/res/layout/customfetch_configure.xml | 30 +++ .../src/main/res/layout/settings_activity.xml | 9 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes .../src/main/res/values-night-v31/themes.xml | 10 + .../app/src/main/res/values-night/themes.xml | 16 ++ .../app/src/main/res/values-v21/styles.xml | 14 ++ .../app/src/main/res/values-v31/styles.xml | 16 ++ .../app/src/main/res/values-v31/themes.xml | 11 ++ android/app/src/main/res/values/arrays.xml | 12 ++ android/app/src/main/res/values/attrs.xml | 7 + android/app/src/main/res/values/colors.xml | 14 ++ android/app/src/main/res/values/dimens.xml | 10 + android/app/src/main/res/values/strings.xml | 24 +++ android/app/src/main/res/values/styles.xml | 12 ++ android/app/src/main/res/values/themes.xml | 31 +++ android/app/src/main/res/xml/backup_rules.xml | 13 ++ .../app/src/main/res/xml/customfetch_info.xml | 15 ++ .../main/res/xml/data_extraction_rules.xml | 19 ++ .../app/src/main/res/xml/root_preferences.xml | 35 ++++ .../settings_testing/ExampleUnitTest.kt | 17 ++ android/build.gradle.kts | 5 + android/gradle.properties | 23 +++ android/gradle/libs.versions.toml | 30 +++ android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + android/gradlew | 185 ++++++++++++++++++ android/gradlew.bat | 89 +++++++++ android/settings.gradle.kts | 23 +++ compile_flags.txt | 1 + include/switch_fnv1a.hpp | 18 +- src/display.cpp | 12 +- src/main.cpp | 17 +- src/query/android/system.cpp | 8 +- src/toml++/Makefile | 4 +- src/util.cpp | 11 +- 73 files changed, 1479 insertions(+), 34 deletions(-) create mode 100644 android/.gitignore create mode 100644 android/.idea/.gitignore create mode 100644 android/.idea/.name create mode 100644 android/.idea/compiler.xml create mode 100644 android/.idea/deploymentTargetSelector.xml create mode 100644 android/.idea/gradle.xml create mode 100644 android/.idea/kotlinc.xml create mode 100644 android/.idea/migrations.xml create mode 100644 android/.idea/misc.xml create mode 100644 android/.idea/runConfigurations.xml create mode 100644 android/.idea/vcs.xml create mode 100644 android/app/.gitignore create mode 100644 android/app/build.gradle.kts create mode 100644 android/app/proguard-rules.pro create mode 100644 android/app/src/main/AndroidManifest.xml create mode 100644 android/app/src/main/cpp/CMakeLists.txt create mode 100644 android/app/src/main/cpp/customfetch_android.cpp create mode 100644 android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt create mode 100644 android/app/src/main/java/org/toni/customfetch_android/widget/customfetch.kt create mode 100644 android/app/src/main/java/org/toni/customfetch_android/widget/customfetchConfigureActivity.kt create mode 100644 android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png create mode 100644 android/app/src/main/res/drawable-v21/app_widget_background.xml create mode 100644 android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml create mode 100644 android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 android/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 android/app/src/main/res/layout/customfetch.xml create mode 100644 android/app/src/main/res/layout/customfetch_configure.xml create mode 100644 android/app/src/main/res/layout/settings_activity.xml create mode 100644 android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 android/app/src/main/res/values-night-v31/themes.xml create mode 100644 android/app/src/main/res/values-night/themes.xml create mode 100644 android/app/src/main/res/values-v21/styles.xml create mode 100644 android/app/src/main/res/values-v31/styles.xml create mode 100644 android/app/src/main/res/values-v31/themes.xml create mode 100644 android/app/src/main/res/values/arrays.xml create mode 100644 android/app/src/main/res/values/attrs.xml create mode 100644 android/app/src/main/res/values/colors.xml create mode 100644 android/app/src/main/res/values/dimens.xml create mode 100644 android/app/src/main/res/values/strings.xml create mode 100644 android/app/src/main/res/values/styles.xml create mode 100644 android/app/src/main/res/values/themes.xml create mode 100644 android/app/src/main/res/xml/backup_rules.xml create mode 100644 android/app/src/main/res/xml/customfetch_info.xml create mode 100644 android/app/src/main/res/xml/data_extraction_rules.xml create mode 100644 android/app/src/main/res/xml/root_preferences.xml create mode 100644 android/app/src/test/java/com/example/settings_testing/ExampleUnitTest.kt create mode 100644 android/build.gradle.kts create mode 100644 android/gradle.properties create mode 100644 android/gradle/libs.versions.toml create mode 100644 android/gradle/wrapper/gradle-wrapper.jar create mode 100644 android/gradle/wrapper/gradle-wrapper.properties create mode 100755 android/gradlew create mode 100644 android/gradlew.bat create mode 100644 android/settings.gradle.kts diff --git a/Makefile b/Makefile index 45279b00..b1358452 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -CXX ?= g++ +#CXX ?= g++ +CXX = /home/toni/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang++ PREFIX ?= /usr MANPREFIX ?= $(PREFIX)/share/man APPPREFIX ?= $(PREFIX)/share/applications @@ -6,6 +7,7 @@ VARS ?= DEBUG ?= 1 GUI_MODE ?= 0 +ANDROID_APP ?= 0 VENDOR_TEST ?= 0 DEVICE_TEST ?= 0 @@ -33,13 +35,19 @@ ifeq ($(DEVICE_TEST), 1) VARS += -DDEVICE_TEST=1 endif -ifeq ($(GUI_MODE), 1) +ifeq ($(ANDROID_APP), 1) + VARS += -DANDROID_APP=1 + CXXFLAGS += -static -fPIC + BUILDDIR = build/android +endif + +ifeq ($(GUI_MODE), 1 && !($(ANDROID_APP), 1)) VARS += -DGUI_MODE=1 LDFLAGS += `pkg-config --libs gtkmm-3.0` CXXFLAGS += `pkg-config --cflags gtkmm-3.0` endif -ifeq ($(USE_DCONF), 1) +ifeq ($(USE_DCONF), 1 && !($(ANDROID_APP), 1)) ifeq ($(shell pkg-config --exists glib-2.0 dconf && echo 1), 1) CXXFLAGS += -DUSE_DCONF=1 `pkg-config --cflags glib-2.0 dconf` else @@ -58,24 +66,34 @@ LDFLAGS += -L./$(BUILDDIR)/fmt -lfmt -ldl CXXFLAGS ?= -mtune=generic -march=native CXXFLAGS += -fvisibility=hidden -Iinclude -std=c++20 $(VARS) -DVERSION=\"$(VERSION)\" -DBRANCH=\"$(BRANCH)\" -all: fmt toml $(TARGET) +all: fmt toml $(TARGET) lib$(TARGET).a fmt: ifeq ($(wildcard $(BUILDDIR)/fmt/libfmt.a),) mkdir -p $(BUILDDIR)/fmt - make -C src/fmt BUILDDIR=$(BUILDDIR)/fmt + make -C src/fmt BUILDDIR=$(BUILDDIR)/fmt CXX=$(CXX) endif toml: ifeq ($(wildcard $(BUILDDIR)/toml++/toml.o),) mkdir -p $(BUILDDIR)/toml++ - make -C src/toml++ BUILDDIR=$(BUILDDIR)/toml++ + make -C src/toml++ BUILDDIR=$(BUILDDIR)/toml++ CXX=$(CXX) endif $(TARGET): fmt toml $(OBJ) +ifneq ($(ANDROID_APP), 1) mkdir -p $(BUILDDIR) $(CXX) $(OBJ) $(BUILDDIR)/toml++/toml.o -o $(BUILDDIR)/$(TARGET) $(LDFLAGS) cd $(BUILDDIR)/ && ln -sf $(TARGET) cufetch +endif + +lib$(TARGET).a: fmt toml $(OBJ) +ifeq ($(ANDROID_APP), 1) + mkdir -p $(BUILDDIR) + ar qc $(BUILDDIR)/lib$(TARGET).a $(OBJ) $(BUILDDIR)/toml++/toml.o + ranlib $(BUILDDIR)/lib$(TARGET).a +# android/gradlew build --project-dir=./android +endif dist: ifeq ($(GUI_MODE), 1) @@ -85,7 +103,7 @@ else endif clean: - rm -rf $(BUILDDIR)/$(TARGET) $(OBJ) + rm -rf $(BUILDDIR)/$(TARGET) $(BUILDDIR)/libcustomfetch.a $(OBJ) distclean: rm -rf $(BUILDDIR) ./tests/$(BUILDDIR) $(OBJ) diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/android/.idea/.gitignore b/android/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/android/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/android/.idea/.name b/android/.idea/.name new file mode 100644 index 00000000..f42fe1a8 --- /dev/null +++ b/android/.idea/.name @@ -0,0 +1 @@ +customfetch_android \ No newline at end of file diff --git a/android/.idea/compiler.xml b/android/.idea/compiler.xml new file mode 100644 index 00000000..b86273d9 --- /dev/null +++ b/android/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/.idea/deploymentTargetSelector.xml b/android/.idea/deploymentTargetSelector.xml new file mode 100644 index 00000000..cd921b91 --- /dev/null +++ b/android/.idea/deploymentTargetSelector.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android/.idea/gradle.xml b/android/.idea/gradle.xml new file mode 100644 index 00000000..7b3006b6 --- /dev/null +++ b/android/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/android/.idea/kotlinc.xml b/android/.idea/kotlinc.xml new file mode 100644 index 00000000..148fdd24 --- /dev/null +++ b/android/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/android/.idea/migrations.xml b/android/.idea/migrations.xml new file mode 100644 index 00000000..f8051a6f --- /dev/null +++ b/android/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml new file mode 100644 index 00000000..b2c751a3 --- /dev/null +++ b/android/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/android/.idea/runConfigurations.xml b/android/.idea/runConfigurations.xml new file mode 100644 index 00000000..16660f1d --- /dev/null +++ b/android/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/android/.idea/vcs.xml b/android/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/android/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/app/.gitignore b/android/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/android/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 00000000..98676fce --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,65 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} + +android { + namespace = "org.toni.customfetch_android" + compileSdk = 35 + + defaultConfig { + applicationId = "org.toni.customfetch_android" + minSdk = 26 + targetSdk = 35 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + cppFlags += "-I${rootDir}/../include" // -L${rootDir}/../build/android/fmt -L${rootDir}/../build/android -lcustomfetch -lfmt" + targets("customfetch_android") + } + } + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = "11" + } + buildFeatures { + viewBinding = true + } + externalNativeBuild { + cmake { + path = file("src/main/cpp/CMakeLists.txt") + version = "3.22.1" + } + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + implementation(libs.androidx.constraintlayout) + implementation(libs.androidx.navigation.fragment.ktx) + implementation(libs.androidx.navigation.ui.ktx) + implementation(libs.androidx.preference.ktx) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) +} \ No newline at end of file diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..57bca1dc --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/cpp/CMakeLists.txt b/android/app/src/main/cpp/CMakeLists.txt new file mode 100644 index 00000000..90517f7b --- /dev/null +++ b/android/app/src/main/cpp/CMakeLists.txt @@ -0,0 +1,38 @@ + +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html. +# For more examples on how to use CMake, see https://github.com/android/ndk-samples. + +# Sets the minimum CMake version required for this project. +cmake_minimum_required(VERSION 3.22.1) + +# Declares the project name. The project name can be accessed via ${ PROJECT_NAME}, +# Since this is the top level CMakeLists.txt, the project name is also accessible +# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level +# build script scope). +project("customfetch_android") + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. +# +# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define +# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME} +# is preferred for the same purpose. +# +# In order to load a library into your app from Java/Kotlin, you must call +# System.loadLibrary() and pass the name of the library defined here; +# for GameActivity/NativeActivity derived applications, the same library name must be +# used in the AndroidManifest.xml file. +add_library(${CMAKE_PROJECT_NAME} SHARED + # List C/C++ source files with relative paths to this CMakeLists.txt. + customfetch_android.cpp) + +# Specifies libraries CMake should link to your target library. You +# can link libraries from various origins, such as libraries defined in this +# build script, prebuilt third-party libraries, or Android system libraries. +target_link_libraries(${CMAKE_PROJECT_NAME} + # List libraries link to the target library + android + log) diff --git a/android/app/src/main/cpp/customfetch_android.cpp b/android/app/src/main/cpp/customfetch_android.cpp new file mode 100644 index 00000000..5dbad21a --- /dev/null +++ b/android/app/src/main/cpp/customfetch_android.cpp @@ -0,0 +1,20 @@ +#include + +#include + +#include "query.hpp" + +extern "C" JNIEXPORT jstring JNICALL +Java_org_toni_customfetch_1android_widget_customfetch_idk(JNIEnv* env, + jobject /* this */) { + std::string hello = "Hello from JNI."; + return env->NewStringUTF(hello.c_str()); +} + +extern "C" +JNIEXPORT jstring JNICALL +Java_org_toni_customfetch_1android_widget_customfetchConfigureActivity_idk(JNIEnv *env, jobject thiz) { + /*Query::System system; + return env->NewStringUTF(system.arch().c_str());*/ + return Java_org_toni_customfetch_1android_widget_customfetch_idk(env, thiz); +} \ No newline at end of file diff --git a/android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt b/android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt new file mode 100644 index 00000000..76837eef --- /dev/null +++ b/android/app/src/main/java/org/toni/customfetch_android/SettingsActivity.kt @@ -0,0 +1,34 @@ +package org.toni.customfetch_android + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import androidx.preference.PreferenceFragmentCompat +import org.toni.customfetch_android.databinding.* + +class SettingsActivity : AppCompatActivity() { + + external fun idk(): String? + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.settings_activity) + if (savedInstanceState == null) { + supportFragmentManager + .beginTransaction() + .replace(R.id.settings, SettingsFragment()) + .commit() + } + supportActionBar?.setDisplayHomeAsUpEnabled(true) + } + + class SettingsFragment : PreferenceFragmentCompat() { + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + setPreferencesFromResource(R.xml.root_preferences, rootKey) + } + } + + companion object { + init { + System.loadLibrary("customfetch_android") + } + } +} \ No newline at end of file diff --git a/android/app/src/main/java/org/toni/customfetch_android/widget/customfetch.kt b/android/app/src/main/java/org/toni/customfetch_android/widget/customfetch.kt new file mode 100644 index 00000000..4ea4b21d --- /dev/null +++ b/android/app/src/main/java/org/toni/customfetch_android/widget/customfetch.kt @@ -0,0 +1,54 @@ +package org.toni.customfetch_android.widget + +import android.appwidget.AppWidgetManager +import android.appwidget.AppWidgetProvider +import android.content.Context +import android.widget.RemoteViews +import org.toni.customfetch_android.R + +/** + * Implementation of App Widget functionality. + * App Widget Configuration implemented in [customfetchConfigureActivity] + */ +class customfetch : AppWidgetProvider() { + external fun idk(): String? + override fun onUpdate( + context: Context, + appWidgetManager: AppWidgetManager, + appWidgetIds: IntArray + ) { + // There may be multiple widgets active, so update all of them + for (appWidgetId in appWidgetIds) { + updateAppWidget(context, appWidgetManager, appWidgetId) + } + } + + override fun onDeleted(context: Context, appWidgetIds: IntArray) { + // When the user deletes the widget, delete the preference associated with it. + for (appWidgetId in appWidgetIds) { + deleteTitlePref(context, appWidgetId) + } + } + + override fun onEnabled(context: Context) { + // Enter relevant functionality for when the first widget is created + } + + override fun onDisabled(context: Context) { + // Enter relevant functionality for when the last widget is disabled + } +} + +internal fun updateAppWidget( + context: Context, + appWidgetManager: AppWidgetManager, + appWidgetId: Int +) { + val widgetText = loadTitlePref(context, appWidgetId) + // Construct the RemoteViews object + val views = RemoteViews(context.packageName, R.layout.customfetch) + views.setTextViewText(R.id.appwidget_text, widgetText) + + // Instruct the widget manager to update the widget + appWidgetManager.updateAppWidget(appWidgetId, views) +} \ No newline at end of file diff --git a/android/app/src/main/java/org/toni/customfetch_android/widget/customfetchConfigureActivity.kt b/android/app/src/main/java/org/toni/customfetch_android/widget/customfetchConfigureActivity.kt new file mode 100644 index 00000000..75872877 --- /dev/null +++ b/android/app/src/main/java/org/toni/customfetch_android/widget/customfetchConfigureActivity.kt @@ -0,0 +1,98 @@ +package org.toni.customfetch_android.widget + +import android.app.Activity +import android.appwidget.AppWidgetManager +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.view.View +import android.widget.EditText +import android.widget.TextView +import org.toni.customfetch_android.R +import org.toni.customfetch_android.databinding.CustomfetchConfigureBinding + +/** + * The configuration screen for the [customfetch] AppWidget. + */ +class customfetchConfigureActivity : Activity() { + private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID + private lateinit var appWidgetText: EditText + private lateinit var testView: TextView + private var onClickListener = View.OnClickListener { + val context = this@customfetchConfigureActivity + + // When the button is clicked, store the string locally + val widgetText = appWidgetText.text.toString() + saveTitlePref(context, appWidgetId, widgetText) + + // It is the responsibility of the configuration activity to update the app widget + val appWidgetManager = AppWidgetManager.getInstance(context) + updateAppWidget(context, appWidgetManager, appWidgetId) + + // Make sure we pass back the original appWidgetId + val resultValue = Intent() + resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) + setResult(RESULT_OK, resultValue) + finish() + } + private lateinit var binding: CustomfetchConfigureBinding + + external fun idk(): String? + public override fun onCreate(icicle: Bundle?) { + super.onCreate(icicle) + + // Set the result to CANCELED. This will cause the widget host to cancel + // out of the widget placement if the user presses the back button. + setResult(RESULT_CANCELED) + + binding = CustomfetchConfigureBinding.inflate(layoutInflater) + setContentView(binding.root) + + appWidgetText = binding.appwidgetText + testView = binding.testView + binding.addButton.setOnClickListener(onClickListener) + + // Find the widget id from the intent. + val intent = intent + val extras = intent.extras + if (extras != null) { + appWidgetId = extras.getInt( + AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID + ) + } + + // If this activity was started with an intent without an app widget ID, finish with an error. + if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { + finish() + return + } + + appWidgetText.setText(loadTitlePref(this@customfetchConfigureActivity, appWidgetId)) + testView.text = idk() + } + +} + +private const val PREFS_NAME = "org.toni.customfetch_android.customfetch" +private const val PREF_PREFIX_KEY = "appwidget_" + +// Write the prefix to the SharedPreferences object for this widget +internal fun saveTitlePref(context: Context, appWidgetId: Int, text: String) { + val prefs = context.getSharedPreferences(PREFS_NAME, 0).edit() + prefs.putString(PREF_PREFIX_KEY + appWidgetId, text) + prefs.apply() +} + +// Read the prefix from the SharedPreferences object for this widget. +// If there is no preference saved, get the default from a resource +internal fun loadTitlePref(context: Context, appWidgetId: Int): String { + val prefs = context.getSharedPreferences(PREFS_NAME, 0) + val titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null) + return titleValue ?: context.getString(R.string.appwidget_text) +} + +internal fun deleteTitlePref(context: Context, appWidgetId: Int) { + val prefs = context.getSharedPreferences(PREFS_NAME, 0).edit() + prefs.remove(PREF_PREFIX_KEY + appWidgetId) + prefs.apply() +} \ No newline at end of file diff --git a/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png b/android/app/src/main/res/drawable-nodpi/example_appwidget_preview.png new file mode 100644 index 0000000000000000000000000000000000000000..894b069a4907d258f60b1b2406b90f5a0fe1c35b GIT binary patch literal 3522 zcmaJ^3piA3_a6@xDwm_1J~1d=T*eGD7*t{~G6s#392#aYX)b2QC2|g;(n0D}E^|`S zMRLit5fgHkOAh7IFc`OL+?mN`#$lds_TJBqcXqPd zF27eE1OjbG+uOJTvj{kk%Sr>+x% z-dKicf&VgL23l(Uhm za0C)&0{;8Z0;16gen?jv+rMK0nx$3%lSxBDAfch52BAg zOB5zPOrOHg{*GWnWcboaG$x5k0dFAUeW<}qOD%xue^MaR{(+@1{w@At|m`Dt&2q9Lv6L_Cv9$5E*l zzgN*YfXbvY0;n{w^(h4S5C-o{qHHW2{>uY{L82)PCZ6I;MB7+u0T>1(5&>z2GB&X? zGBiP;PzWd#1v5ig8Cyfm5HJ|b#P$Tj?7OcG)i;<-q%gnx68`IJ`a|E1W+2mm$Tmbe zDTGL{rBlh^zmi6he#`~_L%hFz2|wn7_@OTZAOqRh+W)cD-?*%1F}TtNA!^@$Xq z-|0YO+ud)}1%ag6ogHx~P|nBo_4N||yhO6@-!vwcNXC{{B_L@`-0Qp9>Oce3v0&4iBBlFXuwKa*PX>tiwI*{1(Wpz!G`auxgGBLL-uAf-! z76{uWmh_6aK>90dlBCv&BL)2dZ%3u_dI20mHWybh^l26d+5^Pu{48|m3%7*6hhiCuzC}?d@tpkB%Ja5*BSO6RzzJ)F(!8A;WsgO`>)Toe9%UR z+kH6adFGg!ZSMw3oSE&m*(5&XoZ2RC@4o&)SA?Ka&ba2A!{X`ZnzqtC7qhQc zcbR)|Pt&ot_r94@^2S{)>tZkaBxHG4V z(-xOTCp)!6IbjQ$`#EHE8$?s^+Ag5#i0N(OQH`3~NmI_{L!~}@&ZOS$)Hxk;Ke};F zpi;7HrpQ4eOvWYrvYM_``pAr1>fF+j%T|=8Wc(I!^lmZ|@0xiNWxO*3cp9?tnj;l+ z5h0x^O%bb7nRoxl9(tA9u2zNqjBnWokGxWTDloA;>+A(Jsl?wYlpyMr{gaz2CgIg& zd(~9kgJ0;XcCjpx3rTDrE=-S3nVH%~JB!&?8Jlu)-Uk+y_2IhZj%hxc;rpOncQLwHpn^Wy=y%@0Yp2gD zap+z``_kF^%RlL>y7Nov>LJgBEJ94CxS7zLF1vpw%l|&{n6~Ks+cY$rb%oWMRAIj* z9TH1R44Z$hleKqoMFT5cnMl~fh>2c4X;rY) zs}k72ZH?RVJ5}H-v*ofG$Y3b{Y_KW&z8s8E;d23pn z%evOfdm=5IlwLcaexZtlY;D5VLQcy094uGVJ!$1HIu~`Wk@_cuIHA6PZESlsf{?qs zO3iFeUroDL5oeVnYhwLsaGjGvOI{W>io8)n=?^N{y3B??@ePZ?K%?spdyb46%W;FD z34OCQ^b#rmU}ek9psrNQGMkGbI&~*C-q1L99(zUq3Rx()X0c@?IJ&&rG-8%PYK_BT zioWVRYkGIbx(&bRdvXD?6`WC^{Bwzda2}(c(;-*nZ~6Po4{u8XiLNF*ioaKzz|Ks_fA2lAfZj2#@RD&W8=Ic8TXhtz zH4ySPqp12#TjW$P&gKSr3F9NAX~q?GVB9dgP=z z=~AAO7Zfc2x%Xc#wl79rhmphteq)!~{bMo}q@uCpxB4uj$GtHh>UW*Y`@Km$szVgV zekHhd(d-09_Oy0?AsPAW@iD5Sf}z(~+0G|Dw@$ztzO_aYyoj@=;w6EOm!1P&YIdt%(lZ$xySfS5(>-u>Iw(!y;jb6o@s4CS zpYJ~wq{O-~ibyMYI?74do*wP{u5#veF83tLh4i`oU<1ZE-qDFsP=8`qOhlDTS00+i zuY2BgR~qY8m)rU0hZGkTeXie5R%}EKCZ-l!Xy@UI8<3f&On)5kQkXj;zOVB+{YCwY z0uq}jU$TV@mOmh&4WxGNd~kNpe7;FcHA0xLtkUY{uNI+AX?t>E*txqQ?}&?`S<8r% z`1zGx%qDA-dmcHJA!m96Vlg+|v0dz&gp60C=7_X=$Di1skjBY%YP#J#&rMq62^p&g z)e{tBY6B;0D-0dI9&CPgJuGrkpI7)~KLJTOgDbX-%Q`ajG=9;e{{8r!9&Sju*_XP7 zLw}s(c8`=<-3{wepo!HGY4dD5V?0$_KQ609v`;7dW~~eQ5FhcN&a_F}R4>IoJ|NoGNa5|5PbYeyQ7DPw|>ER*)1m8dQ+n9i{Sh;i?~UqNls^ zXIO7yN`hMZwu6oBWy~YDcHA|^I`Nx$TfH>1{`dD@%u`>NHw1Ou%eRZ-1}ty + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml new file mode 100644 index 00000000..007e2872 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_launcher_background.xml b/android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/layout/customfetch.xml b/android/app/src/main/res/layout/customfetch.xml new file mode 100644 index 00000000..a9e56aa8 --- /dev/null +++ b/android/app/src/main/res/layout/customfetch.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/customfetch_configure.xml b/android/app/src/main/res/layout/customfetch_configure.xml new file mode 100644 index 00000000..7d91cb8b --- /dev/null +++ b/android/app/src/main/res/layout/customfetch_configure.xml @@ -0,0 +1,30 @@ + + + + + + + +