Issue #1053 - Remove MOZ_WIDGET_ANDROID and IDB_MOBILE

pull/24/head
Moonchild 1 year ago committed by roytam1
parent 0ced696351
commit 348c6604be
  1. 3
      dom/apps/AppsUtils.jsm
  2. 5
      dom/apps/moz.build
  3. 10
      dom/audiochannel/AudioChannelService.cpp
  4. 31
      dom/base/ScreenOrientation.cpp
  5. 16
      dom/base/nsGlobalWindow.h
  6. 5
      dom/base/nsPIDOMWindow.h
  7. 36
      dom/events/EventListenerManager.cpp
  8. 6
      dom/events/EventNameList.h
  9. 5
      dom/events/TouchEvent.cpp
  10. 8
      dom/geolocation/nsGeolocation.cpp
  11. 30
      dom/html/HTMLMediaElement.cpp
  12. 6
      dom/html/nsIFormControl.h
  13. 63
      dom/indexedDB/ActorsParent.cpp
  14. 4
      dom/ipc/ContentChild.cpp
  15. 7
      dom/media/Benchmark.cpp
  16. 2
      dom/media/CubebUtils.cpp
  17. 19
      dom/media/MediaPrefs.h
  18. 58
      dom/media/eme/MediaKeySystemAccess.cpp
  19. 11
      dom/media/eme/MediaKeys.cpp
  20. 3
      dom/media/fmp4/MP4Decoder.cpp
  21. 9
      dom/media/mediasource/MediaSource.cpp
  22. 16
      dom/media/platforms/PDMFactory.cpp
  23. 9
      dom/media/webrtc/MediaEngineDefault.cpp
  24. 34
      dom/media/webrtc/MediaEngineWebRTC.cpp
  25. 5
      dom/push/PushService.jsm
  26. 7
      dom/push/moz.build
  27. 9
      dom/webidl/Window.webidl
  28. 48
      dom/workers/ServiceWorkerClients.cpp
  29. 6
      gfx/layers/apz/src/APZCTreeManager.cpp
  30. 7
      gfx/src/DriverCrashGuard.cpp
  31. 7
      gfx/src/nsDeviceContext.cpp
  32. 337
      gfx/thebes/gfxAndroidPlatform.cpp
  33. 80
      gfx/thebes/gfxAndroidPlatform.h
  34. 15
      gfx/thebes/gfxFT2FontList.cpp
  35. 10
      gfx/thebes/gfxHarfBuzzShaper.cpp
  36. 27
      gfx/thebes/gfxPlatform.cpp
  37. 24
      gfx/thebes/moz.build
  38. 15
      media/webrtc/signaling/src/media-conduit/AudioConduit.cpp
  39. 13
      media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
  40. 4
      memory/mozalloc/mozalloc_abort.cpp
  41. 4
      toolkit/components/telemetry/Telemetry.cpp
  42. 44
      toolkit/components/telemetry/TelemetryHistogram.cpp
  43. 4
      toolkit/modules/AppConstants.jsm

@ -84,9 +84,6 @@ function _setAppProperties(aObj, aApp) {
aObj.csp = aApp.csp;
aObj.installOrigin = aApp.installOrigin;
aObj.origin = aApp.origin;
#ifdef MOZ_WIDGET_ANDROID
aObj.apkPackageName = aApp.apkPackageName;
#endif
aObj.receipts = aApp.receipts ? JSON.parse(JSON.stringify(aApp.receipts)) : null;
aObj.installTime = aApp.installTime;
aObj.manifestURL = aApp.manifestURL;

@ -12,10 +12,7 @@ EXTRA_COMPONENTS += [
EXTRA_JS_MODULES += [
'AppsServiceChild.jsm',
'AppsUtils.jsm',
'PermissionsInstaller.jsm',
'PermissionsTable.jsm',
]
EXTRA_PP_JS_MODULES += [
'AppsUtils.jsm',
]

@ -159,16 +159,8 @@ bool
IsEnableAudioCompetingForAllAgents()
{
// In general, the audio competing should only be for audible media and it
// helps user can focus on one media at the same time. However, we hope to
// treat all media as the same in the mobile device. First reason is we have
// media control on fennec and we just want to control one media at once time.
// Second reason is to reduce the bandwidth, avoiding to play any non-audible
// media in background which user doesn't notice about.
#ifdef MOZ_WIDGET_ANDROID
return true;
#else
// helps user can focus on one media at the same time.
return sAudioChannelCompetingAllAgents;
#endif
}
} // anonymous namespace

@ -309,40 +309,9 @@ ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorRes
return nullptr;
}
#if !defined(MOZ_WIDGET_ANDROID)
// User agent does not support locking the screen orientation.
p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return p.forget();
#else
LockPermission perm = GetLockOrientationPermission(true);
if (perm == LOCK_DENIED) {
p->MaybeReject(NS_ERROR_DOM_SECURITY_ERR);
return p.forget();
}
nsCOMPtr<nsIDocShellTreeItem> root;
docShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
nsCOMPtr<nsIDocShell> rootShell(do_QueryInterface(root));
if (!rootShell) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
rootShell->SetOrientationLock(aOrientation);
AbortOrientationPromises(rootShell);
doc->SetOrientationPendingPromise(p);
nsCOMPtr<nsIRunnable> lockOrientationTask =
new LockOrientationTask(this, p, aOrientation, doc,
perm == FULLSCREEN_LOCK_ALLOWED);
aRv = NS_DispatchToMainThread(lockOrientationTask);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
return p.forget();
#endif
}
bool

@ -135,9 +135,6 @@ class TabGroup;
class Timeout;
class U2F;
class WakeLock;
#if defined(MOZ_WIDGET_ANDROID)
class WindowOrientationObserver;
#endif
class Worklet;
namespace cache {
class CacheStorage;
@ -622,11 +619,6 @@ public:
virtual void EnableDeviceSensor(uint32_t aType) override;
virtual void DisableDeviceSensor(uint32_t aType) override;
#if defined(MOZ_WIDGET_ANDROID)
virtual void EnableOrientationChangeListener() override;
virtual void DisableOrientationChangeListener() override;
#endif
virtual void EnableTimeChangeNotifications() override;
virtual void DisableTimeChangeNotifications() override;
@ -884,10 +876,6 @@ public:
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
#if defined(MOZ_WIDGET_ANDROID)
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
#endif
mozilla::dom::Console* GetConsole(mozilla::ErrorResult& aRv);
// https://w3c.github.io/webappsec-secure-contexts/#dom-window-issecurecontext
@ -1915,10 +1903,6 @@ protected:
nsTArray<uint32_t> mEnabledSensors;
#if defined(MOZ_WIDGET_ANDROID)
nsAutoPtr<mozilla::dom::WindowOrientationObserver> mOrientationChangeObserver;
#endif
#ifdef MOZ_WEBSPEECH
// mSpeechSynthesis is only used on inner windows.
RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;

@ -438,11 +438,6 @@ public:
*/
virtual void DisableDeviceSensor(uint32_t aType) = 0;
#if defined(MOZ_WIDGET_ANDROID)
virtual void EnableOrientationChangeListener() = 0;
virtual void DisableOrientationChangeListener() = 0;
#endif
virtual void EnableTimeChangeNotifications() = 0;
virtual void DisableTimeChangeNotifications() = 0;

@ -351,10 +351,6 @@ EventListenerManager::AddEventListenerInternal(
EnableDevice(eDeviceLight);
} else if (aTypeAtom == nsGkAtoms::ondevicemotion) {
EnableDevice(eDeviceMotion);
#if defined(MOZ_WIDGET_ANDROID)
} else if (aTypeAtom == nsGkAtoms::onorientationchange) {
EnableDevice(eOrientationChange);
#endif
} else if (aTypeAtom == nsGkAtoms::ontouchstart ||
aTypeAtom == nsGkAtoms::ontouchend ||
aTypeAtom == nsGkAtoms::ontouchmove ||
@ -480,9 +476,6 @@ EventListenerManager::IsDeviceType(EventMessage aEventMessage)
case eDeviceLight:
case eDeviceProximity:
case eUserProximity:
#if defined(MOZ_WIDGET_ANDROID)
case eOrientationChange:
#endif
return true;
default:
break;
@ -500,21 +493,10 @@ EventListenerManager::EnableDevice(EventMessage aEventMessage)
switch (aEventMessage) {
case eDeviceOrientation:
#ifdef MOZ_WIDGET_ANDROID
// Falls back to SENSOR_ROTATION_VECTOR and SENSOR_ORIENTATION if
// unavailable on device.
window->EnableDeviceSensor(SENSOR_GAME_ROTATION_VECTOR);
#else
window->EnableDeviceSensor(SENSOR_ORIENTATION);
#endif
break;
case eAbsoluteDeviceOrientation:
#ifdef MOZ_WIDGET_ANDROID
// Falls back to SENSOR_ORIENTATION if unavailable on device.
window->EnableDeviceSensor(SENSOR_ROTATION_VECTOR);
#else
window->EnableDeviceSensor(SENSOR_ORIENTATION);
#endif
break;
case eDeviceProximity:
case eUserProximity:
@ -528,11 +510,6 @@ EventListenerManager::EnableDevice(EventMessage aEventMessage)
window->EnableDeviceSensor(SENSOR_LINEAR_ACCELERATION);
window->EnableDeviceSensor(SENSOR_GYROSCOPE);
break;
#if defined(MOZ_WIDGET_ANDROID)
case eOrientationChange:
window->EnableOrientationChangeListener();
break;
#endif
default:
NS_WARNING("Enabling an unknown device sensor.");
break;
@ -549,17 +526,9 @@ EventListenerManager::DisableDevice(EventMessage aEventMessage)
switch (aEventMessage) {
case eDeviceOrientation:
#ifdef MOZ_WIDGET_ANDROID
// Disable all potential fallback sensors.
window->DisableDeviceSensor(SENSOR_GAME_ROTATION_VECTOR);
window->DisableDeviceSensor(SENSOR_ROTATION_VECTOR);
#endif
window->DisableDeviceSensor(SENSOR_ORIENTATION);
break;
case eAbsoluteDeviceOrientation:
#ifdef MOZ_WIDGET_ANDROID
window->DisableDeviceSensor(SENSOR_ROTATION_VECTOR);
#endif
window->DisableDeviceSensor(SENSOR_ORIENTATION);
break;
case eDeviceMotion:
@ -574,11 +543,6 @@ EventListenerManager::DisableDevice(EventMessage aEventMessage)
case eDeviceLight:
window->DisableDeviceSensor(SENSOR_LIGHT);
break;
#if defined(MOZ_WIDGET_ANDROID)
case eOrientationChange:
window->DisableOrientationChangeListener();
break;
#endif
default:
NS_WARNING("Disabling an unknown device sensor.");
break;

@ -566,12 +566,6 @@ WINDOW_EVENT(online,
eOnline,
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
#if defined(MOZ_WIDGET_ANDROID)
WINDOW_EVENT(orientationchange,
eOrientationChange,
EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
#endif
WINDOW_EVENT(pagehide,
ePageHide,
EventNameType_HTMLBodyOrFramesetOnly,

@ -204,10 +204,7 @@ TouchEvent::PrefEnabled(nsIDocShell* aDocShell)
enabled = false;
} else {
if (sPrefCacheValue == 2) {
#if defined(MOZ_WIDGET_ANDROID)
// Touch support is always enabled on B2G and android.
enabled = true;
#elif defined(XP_WIN) || MOZ_WIDGET_GTK == 3
#if defined(XP_WIN) || MOZ_WIDGET_GTK == 3
static bool sDidCheckTouchDeviceSupport = false;
static bool sIsTouchDeviceSupportPresent = false;
// On Windows and GTK3 we auto-detect based on device support.

@ -27,10 +27,6 @@
class nsIPrincipal;
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidLocationProvider.h"
#endif
#ifdef MOZ_GPSD
#include "GpsdLocationProvider.h"
#endif
@ -646,10 +642,6 @@ nsresult nsGeolocationService::Init()
obs->AddObserver(this, "xpcom-shutdown", false);
#ifdef MOZ_WIDGET_ANDROID
mProvider = new AndroidLocationProvider();
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_GPSD
if (Preferences::GetBool("geo.provider.use_gpsd", false)) {

@ -846,28 +846,7 @@ private:
bool CanOwnerPlayUnsupportedTypeMedia() const
{
#if defined(MOZ_WIDGET_ANDROID)
// On Fennec, we will user an external app to open unsupported media types.
if (!Preferences::GetBool("media.openUnsupportedTypeWithExternalApp")) {
return false;
}
if (!mError) {
return false;
}
uint16_t errorCode = mError->Code();
if (errorCode != MEDIA_ERR_SRC_NOT_SUPPORTED) {
return false;
}
// If media doesn't start playing, we don't need to open it.
if (mOwner->Paused()) {
return false;
}
return true;
#endif
// This was only something to check on Android. Stubbed now.
return false;
}
@ -6204,13 +6183,6 @@ HTMLMediaElement::IsAllowedToPlay()
if (!mHasUserInteraction &&
!IsAutoplayEnabled() &&
!EventStateManager::IsHandlingUserInput()) {
#if defined(MOZ_WIDGET_ANDROID)
nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
static_cast<nsIContent*>(this),
NS_LITERAL_STRING("MozAutoplayMediaBlocked"),
false,
false);
#endif
return false;
}

@ -265,12 +265,6 @@ nsIFormControl::IsSingleLineTextControl(bool aExcludePassword, uint32_t aType)
aType == NS_FORM_INPUT_SEARCH ||
aType == NS_FORM_INPUT_TEL ||
aType == NS_FORM_INPUT_URL ||
// TODO: those are temporary until bug 773205 is fixed.
#if defined(MOZ_WIDGET_ANDROID)
// On Android, date/time input appears as a normal text box.
aType == NS_FORM_INPUT_TIME ||
aType == NS_FORM_INPUT_DATE ||
#endif
aType == NS_FORM_INPUT_MONTH ||
aType == NS_FORM_INPUT_WEEK ||
aType == NS_FORM_INPUT_DATETIME_LOCAL ||

@ -121,10 +121,6 @@
LogLevel::Debug, \
_args )
#if defined(MOZ_WIDGET_ANDROID)
#define IDB_MOBILE
#endif
#define BLOB_IMPL_STORED_FILE_IID \
{0x6b505c84, 0x2c60, 0x4ffb, {0x8b, 0x91, 0xfe, 0x22, 0xb1, 0xec, 0x75, 0xe2}}
@ -189,12 +185,7 @@ const int32_t kStorageProgressGranularity = 1000;
// Changing the value here will override the page size of new databases only.
// A journal mode change and VACUUM are needed to change existing databases, so
// the best way to do that is to use the schema version upgrade mechanism.
const uint32_t kSQLitePageSizeOverride =
#ifdef IDB_MOBILE
2048;
#else
4096;
#endif
const uint32_t kSQLitePageSizeOverride = 4096;
static_assert(kSQLitePageSizeOverride == /* mozStorage default */ 0 ||
(kSQLitePageSizeOverride % 2 == 0 &&
@ -2621,25 +2612,6 @@ UpgradeSchemaFrom12_0To13_0(mozIStorageConnection* aConnection,
nsresult rv;
#ifdef IDB_MOBILE
int32_t defaultPageSize;
rv = aConnection->GetDefaultPageSize(&defaultPageSize);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// Enable auto_vacuum mode and update the page size to the platform default.
nsAutoCString upgradeQuery("PRAGMA auto_vacuum = FULL; PRAGMA page_size = ");
upgradeQuery.AppendInt(defaultPageSize);
rv = aConnection->ExecuteSimpleSQL(upgradeQuery);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
*aVacuumNeeded = true;
#endif
rv = aConnection->SetSchemaVersion(MakeSchemaVersion(13, 0));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -3583,15 +3555,9 @@ UpgradeSchemaFrom17_0To18_0Helper::DoUpgradeInternal(
return rv;
}
// Finally, turn on auto_vacuum mode. We use full auto_vacuum mode to reclaim
// disk space on mobile devices (at the cost of some COMMIT speed), and
// incremental auto_vacuum mode on desktop builds.
// Finally, turn on auto_vacuum mode.
rv = aConnection->ExecuteSimpleSQL(
#ifdef IDB_MOBILE
NS_LITERAL_CSTRING("PRAGMA auto_vacuum = FULL;")
#else
NS_LITERAL_CSTRING("PRAGMA auto_vacuum = INCREMENTAL;")
#endif
);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -4223,7 +4189,6 @@ SetDefaultPragmas(mozIStorageConnection* aConnection)
return rv;
}
#ifndef IDB_MOBILE
if (kSQLiteGrowthIncrement) {
// This is just an optimization so ignore the failure if the disk is
// currently too full.
@ -4233,7 +4198,6 @@ SetDefaultPragmas(mozIStorageConnection* aConnection)
return rv;
}
}
#endif // IDB_MOBILE
return NS_OK;
}
@ -4285,13 +4249,6 @@ SetJournalMode(mozIStorageConnection* aConnection)
}
} else {
NS_WARNING("Failed to set WAL mode, falling back to normal journal mode.");
#ifdef IDB_MOBILE
rv = aConnection->ExecuteSimpleSQL(journalModeQueryStart +
NS_LITERAL_CSTRING("truncate"));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
#endif
}
return NS_OK;
@ -4533,14 +4490,7 @@ CreateStorageConnection(nsIFile* aDBFile,
// We have to set the auto_vacuum mode before opening a transaction.
rv = connection->ExecuteSimpleSQL(
#ifdef IDB_MOBILE
// Turn on full auto_vacuum mode to reclaim disk space on mobile
// devices (at the cost of some COMMIT speed).
NS_LITERAL_CSTRING("PRAGMA auto_vacuum = FULL;")
#else
// Turn on incremental auto_vacuum mode on desktop builds.
NS_LITERAL_CSTRING("PRAGMA auto_vacuum = INCREMENTAL;")
#endif
);
if (rv == NS_ERROR_FILE_NO_DEVICE_SPACE) {
// mozstorage translates SQLITE_FULL to NS_ERROR_FILE_NO_DEVICE_SPACE,
@ -21105,14 +21055,6 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
return rv;
}
#ifdef IDB_MOBILE
if (persistenceType == PERSISTENCE_TYPE_PERSISTENT &&
!QuotaManager::IsOriginInternal(origin) &&
!isApp) {
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
#endif
PermissionRequestBase::PermissionValue permission;
if (QuotaManager::IsFirstPromptRequired(persistenceType, origin, isApp)) {
@ -29589,7 +29531,6 @@ FileHelper::SyncCopy(nsIInputStream* aInputStream,
} // namespace dom
} // namespace mozilla
#undef IDB_MOBILE
#undef IDB_DEBUG_LOG
#undef ASSERT_UNLESS_FUZZING
#undef DISABLE_ASSERTS_FOR_FUZZING

@ -130,10 +130,6 @@
#include "PermissionMessageUtils.h"
#if defined(MOZ_WIDGET_ANDROID)
#include "APKOpen.h"
#endif
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid

@ -14,10 +14,7 @@
#include "mozilla/SharedThreadPool.h"
#include "mozilla/dom/ContentChild.h"
#ifndef MOZ_WIDGET_ANDROID
#include "WebMSample.h"
#endif
namespace mozilla {
// Update this version number to force re-running the benchmark. Such as when
@ -34,9 +31,6 @@ VP9Benchmark::IsVP9DecodeFast()
{
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZ_WIDGET_ANDROID
return false;
#else
bool hasPref = Preferences::HasUserValue(sBenchmarkFpsPref);
uint32_t hadRecentUpdate = Preferences::GetUint(sBenchmarkFpsVersionCheck, 0U);
@ -81,7 +75,6 @@ VP9Benchmark::IsVP9DecodeFast()
Preferences::GetUint("media.benchmark.vp9.threshold", 150);
return decodeFps >= threshold;
#endif
}
Benchmark::Benchmark(MediaDataDemuxer* aDemuxer, const Parameters& aParameters)

@ -277,9 +277,7 @@ void InitLibrary()
PrefChanged(PREF_CUBEB_LATENCY_MSG, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY_PLAYBACK);
Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY_MSG);
#ifndef MOZ_WIDGET_ANDROID
NS_DispatchToMainThread(NS_NewRunnableFunction(&InitBrandName));
#endif
}
void ShutdownLibrary()

@ -6,10 +6,6 @@
#ifndef MEDIA_PREFS_H
#define MEDIA_PREFS_H
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
#include "mozilla/Atomics.h"
// First time MediaPrefs::GetSingleton() needs to be called on the main thread,
@ -105,11 +101,6 @@ private:
DECL_MEDIA_PREF("media.eme.enabled", EMEEnabled, bool, false);
DECL_MEDIA_PREF("media.use-blank-decoder", PDMUseBlankDecoder, bool, false);
DECL_MEDIA_PREF("media.gpu-process-decoder", PDMUseGPUDecoder, bool, false);
#ifdef MOZ_WIDGET_ANDROID
DECL_MEDIA_PREF("media.android-media-codec.enabled", PDMAndroidMediaCodecEnabled, bool, false);
DECL_MEDIA_PREF("media.android-media-codec.preferred", PDMAndroidMediaCodecPreferred, bool, false);
DECL_MEDIA_PREF("media.android-remote-codec.enabled", PDMAndroidRemoteCodecEnabled, bool, false);
#endif
#ifdef MOZ_FFMPEG
DECL_MEDIA_PREF("media.ffmpeg.enabled", PDMFFmpegEnabled, bool, true);
DECL_MEDIA_PREF("media.libavcodec.allow-obsolete", LibavcodecAllowObsolete, bool, false);
@ -168,15 +159,7 @@ private:
// Default value functions
static int32_t MediaDecoderLimitDefault()
{
#ifdef MOZ_WIDGET_ANDROID
if (AndroidBridge::Bridge() &&
AndroidBridge::Bridge()->GetAPIVersion() < 18) {
// Older Android versions have broken support for multiple simultaneous
// decoders, see bug 1278574.
return 1;
}
#endif
// Otherwise, set no decoder limit.
// Setting a decoder limit was only necessary for Android; set no decoder limit.
return -1;
}

@ -37,9 +37,6 @@
#include "nsUnicharUtils.h"
#include "mozilla/dom/MediaSource.h"
#include "DecoderTraits.h"
#ifdef MOZ_WIDGET_ANDROID
#include "FennecJNIWrappers.h"
#endif
namespace mozilla {
namespace dom {
@ -104,12 +101,6 @@ HavePluginForKeySystem(const nsCString& aKeySystem)
{
bool havePlugin = HaveGMPFor(NS_LITERAL_CSTRING(GMP_API_DECRYPTOR),
{ aKeySystem });
#ifdef MOZ_WIDGET_ANDROID
// Check if we can use MediaDrm for this keysystem.
if (!havePlugin) {
havePlugin = mozilla::java::MediaDrmProxy::IsSchemeSupported(aKeySystem);
}
#endif
return havePlugin;
}
@ -167,16 +158,6 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
return MediaKeySystemStatus::Cdm_disabled;
}
return EnsureCDMInstalled(aKeySystem, aOutMessage);
#ifdef MOZ_WIDGET_ANDROID
} else if (Preferences::GetBool("media.mediadrm-widevinecdm.visible", false)) {
nsCString keySystem = NS_ConvertUTF16toUTF8(aKeySystem);
bool supported = mozilla::java::MediaDrmProxy::IsSchemeSupported(keySystem);
if (!supported) {
aOutMessage = NS_LITERAL_CSTRING("Widevine CDM is not available");
return MediaKeySystemStatus::Cdm_not_installed;
}
return MediaKeySystemStatus::Available;
#endif
}
}
@ -332,9 +313,6 @@ GetSupportedKeySystems()
widevine.mPersistentState = KeySystemFeatureSupport::Requestable;
widevine.mDistinctiveIdentifier = KeySystemFeatureSupport::Prohibited;
widevine.mSessionTypes.AppendElement(MediaKeySessionType::Temporary);
#ifdef MOZ_WIDGET_ANDROID
widevine.mSessionTypes.AppendElement(MediaKeySessionType::Persistent_license);
#endif
widevine.mAudioRobustness.AppendElement(NS_LITERAL_STRING("SW_SECURE_CRYPTO"));
widevine.mVideoRobustness.AppendElement(NS_LITERAL_STRING("SW_SECURE_DECODE"));
#if defined(XP_WIN)
@ -346,49 +324,13 @@ GetSupportedKeySystems()
if (WMFDecoderModule::HasAAC()) {
widevine.mMP4.SetCanDecrypt(EME_CODEC_AAC);
}
#elif !defined(MOZ_WIDGET_ANDROID)
widevine.mMP4.SetCanDecrypt(EME_CODEC_AAC);
#endif
#if defined(MOZ_WIDGET_ANDROID)
using namespace mozilla::java;
// MediaDrm.isCryptoSchemeSupported only allows passing
// "video/mp4" or "video/webm" for mimetype string.
// See https://developer.android.com/reference/android/media/MediaDrm.html#isCryptoSchemeSupported(java.util.UUID, java.lang.String)
// for more detail.
typedef struct {
const nsCString& mMimeType;
const nsCString& mEMECodecType;
const char16_t* mCodecType;
KeySystemContainerSupport* mSupportType;
} DataForValidation;
DataForValidation validationList[] = {
{ nsCString("video/mp4"), EME_CODEC_H264, MediaDrmProxy::AVC, &widevine.mMP4 },
{ nsCString("audio/mp4"), EME_CODEC_AAC, MediaDrmProxy::AAC, &widevine.mMP4 },
{ nsCString("video/webm"), EME_CODEC_VP8, MediaDrmProxy::VP8, &widevine.mWebM },
{ nsCString("video/webm"), EME_CODEC_VP9, MediaDrmProxy::VP9, &widevine.mWebM},
{ nsCString("audio/webm"), EME_CODEC_VORBIS, MediaDrmProxy::VORBIS, &widevine.mWebM},
{ nsCString("audio/webm"), EME_CODEC_OPUS, MediaDrmProxy::OPUS, &widevine.mWebM},
};
for (const auto& data: validationList) {
if (MediaDrmProxy::IsCryptoSchemeSupported(kEMEKeySystemWidevine,
data.mMimeType)) {
if (MediaDrmProxy::CanDecode(data.mCodecType)) {
data.mSupportType->SetCanDecryptAndDecode(data.mEMECodecType);
} else {
data.mSupportType->SetCanDecrypt(data.mEMECodecType);
}
}
}
#else
widevine.mMP4.SetCanDecryptAndDecode(EME_CODEC_H264);
widevine.mWebM.SetCanDecrypt(EME_CODEC_VORBIS);
widevine.mWebM.SetCanDecrypt(EME_CODEC_OPUS);
widevine.mWebM.SetCanDecryptAndDecode(EME_CODEC_VP8);
widevine.mWebM.SetCanDecryptAndDecode(EME_CODEC_VP9);
#endif
keySystemConfigs.AppendElement(Move(widevine));
}
}

@ -13,9 +13,6 @@
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/UnionTypes.h"
#include "GMPCDMProxy.h"
#ifdef MOZ_WIDGET_ANDROID
#include "mozilla/MediaDrmCDMProxy.h"
#endif
#include "mozilla/EMEUtils.h"
#include "nsContentUtils.h"
#include "nsIScriptObjectPrincipal.h"
@ -330,14 +327,6 @@ already_AddRefed<CDMProxy>
MediaKeys::CreateCDMProxy()
{
RefPtr<CDMProxy> proxy;
#ifdef MOZ_WIDGET_ANDROID
if (IsWidevineKeySystem(mKeySystem)) {
proxy = new MediaDrmCDMProxy(this,
mKeySystem,
mConfig.mDistinctiveIdentifier == MediaKeysRequirement::Required,
mConfig.mPersistentState == MediaKeysRequirement::Required);
} else
#endif
{
proxy = new GMPCDMProxy(this,
mKeySystem,

@ -21,9 +21,6 @@
#ifdef XP_WIN
#include "mozilla/WindowsVersion.h"
#endif
#ifdef MOZ_WIDGET_ANDROID
#include "nsIGfxInfo.h"
#endif
#include "mozilla/layers/LayersTypes.h"
#include "PDMFactory.h"

@ -32,10 +32,6 @@
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/Sprintf.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
struct JSContext;
class JSObject;
@ -72,12 +68,7 @@ IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
DecoderTraits::IsMP4TypeAndEnabled(NS_LITERAL_CSTRING("video/mp4"),
aDiagnostics);
bool hwsupported = gfx::gfxVars::CanUseHardwareVideoDecoding();
#ifdef MOZ_WIDGET_ANDROID
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast() ||
java::HardwareCodecCapabilityUtils::HasHWVP9();
#else
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast();
#endif
}
namespace dom {

@ -19,9 +19,6 @@
#ifdef MOZ_APPLEMEDIA
#include "AppleDecoderModule.h"
#endif
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidDecoderModule.h"
#endif
#include "GMPDecoderModule.h"
#include "mozilla/ClearOnShutdown.h"
@ -359,13 +356,6 @@ PDMFactory::CreatePDMs()
return;
}
#ifdef MOZ_WIDGET_ANDROID
if(MediaPrefs::PDMAndroidMediaCodecPreferred() &&
MediaPrefs::PDMAndroidMediaCodecEnabled()) {
m = new AndroidDecoderModule();
StartupPDM(m);
}
#endif
#ifdef XP_WIN
if (MediaPrefs::PDMWMFEnabled() && IsVistaOrLater() && !IsWin7AndPre2000Compatible()) {
// *Only* use WMF on Vista and later, as if Firefox is run in Windows 95
@ -403,12 +393,6 @@ PDMFactory::CreatePDMs()
m = new AppleDecoderModule();
StartupPDM(m);
#endif
#ifdef MOZ_WIDGET_ANDROID
if(MediaPrefs::PDMAndroidMediaCodecEnabled()){
m = new AndroidDecoderModule();
StartupPDM(m);
}
#endif
m = new AgnosticDecoderModule();
StartupPDM(m);

@ -19,10 +19,6 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsISupportsUtils.h"
#endif
#ifdef MOZ_WEBRTC
#include "YuvStamper.h"
#endif
@ -192,12 +188,7 @@ MediaEngineDefaultVideoSource::Start(SourceMediaStream* aStream, TrackID aID,
mTrackID = aID;
// Start timer for subsequent frames
#if defined(MOZ_WIDGET_ANDROID) && defined(DEBUG)
// emulator debug is very, very slow and has problems dealing with realtime audio inputs
mTimer->InitWithCallback(this, (1000 / mOpts.mFPS)*10, nsITimer::TYPE_REPEATING_SLACK);
#else
mTimer->InitWithCallback(this, 1000 / mOpts.mFPS, nsITimer::TYPE_REPEATING_SLACK);
#endif
mState = kStarted;
return NS_OK;

@ -25,11 +25,6 @@ static mozilla::LazyLogModule sGetUserMediaLog("GetUserMedia");
#include "nsITabSource.h"
#include "MediaTrackConstraints.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidJNIWrapper.h"
#include "AndroidBridge.h"
#endif
#undef LOG
#define LOG(args) MOZ_LOG(sGetUserMediaLog, mozilla::LogLevel::Debug, args)
@ -146,17 +141,6 @@ MediaEngineWebRTC::EnumerateVideoDevices(dom::MediaSourceEnum aMediaSource,
mozilla::camera::CaptureEngine capEngine = mozilla::camera::InvalidEngine;
#ifdef MOZ_WIDGET_ANDROID
// get the JVM
JavaVM* jvm;
JNIEnv* const env = jni::GetEnvForThread();
MOZ_ALWAYS_TRUE(!env->GetJavaVM(&jvm));
if (webrtc::VideoEngine::SetAndroidObjects(jvm) != 0) {
LOG(("VieCapture:SetAndroidObjects Failed"));
return;
}
#endif
bool scaryKind = false; // flag sources with cross-origin exploit potential
switch (aMediaSource) {
@ -289,20 +273,6 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource,
return;
}
#ifdef MOZ_WIDGET_ANDROID
jobject context = mozilla::AndroidBridge::Bridge()->GetGlobalContextRef();
// get the JVM
JavaVM* jvm;
JNIEnv* const env = jni::GetEnvForThread();
MOZ_ALWAYS_TRUE(!env->GetJavaVM(&jvm));
if (webrtc::VoiceEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
LOG(("VoiceEngine:SetAndroidObjects Failed"));
return;
}
#endif
if (!mVoiceEngine) {
mConfig.Set<webrtc::ExtendedFilter>(new webrtc::ExtendedFilter(mExtendedFilter));
mConfig.Set<webrtc::DelayAgnostic>(new webrtc::DelayAgnostic(mDelayAgnostic));
@ -338,12 +308,8 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource,
int nDevices = 0;
mAudioInput->GetNumOfRecordingDevices(nDevices);
int i;
#if defined(MOZ_WIDGET_ANDROID)
i = 0; // Bug 1037025 - let the OS handle defaulting for now on android/b2g
#else
// -1 is "default communications device" depending on OS in webrtc.org code
i = -1;
#endif
for (; i < nDevices; i++) {
// We use constants here because GetRecordingDeviceName takes char[128].
char deviceName[128];

@ -23,14 +23,9 @@ const {
const {PushDB} = Cu.import("resource://gre/modules/PushDB.jsm");
const CONNECTION_PROTOCOLS = (function() {
#ifdef MOZ_WIDGET_ANDROID
const {PushServiceAndroidGCM} = Cu.import("resource://gre/modules/PushServiceAndroidGCM.jsm");
return [PushServiceAndroidGCM];
#else
const {PushServiceWebSocket} = Cu.import("resource://gre/modules/PushServiceWebSocket.jsm");
const {PushServiceHttp2} = Cu.import("resource://gre/modules/PushServiceHttp2.jsm");
return [PushServiceWebSocket, PushServiceHttp2];
#endif
})();
XPCOMUtils.defineLazyServiceGetter(this, "gPushNotifier",

@ -11,13 +11,10 @@ EXTRA_COMPONENTS += [
EXTRA_JS_MODULES += [
'PushCrypto.jsm',
'PushDB.jsm',
'PushServiceHttp2.jsm',
'PushServiceWebSocket.jsm',
]
EXTRA_PP_JS_MODULES += [
'PushRecord.jsm',
'PushService.jsm',
'PushServiceHttp2.jsm',
'PushServiceWebSocket.jsm',
]
MOCHITEST_MANIFESTS += [

@ -365,15 +365,6 @@ Window implements TouchEventHandlers;
Window implements OnErrorEventHandlerForWindow;
#if defined(MOZ_WIDGET_ANDROID)
// https://compat.spec.whatwg.org/#windoworientation-interface
partial interface Window {
[NeedsCallerType]
readonly attribute short orientation;
attribute EventHandler onorientationchange;
};
#endif
#ifdef HAVE_SIDEBAR
// Mozilla extension
partial interface Window {

@ -32,10 +32,6 @@
#include "nsWindowWatcher.h"
#include "nsWeakReference.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::workers;
@ -512,12 +508,6 @@ public:
return NS_OK;
}
#ifdef MOZ_WIDGET_ANDROID
// This fires an intent that will start launching Fennec and foreground it,
// if necessary.
java::GeckoAppShell::OpenWindowForNotification();
#endif
nsCOMPtr<nsPIDOMWindowOuter> window;
nsresult rv = OpenWindow(getter_AddRefs(window));
if (NS_SUCCEEDED(rv)) {
@ -573,44 +563,6 @@ public:
MOZ_ASSERT(NS_SUCCEEDED(rv));
return NS_OK;
}
#ifdef MOZ_WIDGET_ANDROID
else if (rv == NS_ERROR_NOT_AVAILABLE) {
// We couldn't get a browser window, so Fennec must not be running.
// Send an Intent to launch Fennec and wait for "BrowserChrome:Ready"
// to try opening a window again.
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
NS_ENSURE_STATE(os);
WorkerPrivate* workerPrivate = mPromiseProxy->GetWorkerPrivate();
MOZ_ASSERT(workerPrivate);
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (!swm) {
// browser shutdown
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIPrincipal> principal = workerPrivate->GetPrincipal();
MOZ_ASSERT(principal);
RefPtr<ServiceWorkerRegistrationInfo> registration =
swm->GetRegistration(principal, NS_ConvertUTF16toUTF8(mScope));
if (NS_WARN_IF(!registration)) {
return NS_ERROR_FAILURE;
}
RefPtr<ServiceWorkerInfo> serviceWorkerInfo =
registration->GetServiceWorkerInfoById(workerPrivate->ServiceWorkerID());
if (NS_WARN_IF(!serviceWorkerInfo)) {
return NS_ERROR_FAILURE;
}
os->AddObserver(static_cast<nsIObserver*>(serviceWorkerInfo->WorkerPrivate()),
"BrowserChrome:Ready", true);
serviceWorkerInfo->WorkerPrivate()->AddPendingWindow(this);
return NS_OK;
}
#endif
RefPtr<ResolveOpenWindowRunnable> resolveRunnable =
new ResolveOpenWindowRunnable(mPromiseProxy, nullptr, rv);

@ -1854,10 +1854,8 @@ APZCTreeManager::FindRootContentOrRootApzc() const
{
mTreeLock.AssertCurrentThreadOwns();
// Note: this is intended to find the same "root" that would be found
// by AsyncCompositionManager::ApplyAsyncContentTransformToTree inside
// the MOZ_WIDGET_ANDROID block. That is, it should find the RCD node if there
// is one, or the root APZC if there is not.
// Note: this should find the RCD node if there is one, or the root APZC if
// there is not.
// Since BreadthFirstSearch is a pre-order search, we first do a search for
// the RCD, and then if we don't find one, we do a search for the root APZC.
HitTestingTreeNode* resultNode = BreadthFirstSearch<ReverseIterator>(mRootNode.get(),

@ -520,13 +520,6 @@ GLContextCrashGuard::Initialize()
return;
}
#if defined(MOZ_WIDGET_ANDROID)
// Disable the WebGL crash guard on Android - it doesn't use E10S, and
// its drivers will essentially never change, so the crash guard could
// permanently disable WebGL.
return;
#endif
DriverCrashGuard::Initialize();
}

@ -645,13 +645,6 @@ nsDeviceContext::FindScreen(nsIScreen** outScreen)
outScreen);
}
#ifdef MOZ_WIDGET_ANDROID
if (!(*outScreen)) {
nsCOMPtr<nsIScreen> screen = mWidget->GetWidgetScreen();
screen.forget(outScreen);
}
#endif
if (!(*outScreen)) {
mScreenManager->GetPrimaryScreen(outScreen);
}

@ -1,337 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#include "base/basictypes.h"
#include "gfxAndroidPlatform.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/CountingAllocatorBase.h"
#include "mozilla/Preferences.h"
#include "gfx2DGlue.h"
#include "gfxFT2FontList.h"
#include "gfxImageSurface.h"
#include "gfxTextRun.h"
#include "mozilla/dom/ContentChild.h"
#include "nsXULAppAPI.h"
#include "nsIScreen.h"
#include "nsIScreenManager.h"
#include "nsILocaleService.h"
#include "nsServiceManagerUtils.h"
#include "nsUnicodeProperties.h"
#include "gfxPrefs.h"
#include "cairo.h"
#include "VsyncSource.h"
#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_MODULE_H
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
using namespace mozilla::unicode;
static FT_Library gPlatformFTLibrary = nullptr;
class FreetypeReporter final : public nsIMemoryReporter,
public CountingAllocatorBase<FreetypeReporter>
{
private:
~FreetypeReporter() {}
public:
NS_DECL_ISUPPORTS
static void* Malloc(FT_Memory, long size)
{
return CountingMalloc(size);
}
static void Free(FT_Memory, void* p)
{
return CountingFree(p);
}
static void*
Realloc(FT_Memory, long cur_size, long new_size, void* p)
{
return CountingRealloc(p, new_size);
}
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize) override
{
MOZ_COLLECT_REPORT(
"explicit/freetype", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
"Memory used by Freetype.");
return NS_OK;
}
};
NS_IMPL_ISUPPORTS(FreetypeReporter, nsIMemoryReporter)
template<> Atomic<size_t> CountingAllocatorBase<FreetypeReporter>::sAmount(0);
static FT_MemoryRec_ sFreetypeMemoryRecord;
gfxAndroidPlatform::gfxAndroidPlatform()
{
// A custom allocator. It counts allocations, enabling memory reporting.
sFreetypeMemoryRecord.user = nullptr;
sFreetypeMemoryRecord.alloc = FreetypeReporter::Malloc;
sFreetypeMemoryRecord.free = FreetypeReporter::Free;
sFreetypeMemoryRecord.realloc = FreetypeReporter::Realloc;
// These two calls are equivalent to FT_Init_FreeType(), but allow us to
// provide a custom memory allocator.
FT_New_Library(&sFreetypeMemoryRecord, &gPlatformFTLibrary);
FT_Add_Default_Modules(gPlatformFTLibrary);
RegisterStrongMemoryReporter(new FreetypeReporter());
mOffscreenFormat = GetScreenDepth() == 16
? SurfaceFormat::R5G6B5_UINT16
: SurfaceFormat::X8R8G8B8_UINT32;
if (gfxPrefs::AndroidRGB16Force()) {
mOffscreenFormat = SurfaceFormat::R5G6B5_UINT16;
}
}
gfxAndroidPlatform::~gfxAndroidPlatform()
{
FT_Done_Library(gPlatformFTLibrary);
gPlatformFTLibrary = nullptr;
}
already_AddRefed<gfxASurface>
gfxAndroidPlatform::CreateOffscreenSurface(const IntSize& aSize,
gfxImageFormat aFormat)
{
if (!Factory::AllowedSurfaceSize(aSize)) {
return nullptr;
}
RefPtr<gfxASurface> newSurface;
newSurface = new gfxImageSurface(aSize, aFormat);
return newSurface.forget();
}
static bool
IsJapaneseLocale()
{
static bool sInitialized = false;
static bool sIsJapanese = false;
if (!sInitialized) {
sInitialized = true;
do { // to allow 'break' to abandon this block if a call fails
nsresult rv;
nsCOMPtr<nsILocaleService> ls =
do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
break;
}
nsCOMPtr<nsILocale> appLocale;
rv = ls->GetApplicationLocale(getter_AddRefs(appLocale));
if (NS_FAILED(rv)) {
break;
}
nsString localeStr;
rv = appLocale->
GetCategory(NS_LITERAL_STRING(NSILOCALE_MESSAGE), localeStr);
if (NS_FAILED(rv)) {
break;
}
const nsAString& lang = nsDependentSubstring(localeStr, 0, 2);
if (lang.EqualsLiteral("ja")) {
sIsJapanese = true;
}
} while (false);
}
return sIsJapanese;
}
void
gfxAndroidPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
Script aRunScript,