summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-22 19:03:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:51:25 +0200
commitda15aa0fdf5ec769a0973a00d84f9fa090de0b60 (patch)
treec6f5b8197eac51be855aecdae3b5d97207cdf97e
parent867737dd4b650494404a90b8b99ea959f74462ca (diff)
downloadUXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar.gz
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar.lz
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar.xz
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.zip
Issue #1053 - Remove android support from XPCOM
-rw-r--r--xpcom/base/nsConsoleService.cpp47
-rw-r--r--xpcom/base/nsConsoleService.h3
-rw-r--r--xpcom/base/nsDebugImpl.cpp8
-rw-r--r--xpcom/base/nsDumpUtils.cpp60
-rw-r--r--xpcom/base/nsDumpUtils.h10
-rw-r--r--xpcom/base/nsMemoryImpl.cpp35
-rw-r--r--xpcom/base/nsMemoryInfoDumper.cpp12
-rw-r--r--xpcom/base/nsStatusReporterManager.cpp7
-rw-r--r--xpcom/base/nsSystemInfo.cpp117
-rw-r--r--xpcom/base/nsSystemInfo.h10
-rw-r--r--xpcom/base/nsUUIDGenerator.cpp4
-rw-r--r--xpcom/build/BinaryPath.h16
-rw-r--r--xpcom/build/XPCOMInit.cpp2
-rw-r--r--xpcom/build/XREChildData.h3
-rw-r--r--xpcom/components/ManifestParser.cpp30
-rw-r--r--xpcom/glue/FileUtils.cpp12
-rw-r--r--xpcom/glue/nsCRTGlue.cpp19
-rw-r--r--xpcom/glue/standalone/nsXPCOMGlue.cpp2
-rw-r--r--xpcom/io/SpecialSystemDirectory.cpp5
-rw-r--r--xpcom/io/nsLocalFileUnix.cpp56
-rw-r--r--xpcom/io/nsNativeCharsetUtils.cpp4
-rw-r--r--xpcom/io/nsNativeCharsetUtils.h4
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp2
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S6
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp2
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S6
-rw-r--r--xpcom/tests/gtest/TestTArray2.cpp3
-rw-r--r--xpcom/tests/gtest/moz.build3
-rw-r--r--xpcom/threads/ThreadStackHelper.cpp13
-rw-r--r--xpcom/threads/nsThread.h2
30 files changed, 27 insertions, 476 deletions
diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp
index 3862a02c4..fccb8370f 100644
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -26,10 +26,6 @@
#include "mozilla/Preferences.h"
-#if defined(ANDROID)
-#include <android/log.h>
-#include "mozilla/dom/ContentChild.h"
-#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -51,9 +47,6 @@ NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService, nsIObserver)
static bool sLoggingEnabled = true;
static bool sLoggingBuffered = true;
-#if defined(ANDROID)
-static bool sLoggingLogcat = true;
-#endif // defined(ANDROID)
nsConsoleService::MessageElement::~MessageElement()
{
@@ -132,9 +125,6 @@ public:
{
Preferences::AddBoolVarCache(&sLoggingEnabled, "consoleservice.enabled", true);
Preferences::AddBoolVarCache(&sLoggingBuffered, "consoleservice.buffered", true);
-#if defined(ANDROID)
- Preferences::AddBoolVarCache(&sLoggingLogcat, "consoleservice.logcat", true);
-#endif // defined(ANDROID)
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
MOZ_ASSERT(obs);
@@ -238,43 +228,6 @@ nsConsoleService::LogMessageWithMode(nsIConsoleMessage* aMessage,
{
MutexAutoLock lock(mLock);
-#if defined(ANDROID)
- if (sLoggingLogcat && aOutputMode == OutputToLog) {
- nsCString msg;
- aMessage->ToString(msg);
-
- /** Attempt to use the process name as the log tag. */
- mozilla::dom::ContentChild* child =
- mozilla::dom::ContentChild::GetSingleton();
- nsCString appName;
- if (child) {
- child->GetProcessName(appName);
- } else {
- appName = "GeckoConsole";
- }
-
- uint32_t logLevel = 0;
- aMessage->GetLogLevel(&logLevel);
-
- android_LogPriority logPriority = ANDROID_LOG_INFO;
- switch (logLevel) {
- case nsIConsoleMessage::debug:
- logPriority = ANDROID_LOG_DEBUG;
- break;
- case nsIConsoleMessage::info:
- logPriority = ANDROID_LOG_INFO;
- break;
- case nsIConsoleMessage::warn:
- logPriority = ANDROID_LOG_WARN;
- break;
- case nsIConsoleMessage::error:
- logPriority = ANDROID_LOG_ERROR;
- break;
- }
-
- __android_log_print(logPriority, appName.get(), "%s", msg.get());
- }
-#endif
#ifdef XP_WIN
if (IsDebuggerPresent()) {
nsString msg;
diff --git a/xpcom/base/nsConsoleService.h b/xpcom/base/nsConsoleService.h
index 089de8106..0aad5ccf4 100644
--- a/xpcom/base/nsConsoleService.h
+++ b/xpcom/base/nsConsoleService.h
@@ -45,8 +45,7 @@ public:
}
// This is a variant of LogMessage which allows the caller to determine
- // if the message should be output to an OS-specific log. This is used on
- // B2G to control whether the message is logged to the android log or not.
+ // if the message should be output to an OS-specific log.
enum OutputMode {
SuppressLog,
diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp
index 84ba150db..313126e8a 100644
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -19,10 +19,6 @@
#include "prerr.h"
#include "prenv.h"
-#ifdef ANDROID
-#include <android/log.h>
-#endif
-
#ifdef _WIN32
/* for getenv() */
#include <stdlib.h>
@@ -357,10 +353,6 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
}
#endif
-#ifdef ANDROID
- __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", buf.buffer);
-#endif
-
// Write the message to stderr unless it's a warning and MOZ_IGNORE_WARNINGS
// is set.
if (!(PR_GetEnv("MOZ_IGNORE_WARNINGS") && aSeverity == NS_DEBUG_WARNING)) {
diff --git a/xpcom/base/nsDumpUtils.cpp b/xpcom/base/nsDumpUtils.cpp
index c68862d08..bef5b6fda 100644
--- a/xpcom/base/nsDumpUtils.cpp
+++ b/xpcom/base/nsDumpUtils.cpp
@@ -343,12 +343,6 @@ FifoWatcher::OpenFd()
return -1;
}
-#ifdef ANDROID
- // Android runs with a umask, so we need to chmod our fifo to make it
- // world-writable.
- chmod(path.get(), 0666);
-#endif
-
int fd;
do {
// The fifo will block until someone else has written to it. In
@@ -428,23 +422,11 @@ FifoWatcher::OnFileCanReadWithoutBlocking(int aFd)
#endif // XP_UNIX }
-// In Android case, this function will open a file named aFilename under
-// /data/local/tmp/"aFoldername".
-// Otherwise, it will open a file named aFilename under "NS_OS_TEMP_DIR".
+// This will open a file named aFilename under "NS_OS_TEMP_DIR".
/* static */ nsresult
nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
const nsACString& aFoldername, Mode aMode)
{
-#ifdef ANDROID
- // For Android, first try the downloads directory which is world-readable
- // rather than the temp directory which is not.
- if (!*aFile) {
- char* env = PR_GetEnv("DOWNLOADS_DIRECTORY");
- if (env) {
- NS_NewNativeLocalFile(nsCString(env), /* followLinks = */ true, aFile);
- }
- }
-#endif
nsresult rv;
if (!*aFile) {
rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, aFile);
@@ -453,32 +435,6 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
}
}
-#ifdef ANDROID
- // /data/local/tmp is a true tmp directory; anyone can create a file there,
- // but only the user which created the file can remove it. We want non-root
- // users to be able to remove these files, so we write them into a
- // subdirectory of the temp directory and chmod 777 that directory.
- if (aFoldername != EmptyCString()) {
- rv = (*aFile)->AppendNative(aFoldername);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- // It's OK if this fails; that probably just means that the directory
- // already exists.
- Unused << (*aFile)->Create(nsIFile::DIRECTORY_TYPE, 0777);
-
- nsAutoCString dirPath;
- rv = (*aFile)->GetNativePath(dirPath);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR) {
- }
- }
-#endif
-
nsCOMPtr<nsIFile> file(*aFile);
rv = file->AppendNative(aFilename);
@@ -495,19 +451,5 @@ nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
return rv;
}
-#ifdef ANDROID
- // Make this file world-read/writable; the permissions passed to the
- // CreateUnique call above are not sufficient on Android, which runs with a
- // umask.
- nsAutoCString path;
- rv = file->GetNativePath(path);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- while (chmod(path.get(), 0666) == -1 && errno == EINTR) {
- }
-#endif
-
return NS_OK;
}
diff --git a/xpcom/base/nsDumpUtils.h b/xpcom/base/nsDumpUtils.h
index 12a99da18..9bca55927 100644
--- a/xpcom/base/nsDumpUtils.h
+++ b/xpcom/base/nsDumpUtils.h
@@ -19,12 +19,7 @@
#undef LOG
#endif
-#ifdef ANDROID
-#include "android/log.h"
-#define LOG(...) __android_log_print(ANDROID_LOG_INFO, "Gecko:DumpUtils", ## __VA_ARGS__)
-#else
#define LOG(...)
-#endif
#ifdef XP_UNIX // {
@@ -189,9 +184,8 @@ public:
/**
* This function creates a new unique file based on |aFilename| in a
- * world-readable temp directory. This is the system temp directory
- * or, in the case of Android, the downloads directory. If |aFile| is
- * non-null, it is assumed to point to a folder, and that folder is used
+ * world-readable temp directory. This is the system temp directory.
+ * If |aFile| is non-null, it is assumed to point to a folder, and that folder is used
* instead.
*/
static nsresult OpenTempFile(const nsACString& aFilename,
diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp
index 1d1576fbd..b534e42f5 100644
--- a/xpcom/base/nsMemoryImpl.cpp
+++ b/xpcom/base/nsMemoryImpl.cpp
@@ -14,16 +14,6 @@
#include "nsCOMPtr.h"
#include "mozilla/Services.h"
-#ifdef ANDROID
-#include <stdio.h>
-
-// Minimum memory threshold for a device to be considered
-// a low memory platform. This value has be in sync with
-// Java's equivalent threshold, defined in
-// mobile/android/base/util/HardwareUtils.java
-#define LOW_MEMORY_THRESHOLD_KB (384 * 1024)
-#endif
-
static nsMemoryImpl sGlobalMemory;
NS_IMPL_QUERY_INTERFACE(nsMemoryImpl, nsIMemory)
@@ -37,31 +27,8 @@ nsMemoryImpl::HeapMinimize(bool aImmediate)
NS_IMETHODIMP
nsMemoryImpl::IsLowMemoryPlatform(bool* aResult)
{
-#ifdef ANDROID
- static int sLowMemory = -1; // initialize to unknown, lazily evaluate to 0 or 1
- if (sLowMemory == -1) {
- sLowMemory = 0; // assume "not low memory" in case file operations fail
- *aResult = false;
-
- // check if MemTotal from /proc/meminfo is less than LOW_MEMORY_THRESHOLD_KB
- FILE* fd = fopen("/proc/meminfo", "r");
- if (!fd) {
- return NS_OK;
- }
- uint64_t mem = 0;
- int rv = fscanf(fd, "MemTotal: %llu kB", &mem);
- if (fclose(fd)) {
- return NS_OK;
- }
- if (rv != 1) {
- return NS_OK;
- }
- sLowMemory = (mem < LOW_MEMORY_THRESHOLD_KB) ? 1 : 0;
- }
- *aResult = (sLowMemory == 1);
-#else
*aResult = false;
-#endif
+
return NS_OK;
}
diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp
index afb18382d..c2371a1c0 100644
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -576,13 +576,6 @@ public:
return rv;
}
- #ifdef ANDROID
- rv = reportsFinalFile->AppendNative(NS_LITERAL_CSTRING("memory-reports"));
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
- #endif
-
rv = reportsFinalFile->AppendNative(mReportsFilename);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -748,9 +741,8 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier,
nsCOMPtr<nsIFile> reportsTmpFile;
nsresult rv;
- // In Android case, this function will open a file named aFilename under
- // specific folder (/data/local/tmp/memory-reports). Otherwise, it will
- // open a file named aFilename under "NS_OS_TEMP_DIR".
+
+ // This will open a file named aFilename under "NS_OS_TEMP_DIR".
rv = nsDumpUtils::OpenTempFile(NS_LITERAL_CSTRING("incomplete-") +
reportsFinalFilename,
getter_AddRefs(reportsTmpFile),
diff --git a/xpcom/base/nsStatusReporterManager.cpp b/xpcom/base/nsStatusReporterManager.cpp
index 491e7d458..42aa1f98b 100644
--- a/xpcom/base/nsStatusReporterManager.cpp
+++ b/xpcom/base/nsStatusReporterManager.cpp
@@ -226,13 +226,6 @@ nsStatusReporterManager::DumpReports()
return rv;
}
-#ifdef ANDROID
- rv = srFinalFile->AppendNative(NS_LITERAL_CSTRING("status-reports"));
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-#endif
-
rv = srFinalFile->AppendNative(filename);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp
index 4a92a2eb4..f08346a85 100644
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -35,7 +35,7 @@
#include <dlfcn.h>
#endif
-#if defined (XP_LINUX) && !defined (ANDROID)
+#if defined (XP_LINUX)
#include <unistd.h>
#include <fstream>
#include "mozilla/Tokenizer.h"
@@ -45,17 +45,6 @@
#include <string>
#endif
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#include "mozilla/dom/ContentChild.h"
-#endif
-
-#ifdef ANDROID
-extern "C" {
-NS_EXPORT int android_sdk_version;
-}
-#endif
-
#ifdef XP_MACOSX
#include <sys/sysctl.h>
#endif
@@ -67,7 +56,7 @@ NS_EXPORT int android_sdk_version;
// only happens well after that point.
uint32_t nsSystemInfo::gUserUmask = 0;
-#if defined (XP_LINUX) && !defined (ANDROID)
+#ifdef XP_LINUX
static void
SimpleParseKeyValuePairs(const std::string& aFilename,
std::map<nsCString, nsCString>& aKeyValuePairs)
@@ -491,7 +480,7 @@ nsSystemInfo::Init()
}
MOZ_ASSERT(sizeof(sysctlValue32) == len);
-#elif defined (XP_LINUX) && !defined (ANDROID)
+#elif defined(XP_LINUX)
// Get vendor, family, model, stepping, physical cores, L3 cache size
// from /proc/cpuinfo file
{
@@ -727,109 +716,9 @@ nsSystemInfo::Init()
}
#endif
-#ifdef MOZ_WIDGET_ANDROID
- AndroidSystemInfo info;
- if (XRE_IsContentProcess()) {
- dom::ContentChild* child = dom::ContentChild::GetSingleton();
- if (child) {
- child->SendGetAndroidSystemInfo(&info);
- SetupAndroidInfo(info);
- }
- } else {
- GetAndroidSystemInfo(&info);
- SetupAndroidInfo(info);
- }
-#endif
-
return NS_OK;
}
-#ifdef MOZ_WIDGET_ANDROID
-// Prerelease versions of Android use a letter instead of version numbers.
-// Unfortunately this breaks websites due to the user agent.
-// Chrome works around this by hardcoding an Android version when a
-// numeric version can't be obtained. We're doing the same.
-// This version will need to be updated whenever there is a new official
-// Android release.
-// See: https://cs.chromium.org/chromium/src/base/sys_info_android.cc?l=61
-#define DEFAULT_ANDROID_VERSION "6.0.99"
-
-/* static */
-void
-nsSystemInfo::GetAndroidSystemInfo(AndroidSystemInfo* aInfo)
-{
- MOZ_ASSERT(XRE_IsParentProcess());
-
- if (!mozilla::AndroidBridge::Bridge()) {
- aInfo->sdk_version() = 0;
- return;
- }
-
- nsAutoString str;
- if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
- "android/os/Build", "MODEL", str)) {
- aInfo->device() = str;
- }
- if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
- "android/os/Build", "MANUFACTURER", str)) {
- aInfo->manufacturer() = str;
- }
- if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
- "android/os/Build$VERSION", "RELEASE", str)) {
- int major_version;
- int minor_version;
- int bugfix_version;
- int num_read = sscanf(NS_ConvertUTF16toUTF8(str).get(), "%d.%d.%d", &major_version, &minor_version, &bugfix_version);
- if (num_read == 0) {
- aInfo->release_version() = NS_LITERAL_STRING(DEFAULT_ANDROID_VERSION);
- } else {
- aInfo->release_version() = str;
- }
- }
- if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
- "android/os/Build", "HARDWARE", str)) {
- aInfo->hardware() = str;
- }
- int32_t sdk_version;
- if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField(
- "android/os/Build$VERSION", "SDK_INT", &sdk_version)) {
- sdk_version = 0;
- }
- aInfo->sdk_version() = sdk_version;
- aInfo->isTablet() = java::GeckoAppShell::IsTablet();
-}
-
-void
-nsSystemInfo::SetupAndroidInfo(const AndroidSystemInfo& aInfo)
-{
- if (!aInfo.device().IsEmpty()) {
- SetPropertyAsAString(NS_LITERAL_STRING("device"), aInfo.device());
- }
- if (!aInfo.manufacturer().IsEmpty()) {
- SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), aInfo.manufacturer());
- }
- if (!aInfo.release_version().IsEmpty()) {
- SetPropertyAsAString(NS_LITERAL_STRING("release_version"), aInfo.release_version());
- }
- SetPropertyAsBool(NS_LITERAL_STRING("tablet"), aInfo.isTablet());
- // NSPR "version" is the kernel version. For Android we want the Android version.
- // Rename SDK version to version and put the kernel version into kernel_version.
- nsAutoString str;
- nsresult rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), str);
- if (NS_SUCCEEDED(rv)) {
- SetPropertyAsAString(NS_LITERAL_STRING("kernel_version"), str);
- }
- // When AndroidBridge is not available (eg. in xpcshell tests), sdk_version is 0.
- if (aInfo.sdk_version() != 0) {
- android_sdk_version = aInfo.sdk_version();
- if (android_sdk_version >= 8 && !aInfo.hardware().IsEmpty()) {
- SetPropertyAsAString(NS_LITERAL_STRING("hardware"), aInfo.hardware());
- }
- SetPropertyAsInt32(NS_LITERAL_STRING("version"), android_sdk_version);
- }
-}
-#endif // MOZ_WIDGET_ANDROID
-
void
nsSystemInfo::SetInt32Property(const nsAString& aPropertyName,
const int32_t aValue)
diff --git a/xpcom/base/nsSystemInfo.h b/xpcom/base/nsSystemInfo.h
index 5a7ef4424..8e9263d3a 100644
--- a/xpcom/base/nsSystemInfo.h
+++ b/xpcom/base/nsSystemInfo.h
@@ -12,10 +12,6 @@
#include "nsIObserver.h"
#endif // defined(XP_WIN)
-#ifdef MOZ_WIDGET_ANDROID
-#include "mozilla/dom/PContent.h"
-#endif // MOZ_WIDGET_ANDROID
-
class nsSystemInfo final
: public nsHashPropertyBag
#if defined(XP_WIN)
@@ -36,12 +32,6 @@ public:
// See comments above the variable definition and in NS_InitXPCOM2.
static uint32_t gUserUmask;
-#ifdef MOZ_WIDGET_ANDROID
- static void GetAndroidSystemInfo(mozilla::dom::AndroidSystemInfo* aInfo);
- protected:
- void SetupAndroidInfo(const mozilla::dom::AndroidSystemInfo&);
-#endif
-
protected:
void SetInt32Property(const nsAString& aPropertyName,
const int32_t aValue);
diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp
index 254a01322..12fe4ec2e 100644
--- a/xpcom/base/nsUUIDGenerator.cpp
+++ b/xpcom/base/nsUUIDGenerator.cpp
@@ -16,10 +16,6 @@
#include "nsUUIDGenerator.h"
-#ifdef ANDROID
-extern "C" NS_EXPORT void arc4random_buf(void*, size_t);
-#endif
-
using namespace mozilla;
NS_IMPL_ISUPPORTS(nsUUIDGenerator, nsIUUIDGenerator)
diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h
index 53034fcd8..a3ee5a517 100644
--- a/xpcom/build/BinaryPath.h
+++ b/xpcom/build/BinaryPath.h
@@ -84,22 +84,6 @@ private:
return rv;
}
-#elif defined(ANDROID)
- static nsresult Get(const char* argv0, char aResult[MAXPATHLEN])
- {
- // On Android, we use the GRE_HOME variable that is set by the Java
- // bootstrap code.
- const char* greHome = getenv("GRE_HOME");
-
- if (!greHome) {
- return NS_ERROR_FAILURE;
- }
-
- snprintf(aResult, MAXPATHLEN, "%s/%s", greHome, "dummy");
- aResult[MAXPATHLEN - 1] = '\0';
- return NS_OK;
- }
-
#elif defined(XP_UNIX)
static nsresult Get(const char* aArgv0, char aResult[MAXPATHLEN])
{
diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp
index b89f51a98..bb639248c 100644
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -569,13 +569,11 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
return rv;
}
-#ifndef ANDROID
// If the locale hasn't already been setup by our embedder,
// get us out of the "C" locale and into the system
if (strcmp(setlocale(LC_ALL, nullptr), "C") == 0) {
setlocale(LC_ALL, "");
}
-#endif
#if defined(XP_UNIX)
NS_StartupNativeCharsetUtils();
diff --git a/xpcom/build/XREChildData.h b/xpcom/build/XREChildData.h
index c849131d6..7cda74d97 100644
--- a/xpcom/build/XREChildData.h
+++ b/xpcom/build/XREChildData.h
@@ -20,13 +20,10 @@ class GMPLoader;
*/
struct XREChildData
{
-#if !defined(MOZ_WIDGET_ANDROID)
/**
* Used to load the GMP binary.
*/
mozilla::UniquePtr<mozilla::gmp::GMPLoader> gmpLoader;
-#endif
-
};
#endif // XREChildData_h
diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
index 7188c0ec5..b69a204ba 100644
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -21,10 +21,6 @@
#include <gtk/gtk.h>
#endif
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#endif
-
#include "mozilla/Services.h"
#include "nsCRT.h"
@@ -478,9 +474,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
NS_NAMED_LITERAL_STRING(kABI, "abi");
NS_NAMED_LITERAL_STRING(kProcess, "process");
-#if defined(MOZ_WIDGET_ANDROID)
- NS_NAMED_LITERAL_STRING(kTablet, "tablet");
-#endif
NS_NAMED_LITERAL_STRING(kMain, "main");
NS_NAMED_LITERAL_STRING(kContent, "content");
@@ -557,14 +550,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
gtk_major_version,
gtk_minor_version);
-#elif defined(MOZ_WIDGET_ANDROID)
- bool isTablet = false;
- if (mozilla::AndroidBridge::Bridge()) {
- mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
- "RELEASE",
- osVersion);
- isTablet = java::GeckoAppShell::IsTablet();
- }
#endif
if (XRE_IsContentProcess()) {
@@ -665,9 +650,7 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
TriState stOs = eUnspecified;
TriState stABI = eUnspecified;
TriState stProcess = eUnspecified;
-#if defined(MOZ_WIDGET_ANDROID)
- TriState stTablet = eUnspecified;
-#endif
+
int flags = 0;
while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
@@ -685,14 +668,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
continue;
}
-#if defined(MOZ_WIDGET_ANDROID)
- bool tablet = false;
- if (CheckFlag(kTablet, wtoken, tablet)) {
- stTablet = (tablet == isTablet) ? eOK : eBad;
- continue;
- }
-#endif
-
if (directive->contentflags) {
bool flag;
if (CheckFlag(kPlatform, wtoken, flag)) {
@@ -737,9 +712,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
stGeckoVersion == eBad ||
stOs == eBad ||
stOsVersion == eBad ||
-#ifdef MOZ_WIDGET_ANDROID
- stTablet == eBad ||
-#endif
stABI == eBad ||
stProcess == eBad) {
continue;
diff --git a/xpcom/glue/FileUtils.cpp b/xpcom/glue/FileUtils.cpp
index 53fe68708..65a6c1e82 100644
--- a/xpcom/glue/FileUtils.cpp
+++ b/xpcom/glue/FileUtils.cpp
@@ -226,7 +226,7 @@ mozilla::ReadAheadLib(nsIFile* aFile)
return;
}
ReadAheadLib(path.get());
-#elif defined(LINUX) && !defined(ANDROID) || defined(XP_MACOSX)
+#elif defined(LINUX) || defined(XP_MACOSX)
nsAutoCString nativePath;
if (!aFile || NS_FAILED(aFile->GetNativePath(nativePath))) {
return;
@@ -245,7 +245,7 @@ mozilla::ReadAheadFile(nsIFile* aFile, const size_t aOffset,
return;
}
ReadAheadFile(path.get(), aOffset, aCount, aOutFd);
-#elif defined(LINUX) && !defined(ANDROID) || defined(XP_MACOSX)
+#elif defined(LINUX) || defined(XP_MACOSX)
nsAutoCString nativePath;
if (!aFile || NS_FAILED(aFile->GetNativePath(nativePath))) {
return;
@@ -256,7 +256,7 @@ mozilla::ReadAheadFile(nsIFile* aFile, const size_t aOffset,
#endif // !defined(XPCOM_GLUE)
-#if defined(LINUX) && !defined(ANDROID)
+#if defined(LINUX)
static const unsigned int bufsize = 4096;
@@ -382,7 +382,7 @@ mozilla::ReadAhead(mozilla::filedesc_t aFd, const size_t aOffset,
// Restore the file pointer
SetFilePointerEx(aFd, fpOriginal, nullptr, FILE_BEGIN);
-#elif defined(LINUX) && !defined(ANDROID)
+#elif defined(LINUX)
readahead(aFd, aOffset, aCount);
@@ -405,7 +405,7 @@ mozilla::ReadAheadLib(mozilla::pathstr_t aFilePath)
}
#if defined(XP_WIN)
ReadAheadFile(aFilePath);
-#elif defined(LINUX) && !defined(ANDROID)
+#elif defined(LINUX)
int fd = open(aFilePath, O_RDONLY);
if (fd < 0) {
return;
@@ -532,7 +532,7 @@ mozilla::ReadAheadFile(mozilla::pathstr_t aFilePath, const size_t aOffset,
if (!aOutFd) {
CloseHandle(fd);
}
-#elif defined(LINUX) && !defined(ANDROID) || defined(XP_MACOSX) || defined(XP_SOLARIS)
+#elif defined(LINUX) || defined(XP_MACOSX) || defined(XP_SOLARIS)
if (!aFilePath) {
if (aOutFd) {
*aOutFd = -1;
diff --git a/xpcom/glue/nsCRTGlue.cpp b/xpcom/glue/nsCRTGlue.cpp
index 03c77da2b..4cf68df2e 100644
--- a/xpcom/glue/nsCRTGlue.cpp
+++ b/xpcom/glue/nsCRTGlue.cpp
@@ -22,11 +22,6 @@
#include "mozilla/UniquePtr.h"
#endif
-#ifdef ANDROID
-#include <android/log.h>
-#include <unistd.h>
-#endif
-
using namespace mozilla;
const char*
@@ -365,20 +360,6 @@ vprintf_stderr(const char* aFmt, va_list aArgs)
fclose(fp);
}
-
-#elif defined(ANDROID)
-void
-vprintf_stderr(const char* aFmt, va_list aArgs)
-{
- if (sStderrCallback) {
- va_list argsCpy;
- VARARGS_ASSIGN(argsCpy, aArgs);
- sStderrCallback(aFmt, aArgs);
- va_end(argsCpy);
- }
-
- __android_log_vprint(ANDROID_LOG_INFO, "Gecko", aFmt, aArgs);
-}
#else
void
vprintf_stderr(const char* aFmt, va_list aArgs)
diff --git a/xpcom/glue/standalone/nsXPCOMGlue.cpp b/xpcom/glue/standalone/nsXPCOMGlue.cpp
index b657d7050..73cbc179e 100644
--- a/xpcom/glue/standalone/nsXPCOMGlue.cpp
+++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp
@@ -80,7 +80,7 @@ CloseLibHandle(LibHandleType aLibHandle)
#else
#include <dlfcn.h>
-#if defined(MOZ_LINKER) && !defined(ANDROID)
+#ifdef MOZ_LINKER
extern "C" {
NS_HIDDEN __typeof(dlopen) __wrap_dlopen;
NS_HIDDEN __typeof(dlsym) __wrap_dlsym;
diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp
index 158431088..c174b4ac7 100644
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -187,13 +187,8 @@ GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile)
static nsresult
GetUnixHomeDir(nsIFile** aFile)
{
-#if defined(ANDROID)
- // XXX no home dir on android; maybe we should return the sdcard if present?
- return NS_ERROR_FAILURE;
-#else
return NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")),
true, aFile);
-#endif
}
/*
diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
index 06706235d..48f2786a7 100644
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -62,12 +62,6 @@
static nsresult MacErrorMapper(OSErr inErr);
#endif
-#ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
-#include "nsIMIMEService.h"
-#include <linux/magic.h>
-#endif
-
#ifdef MOZ_ENABLE_CONTENTACTION
#include <contentaction/contentaction.h>
#endif
@@ -1064,12 +1058,6 @@ nsLocalFile::Remove(bool aRecursive)
}
rv = file->Remove(aRecursive);
-#ifdef ANDROID
- // See bug 580434 - Bionic gives us just deleted files
- if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
- continue;
- }
-#endif
if (NS_FAILED(rv)) {
return rv;
}
@@ -1193,19 +1181,7 @@ nsLocalFile::SetPermissions(uint32_t aPermissions)
if (chmod(mPath.get(), aPermissions) >= 0) {
return NS_OK;
}
-#if defined(ANDROID) && defined(STATFS)
- // For the time being, this is restricted for use by Android, but we
- // will figure out what to do for all platforms in bug 638503
- struct STATFS sfs;
- if (STATFS(mPath.get(), &sfs) < 0) {
- return NSRESULT_FOR_ERRNO();
- }
- // if this is a FAT file system we can't set file permissions
- if (sfs.f_type == MSDOS_SUPER_MAGIC) {
- return NS_OK;
- }
-#endif
return NSRESULT_FOR_ERRNO();
}
@@ -1237,20 +1213,7 @@ nsLocalFile::SetFileSize(int64_t aFileSize)
{
CHECK_mPath();
-#if defined(ANDROID)
- /* no truncate on bionic */
- int fd = open(mPath.get(), O_WRONLY);
- if (fd == -1) {
- return NSRESULT_FOR_ERRNO();
- }
-
- int ret = ftruncate(fd, (off_t)aFileSize);
- close(fd);
-
- if (ret == -1) {
- return NSRESULT_FOR_ERRNO();
- }
-#elif defined(HAVE_TRUNCATE64)
+#if defined(HAVE_TRUNCATE64)
if (truncate64(mPath.get(), (off64_t)aFileSize) == -1) {
return NSRESULT_FOR_ERRNO();
}
@@ -2013,23 +1976,6 @@ nsLocalFile::Launch()
}
return NS_ERROR_FAILURE;
-#elif defined(MOZ_WIDGET_ANDROID)
- // Try to get a mimetype, if this fails just use the file uri alone
- nsresult rv;
- nsAutoCString type;
- nsCOMPtr<nsIMIMEService> mimeService(do_GetService("@mozilla.org/mime;1", &rv));
- if (NS_SUCCEEDED(rv)) {
- rv = mimeService->GetTypeFromFile(this, type);
- }
-
- nsAutoCString fileUri = NS_LITERAL_CSTRING("file://") + mPath;
- return java::GeckoAppShell::OpenUriExternal(
- NS_ConvertUTF8toUTF16(fileUri),
- NS_ConvertUTF8toUTF16(type),
- EmptyString(),
- EmptyString(),
- EmptyString(),
- EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
#elif defined(MOZ_WIDGET_COCOA)
CFURLRef url;
if (NS_SUCCEEDED(GetCFURL(&url))) {
diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp
index e53307af5..fcc208264 100644
--- a/xpcom/io/nsNativeCharsetUtils.cpp
+++ b/xpcom/io/nsNativeCharsetUtils.cpp
@@ -7,9 +7,9 @@
#include "xpcom-private.h"
//-----------------------------------------------------------------------------
-// XP_MACOSX or ANDROID
+// XP_MACOSX
//-----------------------------------------------------------------------------
-#if defined(XP_MACOSX) || defined(ANDROID)
+#if defined(XP_MACOSX)
#include "nsAString.h"
#include "nsReadableUtils.h"
diff --git a/xpcom/io/nsNativeCharsetUtils.h b/xpcom/io/nsNativeCharsetUtils.h
index 5c1e670d5..c3053a7df 100644
--- a/xpcom/io/nsNativeCharsetUtils.h
+++ b/xpcom/io/nsNativeCharsetUtils.h
@@ -39,13 +39,13 @@ nsresult NS_CopyUnicodeToNative(const nsAString& aInput, nsACString& aOutput);
* a real function. On Mac OS X it's always UTF-8 while on Windows
* and other platforms (e.g. OS2), it's never UTF-8.
*/
-#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(ANDROID)
+#if defined(XP_UNIX) && !defined(XP_MACOSX)
bool NS_IsNativeUTF8();
#else
inline bool
NS_IsNativeUTF8()
{
-#if defined(XP_MACOSX) || defined(ANDROID)
+#if defined(XP_MACOSX)
return true;
#else
return false;
diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
index 4cd5eb47d..ef725e5e3 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
@@ -9,7 +9,7 @@
#include "mozilla/Compiler.h"
-#if !defined(__arm__) && !(defined(LINUX) || defined(ANDROID) || defined(XP_IOS))
+#if !defined(__arm__) && !(defined(LINUX) || defined(XP_IOS))
#error "This code is for Linux/iOS ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent."
#endif
diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S
index 32ff3b356..9fd99faa6 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S
@@ -7,14 +7,8 @@
/* This code is for MIPS using the O32 ABI. */
-#ifdef ANDROID
-#include <asm/regdef.h>
-#include <asm/asm.h>
-#include <machine/asm.h>
-#else
#include <sys/regdef.h>
#include <sys/asm.h>
-#endif
# NARGSAVE is the argument space in the callers frame, including extra
# 'shadowed' space for the argument registers. The minimum of 4
diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp b/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp
index ef4f8514d..78664dfcf 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp
@@ -8,7 +8,7 @@
#include "xptcprivate.h"
#include "xptiprivate.h"
-#if !defined(__arm__) && !(defined(LINUX) || defined(ANDROID) || defined(XP_DARWIN))
+#if !defined(__arm__) && !(defined(LINUX) || defined(XP_DARWIN))
#error "This code is for Linux/iOS ARM only. Please check if it works for you, too.\nDepends strongly on gcc behaviour."
#endif
diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S
index d17301634..ebfba775a 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S
+++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S
@@ -5,14 +5,8 @@
/* This code is for MIPS using the O32 ABI. */
-#ifdef ANDROID
-#include <asm/regdef.h>
-#include <asm/asm.h>
-#include <machine/asm.h>
-#else
#include <sys/regdef.h>
#include <sys/asm.h>
-#endif
# NARGSAVE is the argument space in the callers frame, including extra
# 'shadowed' space for the argument registers. The minimum of 4
diff --git a/xpcom/tests/gtest/TestTArray2.cpp b/xpcom/tests/gtest/TestTArray2.cpp
index 421927104..c932b8faa 100644
--- a/xpcom/tests/gtest/TestTArray2.cpp
+++ b/xpcom/tests/gtest/TestTArray2.cpp
@@ -871,8 +871,6 @@ TEST(TArray, test_swap) {
}
}
-// Bug 1171296: Disabled on andoid due to crashes.
-#if !defined(ANDROID)
TEST(TArray, test_fallible)
{
// Test that FallibleTArray works properly; that is, it never OOMs, but
@@ -909,7 +907,6 @@ TEST(TArray, test_fallible)
ASSERT_TRUE(oomed) << "Didn't OOM or crash? nsTArray::SetCapacity"
"must be lying.";
}
-#endif
TEST(TArray, test_conversion_operator) {
FallibleTArray<int> f;
diff --git a/xpcom/tests/gtest/moz.build b/xpcom/tests/gtest/moz.build
index ac98c2217..4ed242d03 100644
--- a/xpcom/tests/gtest/moz.build
+++ b/xpcom/tests/gtest/moz.build
@@ -48,9 +48,8 @@ UNIFIED_SOURCES += [
'TestXPIDLString.cpp',
]
-if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT') and CONFIG['OS_TARGET'] != 'Android':
+if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT'):
# FIXME bug 523392: TestDeadlockDetector doesn't like Windows
- # Bug 1054249: Doesn't work on Android
UNIFIED_SOURCES += [
'TestDeadlockDetector.cpp',
'TestDeadlockDetectorScalability.cpp',
diff --git a/xpcom/threads/ThreadStackHelper.cpp b/xpcom/threads/ThreadStackHelper.cpp
index 2c0e87986..88a0360ef 100644
--- a/xpcom/threads/ThreadStackHelper.cpp
+++ b/xpcom/threads/ThreadStackHelper.cpp
@@ -46,19 +46,6 @@
#include <pthread.h>
#endif
-#ifdef ANDROID
-#ifndef SYS_gettid
-#define SYS_gettid __NR_gettid
-#endif
-#if defined(__arm__) && !defined(__NR_rt_tgsigqueueinfo)
-// Some NDKs don't define this constant even though the kernel supports it.
-#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
-#endif
-#ifndef SYS_rt_tgsigqueueinfo
-#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#endif
-#endif
-
namespace mozilla {
void
diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h
index 037ef1952..c1b3d2618 100644
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -264,7 +264,7 @@ protected:
bool mCanInvokeJS;
};
-#if defined(XP_UNIX) && !defined(ANDROID) && !defined(DEBUG) && HAVE_UALARM \
+#if defined(XP_UNIX) && !defined(DEBUG) && HAVE_UALARM \
&& defined(_GNU_SOURCE)
# define MOZ_CANARY