Files
DroidDeck/tools/nativeguest/ddnatv-hook.c
T
Kurt Himebauch dc98b6b96a feat: target Android 14 so Play Protect installs DroidDeck without a warning (#2683)
* fix(proot): ship proot in the APK and run it from the native library directory

* fix(native): start rootfs programs through an APK-shipped exec loader where data files may not be executed

* fix(audio): start PulseAudio through the system linker where data files may not be executed

* feat: target Android 14 (SDK 34) so Play Protect installs DroidDeck without a warning

* fix: ask for all-files access on Android 11+, reject unloadable ELFs before exec, keep checking the proot pack

* fix: hand host scripts to the kernel, skip startup launch while all-files Settings is open

* fix: run proot from its add-on pack through Android's linker, so the APK carries no proot

* fix: declare high sampling rate sensors for controller gyro at target 34

* fix: offer the rootfs proot fallback only where Android lets proot exec its loader

* test: install the runtime's proot pack in GameFileSync fixtures
2026-11-16 09:35:16 -05:00

89 lines
2.2 KiB
C

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdint.h>
#include <dlfcn.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <spawn.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <ftw.h>
#include <glob.h>
#include <limits.h>
#include <errno.h>
#include <signal.h>
#include <ucontext.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <sys/un.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <resolv.h>
#include <utime.h>
#include <sys/time.h>
#include <pwd.h>
#include <grp.h>
#include <shadow.h>
#include <pthread.h>
#include <sys/wait.h>
#include <elf.h>
#include <sys/sendfile.h>
#include <sys/mman.h>
#include <sched.h>
#include <time.h>
#include <sys/xattr.h>
#include <fnmatch.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sysmacros.h>
#include <net/if.h>
#include <sys/inotify.h>
#ifndef RENAME_EXCHANGE
#define RENAME_EXCHANGE (1 << 1)
#endif
// The code that is added to static Go programs (gosys/gosys.c), built by scripts/build-gosys.sh. A
// build without it works as before, only without Go support. It is AArch64 code: the 32-bit hook
// has none (a 32-bit phone cannot run 64-bit programs).
#if defined(__has_include) && defined(__LP64__)
#if __has_include("gosys/gosys_blob.h")
#include "gosys/gosys_abi.h"
#include "gosys/gosys_blob.h"
#define DDNATV_HAVE_GOSYS 1
#endif
#endif
// The hook is one translation unit split into parts by topic, in this order (later parts use
// the static functions of earlier ones).
#include "hook/syscalls.c"
#include "hook/paths.c"
#include "hook/hardlinks.c"
#include "hook/signals.c"
#include "hook/setup.c"
#include "hook/files.c"
#include "hook/fileops.c"
#include "hook/identity.c"
#include "hook/privileged.c"
#include "hook/env.c"
#include "hook/exec_probe.c"
#include "hook/static_programs.c"
#include "hook/go_programs.c"
#include "hook/exec.c"
#include "hook/net.c"
#include "hook/sockets.c"
#include "hook/sysv_shm.c"
#include "hook/posix_shm.c"