commit d3db46b73621b7fe59ae086f4855efc7363144fe
parent 817d33a8d69f67a2ba7baf321508f3613daa2a84
Author: Ryan VanderMeulen <rvandermeulen@mozilla.com>
Date: Thu, 30 Oct 2025 11:50:57 +0000
Bug 1991789 - Remove unnecessary __ANDROID_API__ checks and related code. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D270355
Diffstat:
4 files changed, 3 insertions(+), 92 deletions(-)
diff --git a/mozglue/misc/ConditionVariable_posix.cpp b/mozglue/misc/ConditionVariable_posix.cpp
@@ -20,10 +20,8 @@ using mozilla::TimeDuration;
static const long NanoSecPerSec = 1000000000;
-// Android 4.4 or earlier & macOS 10.12 has the clock functions, but not
-// pthread_condattr_setclock.
-#if defined(HAVE_CLOCK_MONOTONIC) && \
- !(defined(__ANDROID__) && __ANDROID_API__ < 21) && !defined(__APPLE__)
+// macOS has the clock functions, but not pthread_condattr_setclock.
+#if defined(HAVE_CLOCK_MONOTONIC) && !defined(__APPLE__)
# define CV_USE_CLOCK_API
#endif
diff --git a/security/manager/android_stub.h b/security/manager/android_stub.h
@@ -1,31 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* This file allows NSS to build by stubbing out
- * features that aren't provided by Android/Bionic */
-
-#ifndef ANDROID_STUB_H
-#define ANDROID_STUB_H
-
-/* sysinfo is defined but not implemented.
- * we may be able to implement it ourselves. */
-#define _SYS_SYSINFO_H_
-
-#include <sys/cdefs.h>
-#include <sys/resource.h>
-#include <linux/kernel.h>
-#include <unistd.h>
-
-#ifndef ANDROID_VERSION
-# include <android/api-level.h>
-# define ANDROID_VERSION __ANDROID_API__
-#endif
-
-#if ANDROID_VERSION < 21
-# define RTLD_NOLOAD 0
-#endif
-
-#define sysinfo(foo) -1
-
-#endif /* ANDROID_STUB_H */
diff --git a/security/moz.build b/security/moz.build
@@ -176,13 +176,6 @@ if CONFIG["OS_TARGET"] == "WINNT":
"winmm.dll",
]
-if CONFIG["OS_TARGET"] == "Android":
- sandbox_vars["CFLAGS"] = [
- "-include",
- TOPSRCDIR + "/security/manager/android_stub.h",
- ]
- if CONFIG["ANDROID_VERSION"]:
- sandbox_vars["CFLAGS"] += ["-DANDROID_VERSION=" + CONFIG["ANDROID_VERSION"]]
if CONFIG["MOZ_SYSTEM_NSS"]:
sandbox_vars["CXXFLAGS"] = CONFIG["NSS_CFLAGS"]
GYP_DIRS["nss"].sandbox_vars = sandbox_vars
diff --git a/toolkit/crashreporter/bionic_missing_funcs.cpp b/toolkit/crashreporter/bionic_missing_funcs.cpp
@@ -11,11 +11,10 @@
#include "mozilla/Assertions.h"
extern "C" {
-
#if defined(__ANDROID_API__) && (__ANDROID_API__ < 28)
// Bionic introduced support for syncfs only in version 28 (that is
-// Android Pie / 9). Since GeckoView is built with version 21, those functions
+// Android Pie / 9). Since GeckoView is built with version 26, those functions
// aren't defined, but nix needs them and the crash helper relies on nix. These
// functions should never be called in practice hence we implement them only to
// satisfy nix linking requirements but we crash if we accidentally enter them.
@@ -26,52 +25,4 @@ int syncfs(int fd) {
}
#endif // __ANDROID_API__ && (__ANDROID_API__ < 28)
-
-#if defined(__ANDROID_API__) && (__ANDROID_API__ < 24)
-
-// Bionic introduced support for getgrgid_r() and getgrnam_r() only in version
-// 24 (that is Android Nougat / 7.0). Since GeckoView is built with version 21,
-// those functions aren't defined, but the nix crate needs them and
-// minidump-writer relies on nix. These functions should never be called in
-// practice hence we implement them only to satisfy nix linking requirements
-// but we crash if we accidentally enter them.
-
-int getgrgid_r(gid_t gid, struct group* grp, char* buf, size_t buflen,
- struct group** result) {
- MOZ_CRASH("getgrgid_r() is not available");
- return EPERM;
-}
-
-int getgrnam_r(const char* name, struct group* grp, char* buf, size_t buflen,
- struct group** result) {
- MOZ_CRASH("getgrnam_r() is not available");
- return EPERM;
-}
-
-#endif // __ANDROID_API__ && (__ANDROID_API__ < 24)
-
-#if defined(__ANDROID_API__) && (__ANDROID_API__ < 23)
-
-// Bionic introduced support for process_vm_readv() and process_vm_writev() only
-// in version 23 (that is Android Marshmallow / 6.0). Since GeckoView is built
-// on version 21, those functions aren't defined, but nix needs them and
-// minidump-writer actually calls them.
-
-ssize_t process_vm_readv(pid_t pid, const struct iovec* local_iov,
- unsigned long int liovcnt,
- const struct iovec* remote_iov,
- unsigned long int riovcnt, unsigned long int flags) {
- return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov,
- riovcnt, flags);
-}
-
-ssize_t process_vm_writev(pid_t pid, const struct iovec* local_iov,
- unsigned long int liovcnt,
- const struct iovec* remote_iov,
- unsigned long int riovcnt, unsigned long int flags) {
- return syscall(__NR_process_vm_writev, pid, local_iov, liovcnt, remote_iov,
- riovcnt, flags);
-}
-
-#endif // defined(__ANDROID_API__) && (__ANDROID_API__ < 23)
}