diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f90e155..0d4705542 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Features: * Added battery temperature, remaining time and charger type (AC / USB / wireless) detection on Android. (Battery, Android) * Added media detection on Android when fastfetch runs as an app UID. (Media, Android) * Requires `Notification access` permission +* Added app display-name detection on Android, so the media module names the player the way the app names itself instead of by its package name, and the terminal module reports the label Termux is installed under. (Media, Terminal, Android) * Performance improvements & internal cleanups * Added Finnish language support. (General) * Added pkgsrc package detection on macOS. (#2627, Packages, Apple) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 76e28db8c..e5ff41442 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -1,11 +1,16 @@ #include "terminalshell.h" #include "common/FFcache.h" +#include "common/debug.h" #include "common/io.h" #include "common/parsing.h" #include "common/processing.h" #include "common/thread.h" #include "common/strutil.h" +#ifdef __ANDROID__ + #include "common/android/applabel.h" +#endif + #include #include #include @@ -324,8 +329,18 @@ static void setTerminalInfoDetails(FFTerminalResult* result) { #if defined(__ANDROID__) - else if (ffStrbufEqualS(&result->processName, "com.termux")) + else if (ffStrbufEqualS(&result->processName, "com.termux")) { + // The app is installed under a label rather than under its package name, and the label is + // what every screen the user sees calls it -- "Termux:Launcher" on the test device, not + // "Termux". The package name is the fallback for a build whose label cannot be read, which + // includes an app whose label is a literal string in its manifest rather than a resource + // reference; see common/android/applabel.h for what that read costs and when it fails. ffStrbufInitStatic(&result->prettyName, "Termux"); + const char* labelError = ffAndroidGetAppLabel("com.termux", &result->prettyName); + if (labelError != nullptr) { + FF_DEBUG("The label of com.termux could not be resolved: %s", labelError); + } + } #elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__GNU__)