summaryrefslogtreecommitdiffstats
path: root/xpcom/base
diff options
context:
space:
mode:
Diffstat (limited to 'xpcom/base')
-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
11 files changed, 10 insertions, 303 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)