Issue #1053 - Remove android support from XPCOM

This commit is contained in:
Matt A. Tobin 2020-02-22 19:03:00 -05:00 committed by Roy Tam
commit 26403f20ac
30 changed files with 27 additions and 476 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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)) {

View file

@ -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;
}

View file

@ -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,

View file

@ -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;
}

View file

@ -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),

View file

@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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])
{

View file

@ -570,13 +570,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();

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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)

View file

@ -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;

View file

@ -220,13 +220,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
}
/*

View file

@ -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))) {

View file

@ -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"

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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',

View file

@ -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

View file

@ -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