jstring string;
Lisp_Object language, country, script, variant;
const char *data;
+ FILE *fd;
+ char *line;
+ size_t size;
+ long pid;
/* Find the Locale class. */
/* Set Vandroid_os_language. */
Vandroid_os_language = list4 (language, country, script, variant);
+
+ /* Detect whether Emacs is running under libloader.so or another
+ process tracing mechanism, and disable `android_use_exec_loader' if
+ so, leaving subprocesses started by Emacs to the care of that
+ loader instance. */
+
+ if (android_get_current_api_level () >= 29) /* Q */
+ {
+ fd = fopen ("/proc/self/status", "r");
+ if (!fd)
+ return;
+
+ line = NULL;
+ while (getline (&line, &size, fd) != -1)
+ {
+ if (strncmp (line, "TracerPid:", sizeof "TracerPid:" - 1))
+ continue;
+
+ pid = atol (line + sizeof "TracerPid:" - 1);
+
+ if (pid)
+ android_use_exec_loader = false;
+
+ break;
+ }
+
+ free (line);
+ fclose (fd);
+ }
}
#endif /* ANDROID_STUBIFY */