ohmu
·
2026-10-15
1#pragma once
2
3#include "fastfetch.h"
4
5// The one package name the shell UID owns. android.os.Process.SHELL_UID is a single app UID that
6// owns exactly one package, so a process that cannot derive a package of its own -- a static build
7// pushed to /data/local/tmp is the case that showed up -- can answer with this name and have the
8// system services accept it. See FF_ANDROID_PRIVILEGED_UID_SHELL in common/android/api.h.
9#define FF_ANDROID_SHELL_PACKAGE "com.android.shell"
10
11// Some of the system services take the caller's package name as an argument and check it against the
12// calling UID rather than against the name being real: a name nobody owns, and a real name belonging
13// to another app, are refused exactly like a null one. So it has to be the caller's own name.
14//
15// Whether the name is checked at all depends on the service and the release -- `getConnectionInfo`
16// answered "Package com.termux does not belong to <shell uid>" on one Android 16 device while the
17// same name was accepted on an Android 11 one, and `getWallpaper` refuses a null, empty or foreign
18// name on that Android 16 device -- so passing the real one is what works everywhere.
19//
20// Writes the name into `buffer`, terminator included, and returns whether one was found. `capacity`
21// is the caller's, because the parcel the name ends up in is sized from it.
22[[gnu::nonnull(1), nodiscard]] bool ffAndroidGetOwnPackage(char* buffer, size_t capacity);