diff options
author | Moonchild <moonchild@palemoon.org> | 2021-10-14 23:35:18 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-01 15:22:15 +0200 |
commit | 39f9ab375b2bfd9e46df9695b78870cf1e9cf3c6 (patch) | |
tree | 522ad2b33de883f03a53ffa17e4d74202bcf762a | |
parent | 28a3cd1028612b3b577768519d11fa6fbcda6f09 (diff) | |
download | uxp-39f9ab375b2bfd9e46df9695b78870cf1e9cf3c6.tar.gz |
Issue #1053 - Remove /dom/system/android and dependent modules,
as well as robocop.
70 files changed, 100 insertions, 3109 deletions
diff --git a/accessible/jsat/OutputGenerator.jsm b/accessible/jsat/OutputGenerator.jsm index 36b43a5695..24a0769103 100644 --- a/accessible/jsat/OutputGenerator.jsm +++ b/accessible/jsat/OutputGenerator.jsm @@ -786,7 +786,7 @@ this.UtteranceGenerator = { // jshint ignore:line // This is because we expose the checked information on the node itself. // XXX: this means the checked state is always appended to the end, // regardless of the utterance ordering preference. - if ((Utils.AndroidSdkVersion < 16 || Utils.MozBuildApp === 'browser') && + if (Utils.MozBuildApp === 'browser' && aState.contains(States.CHECKABLE)) { let checked = aState.contains(States.CHECKED); let statetr; diff --git a/accessible/jsat/PointerAdapter.jsm b/accessible/jsat/PointerAdapter.jsm index 1fb77646bf..1f19974fc8 100644 --- a/accessible/jsat/PointerAdapter.jsm +++ b/accessible/jsat/PointerAdapter.jsm @@ -39,13 +39,6 @@ var PointerRelay = { // jshint ignore:line delete this._eventsOfInterest; switch (Utils.widgetToolkit) { - case 'android': - this._eventsOfInterest = { - 'touchstart' : true, - 'touchmove' : true, - 'touchend' : true }; - break; - default: // Desktop. this._eventsOfInterest = { @@ -110,11 +103,6 @@ var PointerRelay = { // jshint ignore:line target: aEvent.target }]; - if (Utils.widgetToolkit === 'android' && - changedTouches.length === 1 && changedTouches[0].identifier === 1) { - return; - } - if (changedTouches.length === 1 && changedTouches[0].identifier === SYNTH_ID) { return; diff --git a/accessible/jsat/Presentation.jsm b/accessible/jsat/Presentation.jsm index bd1ef96ca5..53e79187ca 100644 --- a/accessible/jsat/Presentation.jsm +++ b/accessible/jsat/Presentation.jsm @@ -257,11 +257,8 @@ AndroidPresenter.prototype.pivotChanged = let androidEvents = []; - let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT && - Utils.AndroidSdkVersion >= 14); - let focusEventType = (Utils.AndroidSdkVersion >= 16) ? - this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED : - this.ANDROID_VIEW_FOCUSED; + let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT); + let focusEventType = this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED; if (isExploreByTouch) { // This isn't really used by TalkBack so this is a half-hearted attempt @@ -270,25 +267,21 @@ AndroidPresenter.prototype.pivotChanged = } let brailleOutput = {}; - if (Utils.AndroidSdkVersion >= 16) { - if (!this._braillePresenter) { - this._braillePresenter = new BraillePresenter(); - } - brailleOutput = this._braillePresenter.pivotChanged(aContext, aReason). - details; + if (!this._braillePresenter) { + this._braillePresenter = new BraillePresenter(); } + brailleOutput = this._braillePresenter.pivotChanged(aContext, aReason). + details; if (aReason === Ci.nsIAccessiblePivot.REASON_TEXT) { - if (Utils.AndroidSdkVersion >= 16) { - let adjustedText = aContext.textAndAdjustedOffsets; - - androidEvents.push({ - eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, - text: [adjustedText.text], - fromIndex: adjustedText.startOffset, - toIndex: adjustedText.endOffset - }); - } + let adjustedText = aContext.textAndAdjustedOffsets; + + androidEvents.push({ + eventType: this.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, + text: [adjustedText.text], + fromIndex: adjustedText.startOffset, + toIndex: adjustedText.endOffset + }); } else { let state = Utils.getState(aContext.accessible); androidEvents.push({eventType: (isExploreByTouch) ? @@ -371,7 +364,7 @@ AndroidPresenter.prototype.textSelectionChanged = aOldEnd, aIsFromUserInput) { let androidEvents = []; - if (Utils.AndroidSdkVersion >= 14 && !aIsFromUserInput) { + if (!aIsFromUserInput) { if (!this._braillePresenter) { this._braillePresenter = new BraillePresenter(); } @@ -388,7 +381,7 @@ AndroidPresenter.prototype.textSelectionChanged = }); } - if (Utils.AndroidSdkVersion >= 16 && aIsFromUserInput) { + if (aIsFromUserInput) { let [from, to] = aOldStart < aStart ? [aOldStart, aStart] : [aStart, aOldStart]; androidEvents.push({ @@ -407,10 +400,6 @@ AndroidPresenter.prototype.textSelectionChanged = AndroidPresenter.prototype.viewportChanged = function AndroidPresenter_viewportChanged(aWindow, aCurrentContext) { - if (Utils.AndroidSdkVersion < 14) { - return null; - } - let events = [{ eventType: this.ANDROID_VIEW_SCROLLED, text: [], @@ -420,7 +409,7 @@ AndroidPresenter.prototype.viewportChanged = maxScrollY: aWindow.scrollMaxY }]; - if (Utils.AndroidSdkVersion >= 16 && aCurrentContext) { + if (aCurrentContext) { let currentAcc = aCurrentContext.accessibleForBounds; if (Utils.isAliveAndVisible(currentAcc)) { events.push({ @@ -447,8 +436,7 @@ AndroidPresenter.prototype.announce = return { type: this.type, details: [{ - eventType: (Utils.AndroidSdkVersion >= 16) ? - this.ANDROID_ANNOUNCEMENT : this.ANDROID_VIEW_TEXT_CHANGED, + eventType: this.ANDROID_ANNOUNCEMENT, text: [localizedAnnouncement], addedCount: localizedAnnouncement.length, removedCount: 0, diff --git a/accessible/jsat/Utils.jsm b/accessible/jsat/Utils.jsm index 64a4150583..d884ec45d0 100644 --- a/accessible/jsat/Utils.jsm +++ b/accessible/jsat/Utils.jsm @@ -109,35 +109,13 @@ this.Utils = { // jshint ignore:line return this._ScriptName; }, - get AndroidSdkVersion() { - if (!this._AndroidSdkVersion) { - if (Services.appinfo.OS == 'Android') { - this._AndroidSdkVersion = Services.sysinfo.getPropertyAsInt32( - 'version'); - } else { - // Most useful in desktop debugging. - this._AndroidSdkVersion = 16; - } - } - return this._AndroidSdkVersion; - }, - - set AndroidSdkVersion(value) { - // When we want to mimic another version. - this._AndroidSdkVersion = value; - }, - get BrowserApp() { if (!this.win) { return null; } switch (this.MozBuildApp) { - case 'mobile/android': - return this.win.BrowserApp; case 'browser': return this.win.gBrowser; - case 'b2g': - return this.win.shell; default: return null; } @@ -147,9 +125,6 @@ this.Utils = { // jshint ignore:line if (!this.BrowserApp) { return null; } - if (this.MozBuildApp == 'b2g') { - return this.BrowserApp.contentBrowser; - } return this.BrowserApp.selectedBrowser; }, diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index 88dd4af888..5cdf52fb65 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -308,10 +308,7 @@ def split_triplet(triplet): # mix of uname and config.guess output, while we now only use the latter, # which presumably has a cleaner and leaner output. Let's refine later. os = os.replace('/', '_') - if 'android' in os: - canonical_os = 'Android' - canonical_kernel = 'Linux' - elif os.startswith('linux'): + if os.startswith('linux'): canonical_os = 'GNU' canonical_kernel = 'Linux' elif os.startswith('kfreebsd') and os.endswith('-gnu'): diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 9a684eaf67..5c8abb974a 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -165,9 +165,8 @@ def toolchain_prefix(value, target, host, cross_compiling): @depends(toolchain_prefix, target) def first_toolchain_prefix(toolchain_prefix, target): # Pass TOOLCHAIN_PREFIX down to the build system if it was given from the - # command line/environment (in which case there's only one value in the tuple), - # or when cross-compiling for Android. - if toolchain_prefix and (target.os == 'Android' or len(toolchain_prefix) == 1): + # command line/environment (in which case there's only one value in the tuple). + if toolchain_prefix and (len(toolchain_prefix) == 1): return toolchain_prefix[0] set_config('TOOLCHAIN_PREFIX', first_toolchain_prefix) @@ -840,10 +839,9 @@ def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags): set_config('MOZ_DEBUG_FLAGS', debug_flags) add_old_configure_assignment('MOZ_DEBUG_FLAGS', debug_flags) -# Some standard library headers (notably bionic on Android) declare standard -# functions (e.g. getchar()) and also #define macros for those standard -# functions. libc++ deals with this by doing something like the following -# (explanatory comments added): +# Some standard library headers declare standard functions (e.g. getchar()) and +# also #define macros for those standard functions. libc++ deals with this by +# doing something like the following (explanatory comments added): # # #ifdef FUNC # // Capture the definition of FUNC. @@ -878,7 +876,7 @@ add_old_configure_assignment('MOZ_DEBUG_FLAGS', debug_flags) # effectively does the same thing we are doing here. @depends(c_compiler, target) def libcxx_inline_visibility(c_compiler, target): - if c_compiler.type == 'clang' and target.os == 'Android': + if c_compiler.type == 'clang': return '' set_define('_LIBCPP_INLINE_VISIBILITY', libcxx_inline_visibility) diff --git a/devtools/shared/webconsole/moz.build b/devtools/shared/webconsole/moz.build index a5ed01498a..29cff60656 100644 --- a/devtools/shared/webconsole/moz.build +++ b/devtools/shared/webconsole/moz.build @@ -3,9 +3,8 @@ # 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/. -if CONFIG['OS_TARGET'] != 'Android': - MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] - XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] DevToolsModules( 'client.js', diff --git a/dom/gamepad/android/AndroidGamepad.cpp b/dom/gamepad/android/AndroidGamepad.cpp deleted file mode 100644 index 889250f989..0000000000 --- a/dom/gamepad/android/AndroidGamepad.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "GeneratedJNIWrappers.h" -#include "GeneratedJNINatives.h" -#include "nsThreadUtils.h" -#include "mozilla/dom/Gamepad.h" - -namespace mozilla { -namespace dom { - -class AndroidGamepadManager final - : public java::AndroidGamepadManager::Natives<AndroidGamepadManager> -{ - AndroidGamepadManager() = delete; - -public: - static void - OnGamepadChange(int32_t aID, bool aAdded) - { - RefPtr<GamepadPlatformService> service = - GamepadPlatformService::GetParentService(); - if (!service) { - return; - } - - if (aAdded) { - const int svc_id = service->AddGamepad( - "android", GamepadMappingType::Standard, - kStandardGamepadButtons, kStandardGamepadAxes); - java::AndroidGamepadManager::OnGamepadAdded(aID, svc_id); - - } else { - service->RemoveGamepad(aID); - } - } - - static void - OnButtonChange(int32_t aID, int32_t aButton, bool aPressed, float aValue) - { - RefPtr<GamepadPlatformService> service = - GamepadPlatformService::GetParentService(); - if (!service) { - return; - } - - service->NewButtonEvent(aID, aButton, aPressed, aValue); - } - - static void - OnAxisChange(int32_t aID, jni::BooleanArray::Param aValid, - jni::FloatArray::Param aValues) - { - RefPtr<GamepadPlatformService> service = - GamepadPlatformService::GetParentService(); - if (!service) { - return; - } - - const auto& valid = aValid->GetElements(); - const auto& values = aValues->GetElements(); - MOZ_ASSERT(valid.Length() == values.Length()); - - for (size_t i = 0; i < values.Length(); i++) { - service->NewAxisMoveEvent(aID, i, values[i]); - } - } -}; - -void StartGamepadMonitoring() -{ - AndroidGamepadManager::Init(); - java::AndroidGamepadManager::Start(); -} - -void StopGamepadMonitoring() -{ - java::AndroidGamepadManager::Stop(); -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/gamepad/moz.build b/dom/gamepad/moz.build index 15205e4c83..cee84f4290 100644 --- a/dom/gamepad/moz.build +++ b/dom/gamepad/moz.build @@ -56,10 +56,6 @@ if CONFIG['MOZ_GAMEPAD']: SOURCES += [ 'linux/LinuxGamepad.cpp' ] - elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android': - SOURCES += [ - 'android/AndroidGamepad.cpp' - ] LOCAL_INCLUDES += [ 'ipc', diff --git a/dom/geolocation/moz.build b/dom/geolocation/moz.build index d8ecf1ac17..4a7d8b17be 100644 --- a/dom/geolocation/moz.build +++ b/dom/geolocation/moz.build @@ -25,11 +25,7 @@ LOCAL_INCLUDES += [ '/dom/ipc', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - LOCAL_INCLUDES += [ - '/dom/system/android', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ '/dom/system/windows', ] diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index e00e247446..7ebd02e156 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -133,7 +133,7 @@ if CONFIG['OS_ARCH'] != 'WINNT': DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG['BIN_SUFFIX'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2': DEFINES['MOZ_ENABLE_FREETYPE'] = True if CONFIG['MOZ_TOOLKIT_SEARCH']: diff --git a/dom/media/eme/mediadrm/MediaDrmCDMCallbackProxy.cpp b/dom/media/eme/mediadrm/MediaDrmCDMCallbackProxy.cpp deleted file mode 100644 index 300093b844..0000000000 --- a/dom/media/eme/mediadrm/MediaDrmCDMCallbackProxy.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "MediaDrmCDMCallbackProxy.h" -#include "mozilla/CDMProxy.h" -#include "nsString.h" -#include "mozilla/dom/MediaKeys.h" -#include "mozilla/dom/MediaKeySession.h" -#include "mozIGeckoMediaPluginService.h" -#include "nsContentCID.h" -#include "nsServiceManagerUtils.h" -#include "MainThreadUtils.h" -#include "mozilla/EMEUtils.h" - -namespace mozilla { - -MediaDrmCDMCallbackProxy::MediaDrmCDMCallbackProxy(CDMProxy* aProxy) - : mProxy(aProxy) -{ - -} - -void -MediaDrmCDMCallbackProxy::SetSessionId(uint32_t aToken, - const nsCString& aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - mProxy->OnSetSessionId(aToken, NS_ConvertUTF8toUTF16(aSessionId)); -} - -void -MediaDrmCDMCallbackProxy::ResolveLoadSessionPromise(uint32_t aPromiseId, - bool aSuccess) -{ - MOZ_ASSERT(NS_IsMainThread()); - mProxy->OnResolveLoadSessionPromise(aPromiseId, aSuccess); -} - -void -MediaDrmCDMCallbackProxy::ResolvePromise(uint32_t aPromiseId) -{ - // Note: CDMProxy proxies this from non-main threads to main thread. - mProxy->ResolvePromise(aPromiseId); -} - -void -MediaDrmCDMCallbackProxy::RejectPromise(uint32_t aPromiseId, - nsresult aException, - const nsCString& aMessage) -{ - MOZ_ASSERT(NS_IsMainThread()); - mProxy->OnRejectPromise(aPromiseId, aException, aMessage); -} - -void -MediaDrmCDMCallbackProxy::SessionMessage(const nsCString& aSessionId, - dom::MediaKeyMessageType aMessageType, - const nsTArray<uint8_t>& aMessage) -{ - MOZ_ASSERT(NS_IsMainThread()); - // For removing constness - nsTArray<uint8_t> message(aMessage); - mProxy->OnSessionMessage(NS_ConvertUTF8toUTF16(aSessionId), aMessageType, message); -} - -void -MediaDrmCDMCallbackProxy::ExpirationChange(const nsCString& aSessionId, - UnixTime aExpiryTime) -{ - MOZ_ASSERT(NS_IsMainThread()); - mProxy->OnExpirationChange(NS_ConvertUTF8toUTF16(aSessionId), aExpiryTime); -} - -void -MediaDrmCDMCallbackProxy::SessionClosed(const nsCString& aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - bool keyStatusesChange = false; - { - CDMCaps::AutoLock caps(mProxy->Capabilites()); - keyStatusesChange = caps.RemoveKeysForSession(NS_ConvertUTF8toUTF16(aSessionId)); - } - if (keyStatusesChange) { - mProxy->OnKeyStatusesChange(NS_ConvertUTF8toUTF16(aSessionId)); - } - mProxy->OnSessionClosed(NS_ConvertUTF8toUTF16(aSessionId)); -} - -void -MediaDrmCDMCallbackProxy::SessionError(const nsCString& aSessionId, - nsresult aException, - uint32_t aSystemCode, - const nsCString& aMessage) -{ - MOZ_ASSERT(NS_IsMainThread()); - mProxy->OnSessionError(NS_ConvertUTF8toUTF16(aSessionId), - aException, - aSystemCode, - NS_ConvertUTF8toUTF16(aMessage)); -} - -void -MediaDrmCDMCallbackProxy::BatchedKeyStatusChanged(const nsCString& aSessionId, - const nsTArray<CDMKeyInfo>& aKeyInfos) -{ - MOZ_ASSERT(NS_IsMainThread()); - BatchedKeyStatusChangedInternal(aSessionId, aKeyInfos); -} - -void -MediaDrmCDMCallbackProxy::BatchedKeyStatusChangedInternal(const nsCString& aSessionId, - const nsTArray<CDMKeyInfo>& aKeyInfos) -{ - bool keyStatusesChange = false; - { - CDMCaps::AutoLock caps(mProxy->Capabilites()); - for (size_t i = 0; i < aKeyInfos.Length(); i++) { - keyStatusesChange |= - caps.SetKeyStatus(aKeyInfos[i].mKeyId, - NS_ConvertUTF8toUTF16(aSessionId), - aKeyInfos[i].mStatus); - } - } - if (keyStatusesChange) { - mProxy->OnKeyStatusesChange(NS_ConvertUTF8toUTF16(aSessionId)); - } -} - -void -MediaDrmCDMCallbackProxy::Decrypted(uint32_t aId, - DecryptStatus aResult, - const nsTArray<uint8_t>& aDecryptedData) -{ - MOZ_ASSERT_UNREACHABLE("Fennec could not handle decrypted event"); -} - -} // namespace mozilla
\ No newline at end of file diff --git a/dom/media/eme/mediadrm/MediaDrmCDMCallbackProxy.h b/dom/media/eme/mediadrm/MediaDrmCDMCallbackProxy.h deleted file mode 100644 index c7a0810ee5..0000000000 --- a/dom/media/eme/mediadrm/MediaDrmCDMCallbackProxy.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef MediaDrmCDMCallbackProxy_h_ -#define MediaDrmCDMCallbackProxy_h_ - -#include "mozilla/CDMProxy.h" -#include "mozilla/DecryptorProxyCallback.h" - -namespace mozilla { -class CDMProxy; -// Proxies call backs from the MediaDrmProxy -> MediaDrmProxySupport back to the MediaKeys -// object on the main thread. -// We used annotation calledFrom = "gecko" to ensure running on main thread. -class MediaDrmCDMCallbackProxy : public DecryptorProxyCallback { -public: - - void SetDecryptorId(uint32_t aId) override {} - - void SetSessionId(uint32_t aCreateSessionToken, - const nsCString& aSessionId) override; - - void ResolveLoadSessionPromise(uint32_t aPromiseId, - bool aSuccess) override; - - void ResolvePromise(uint32_t aPromiseId) override; - - void RejectPromise(uint32_t aPromiseId, - nsresult aException, - const nsCString& aSessionId) override; - - void SessionMessage(const nsCString& aSessionId, - dom::MediaKeyMessageType aMessageType, - const nsTArray<uint8_t>& aMessage) override; - - void ExpirationChange(const nsCString& aSessionId, - UnixTime aExpiryTime) override; - - void SessionClosed(const nsCString& aSessionId) override; - - void SessionError(const nsCString& aSessionId, - nsresult aException, - uint32_t aSystemCode, - const nsCString& aMessage) override; - - void Decrypted(uint32_t aId, - DecryptStatus aResult, - const nsTArray<uint8_t>& aDecryptedData) override; - - void BatchedKeyStatusChanged(const nsCString& aSessionId, - const nsTArray<CDMKeyInfo>& aKeyInfos) override; - - ~MediaDrmCDMCallbackProxy() {} - -private: - friend class MediaDrmCDMProxy; - explicit MediaDrmCDMCallbackProxy(CDMProxy* aProxy); - - void BatchedKeyStatusChangedInternal(const nsCString& aSessionId, - const nsTArray<CDMKeyInfo>& aKeyInfos); - // Warning: Weak ref. - CDMProxy* mProxy; -}; - -} // namespace mozilla -#endif
\ No newline at end of file diff --git a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp deleted file mode 100644 index f64d0afdb3..0000000000 --- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "mozilla/dom/MediaKeySession.h" -#include "mozilla/MediaDrmCDMProxy.h" -#include "MediaDrmCDMCallbackProxy.h" - -using namespace mozilla::java::sdk; - -namespace mozilla { - -MediaDrmSessionType -ToMediaDrmSessionType(dom::MediaKeySessionType aSessionType) -{ - switch (aSessionType) { - case dom::MediaKeySessionType::Temporary: return kKeyStreaming; - case dom::MediaKeySessionType::Persistent_license: return kKeyOffline; - default: return kKeyStreaming; - }; -} - -MediaDrmCDMProxy::MediaDrmCDMProxy(dom::MediaKeys* aKeys, - const nsAString& aKeySystem, - bool aDistinctiveIdentifierRequired, - bool aPersistentStateRequired) - : CDMProxy(aKeys, - aKeySystem, - aDistinctiveIdentifierRequired, - aPersistentStateRequired) - , mCDM(nullptr) - , mShutdownCalled(false) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_COUNT_CTOR(MediaDrmCDMProxy); -} - -MediaDrmCDMProxy::~MediaDrmCDMProxy() -{ - MOZ_COUNT_DTOR(MediaDrmCDMProxy); -} - -void -MediaDrmCDMProxy::Init(PromiseId aPromiseId, - const nsAString& aOrigin, - const nsAString& aTopLevelOrigin, - const nsAString& aName, - bool aInPrivateBrowsing) -{ - MOZ_ASSERT(NS_IsMainThread()); - NS_ENSURE_TRUE_VOID(!mKeys.IsNull()); - - EME_LOG("MediaDrmCDMProxy::Init (%s, %s) %s", - NS_ConvertUTF16toUTF8(aOrigin).get(), - NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(), - (aInPrivateBrowsing ? "PrivateBrowsing" : "NonPrivateBrowsing")); - - // Create a thread to work with cdm. - if (!mOwnerThread) { - nsresult rv = NS_NewNamedThread("MDCDMThread", getter_AddRefs(mOwnerThread)); - if (NS_FAILED(rv)) { - RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Couldn't create CDM thread MediaDrmCDMProxy::Init")); - return; - } - } - - mCDM = mozilla::MakeUnique<MediaDrmProxySupport>(mKeySystem); - nsCOMPtr<nsIRunnable> task(NewRunnableMethod<uint32_t>(this, - &MediaDrmCDMProxy::md_Init, - aPromiseId)); - mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); -} - -void -MediaDrmCDMProxy::CreateSession(uint32_t aCreateSessionToken, - MediaKeySessionType aSessionType, - PromiseId aPromiseId, - const nsAString& aInitDataType, - nsTArray<uint8_t>& aInitData) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mOwnerThread); - - nsAutoPtr<CreateSessionData> data(new CreateSessionData()); - data->mSessionType = aSessionType; - data->mCreateSessionToken = aCreateSessionToken; - data->mPromiseId = aPromiseId; - data->mInitDataType = NS_ConvertUTF16toUTF8(aInitDataType); - data->mInitData = Move(aInitData); - - nsCOMPtr<nsIRunnable> task( - NewRunnableMethod<nsAutoPtr<CreateSessionData>>(this, - &MediaDrmCDMProxy::md_CreateSession, - data)); - mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); -} - -void -MediaDrmCDMProxy::LoadSession(PromiseId aPromiseId, - const nsAString& aSessionId) -{ - // TODO: Implement LoadSession. - RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Currently Fennec did not support LoadSession")); -} - -void -MediaDrmCDMProxy::SetServerCertificate(PromiseId aPromiseId, - nsTArray<uint8_t>& aCert) -{ - // TODO: Implement SetServerCertificate. - RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Currently Fennec did not support SetServerCertificate")); -} - -void -MediaDrmCDMProxy::UpdateSession(const nsAString& aSessionId, - PromiseId aPromiseId, - nsTArray<uint8_t>& aResponse) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mOwnerThread); - NS_ENSURE_TRUE_VOID(!mKeys.IsNull()); - - nsAutoPtr<UpdateSessionData> data(new UpdateSessionData()); - data->mPromiseId = aPromiseId; - data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); - data->mResponse = Move(aResponse); - - nsCOMPtr<nsIRunnable> task( - NewRunnableMethod<nsAutoPtr<UpdateSessionData>>(this, - &MediaDrmCDMProxy::md_UpdateSession, - data)); - mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); -} - -void -MediaDrmCDMProxy::CloseSession(const nsAString& aSessionId, - PromiseId aPromiseId) -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mOwnerThread); - NS_ENSURE_TRUE_VOID(!mKeys.IsNull()); - - nsAutoPtr<SessionOpData> data(new SessionOpData()); - data->mPromiseId = aPromiseId; - data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); - - nsCOMPtr<nsIRunnable> task( - NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, - &MediaDrmCDMProxy::md_CloseSession, - data)); - mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); -} - -void -MediaDrmCDMProxy::RemoveSession(const nsAString& aSessionId, - PromiseId aPromiseId) -{ - // TODO: Implement RemoveSession. - RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Currently Fennec did not support RemoveSession")); -} - -void -MediaDrmCDMProxy::Shutdown() -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mOwnerThread); - nsCOMPtr<nsIRunnable> task( - NewRunnableMethod(this, &MediaDrmCDMProxy::md_Shutdown)); - - mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); - mOwnerThread->Shutdown(); - mOwnerThread = nullptr; -} - -void -MediaDrmCDMProxy::Terminated() -{ - // TODO: Implement Terminated. - // Should find a way to handle the case when remote side MediaDrm crashed. -} - -const nsCString& -MediaDrmCDMProxy::GetNodeId() const -{ - return mNodeId; -} - -void -MediaDrmCDMProxy::OnSetSessionId(uint32_t aCreateSessionToken, - const nsAString& aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - - RefPtr<dom::MediaKeySession> session(mKeys->GetPendingSession(aCreateSessionToken)); - if (session) { - session->SetSessionId(aSessionId); - } -} - -void -MediaDrmCDMProxy::OnResolveLoadSessionPromise(uint32_t aPromiseId, bool aSuccess) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - mKeys->OnSessionLoaded(aPromiseId, aSuccess); -} - -void -MediaDrmCDMProxy::OnSessionMessage(const nsAString& aSessionId, - dom::MediaKeyMessageType aMessageType, - nsTArray<uint8_t>& aMessage) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - RefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId)); - if (session) { - session->DispatchKeyMessage(aMessageType, aMessage); - } -} - -void -MediaDrmCDMProxy::OnExpirationChange(const nsAString& aSessionId, - UnixTime aExpiryTime) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - RefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId)); - if (session) { - session->SetExpiration(static_cast<double>(aExpiryTime)); - } -} - -void -MediaDrmCDMProxy::OnSessionClosed(const nsAString& aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - RefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId)); - if (session) { - session->OnClosed(); - } -} - -void -MediaDrmCDMProxy::OnSessionError(const nsAString& aSessionId, - nsresult aException, - uint32_t aSystemCode, - const nsAString& aMsg) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - RefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId)); - if (session) { - session->DispatchKeyError(aSystemCode); - } -} - -void -MediaDrmCDMProxy::OnRejectPromise(uint32_t aPromiseId, - nsresult aDOMException, - const nsCString& aMsg) -{ - MOZ_ASSERT(NS_IsMainThread()); - RejectPromise(aPromiseId, aDOMException, aMsg); -} - -RefPtr<MediaDrmCDMProxy::DecryptPromise> -MediaDrmCDMProxy::Decrypt(MediaRawData* aSample) -{ - MOZ_ASSERT_UNREACHABLE("Fennec could not handle decrypting individually"); - return nullptr; -} - -void -MediaDrmCDMProxy::OnDecrypted(uint32_t aId, - DecryptStatus aResult, - const nsTArray<uint8_t>& aDecryptedData) -{ - MOZ_ASSERT_UNREACHABLE("Fennec could not handle decrypted event"); -} - -void -MediaDrmCDMProxy::RejectPromise(PromiseId aId, nsresult aCode, - const nsCString& aReason) -{ - if (NS_IsMainThread()) { - if (!mKeys.IsNull()) { - mKeys->RejectPromise(aId, aCode, aReason); - } - } else { - nsCOMPtr<nsIRunnable> task(new RejectPromiseTask(this, aId, aCode, - aReason)); - NS_DispatchToMainThread(task); - } -} - -void -MediaDrmCDMProxy::ResolvePromise(PromiseId aId) -{ - if (NS_IsMainThread()) { - if (!mKeys.IsNull()) { - mKeys->ResolvePromise(aId); - } else { - NS_WARNING("MediaDrmCDMProxy unable to resolve promise!"); - } - } else { - nsCOMPtr<nsIRunnable> task; - task = NewRunnableMethod<PromiseId>(this, - &MediaDrmCDMProxy::ResolvePromise, - aId); - NS_DispatchToMainThread(task); - } -} - -const nsString& -MediaDrmCDMProxy::KeySystem() const -{ - return mKeySystem; -} - -CDMCaps& -MediaDrmCDMProxy::Capabilites() -{ - return mCapabilites; -} - -void -MediaDrmCDMProxy::OnKeyStatusesChange(const nsAString& aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - RefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId)); - if (session) { - session->DispatchKeyStatusesChange(); - } -} - -void -MediaDrmCDMProxy::GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId, - nsTArray<nsCString>& aSessionIds) -{ - CDMCaps::AutoLock caps(Capabilites()); - caps.GetSessionIdsForKeyId(aKeyId, aSessionIds); -} - -#ifdef DEBUG -bool -MediaDrmCDMProxy::IsOnOwnerThread() -{ - return NS_GetCurrentThread() == mOwnerThread; -} -#endif - -void -MediaDrmCDMProxy::OnCDMCreated(uint32_t aPromiseId) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (mKeys.IsNull()) { - return; - } - - if (mCDM) { - mKeys->OnCDMCreated(aPromiseId, GetNodeId(), 0); - return; - } - - // No CDM? Just reject the promise. - mKeys->RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Null CDM in OnCDMCreated()")); -} - -void -MediaDrmCDMProxy::md_Init(uint32_t aPromiseId) -{ - MOZ_ASSERT(IsOnOwnerThread()); - MOZ_ASSERT(mCDM); - - mCallback = new MediaDrmCDMCallbackProxy(this); - mCDM->Init(mCallback); - nsCOMPtr<nsIRunnable> task( - NewRunnableMethod<uint32_t>(this, - &MediaDrmCDMProxy::OnCDMCreated, - aPromiseId)); - NS_DispatchToMainThread(task); -} - -void -MediaDrmCDMProxy::md_CreateSession(nsAutoPtr<CreateSessionData> aData) -{ - MOZ_ASSERT(IsOnOwnerThread()); - - if (!mCDM) { - RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Null CDM in md_CreateSession")); - return; - } - - mCDM->CreateSession(aData->mCreateSessionToken, - aData->mPromiseId, - aData->mInitDataType, - aData->mInitData, - ToMediaDrmSessionType(aData->mSessionType)); -} - -void -MediaDrmCDMProxy::md_UpdateSession(nsAutoPtr<UpdateSessionData> aData) -{ - MOZ_ASSERT(IsOnOwnerThread()); - - if (!mCDM) { - RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Null CDM in md_UpdateSession")); - return; - } - mCDM->UpdateSession(aData->mPromiseId, - aData->mSessionId, - aData->mResponse); -} - -void -MediaDrmCDMProxy::md_CloseSession(nsAutoPtr<SessionOpData> aData) -{ - MOZ_ASSERT(IsOnOwnerThread()); - - if (!mCDM) { - RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Null CDM in md_CloseSession")); - return; - } - mCDM->CloseSession(aData->mPromiseId, aData->mSessionId); -} - -void -MediaDrmCDMProxy::md_Shutdown() -{ - MOZ_ASSERT(IsOnOwnerThread()); - MOZ_ASSERT(mCDM); - if (mShutdownCalled) { - return; - } - mShutdownCalled = true; - mCDM->Shutdown(); - mCDM = nullptr; -} - -} // namespace mozilla
\ No newline at end of file diff --git a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h b/dom/media/eme/mediadrm/MediaDrmCDMProxy.h deleted file mode 100644 index a25af5dbf9..0000000000 --- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef MediaDrmCDMProxy_h_ -#define MediaDrmCDMProxy_h_ - -#include <jni.h> -#include "mozilla/jni/Types.h" -#include "GeneratedJNINatives.h" - -#include "mozilla/CDMProxy.h" -#include "mozilla/CDMCaps.h" -#include "mozilla/dom/MediaKeys.h" -#include "mozilla/MediaDrmProxySupport.h" -#include "mozilla/UniquePtr.h" - -#include "MediaCodec.h" -#include "nsString.h" -#include "nsAutoPtr.h" - -using namespace mozilla::java; - -namespace mozilla { -class MediaDrmCDMCallbackProxy; -class MediaDrmCDMProxy : public CDMProxy { -public: - - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDrmCDMProxy) - - MediaDrmCDMProxy(dom::MediaKeys* aKeys, - const nsAString& aKeySystem, - bool aDistinctiveIdentifierRequired, - bool aPersistentStateRequired); - - void Init(PromiseId aPromiseId, - const nsAString& aOrigin, - const nsAString& aTopLevelOrigin, - const nsAString& aGMPName, - bool aInPrivateBrowsing) override; - - void CreateSession(uint32_t aCreateSessionToken, - MediaKeySessionType aSessionType, - PromiseId aPromiseId, - const nsAString& aInitDataType, - nsTArray<uint8_t>& aInitData) override; - - void LoadSession(PromiseId aPromiseId, - const nsAString& aSessionId) override; - - void SetServerCertificate(PromiseId aPromiseId, - nsTArray<uint8_t>& aCert) override; - - void UpdateSession(const nsAString& aSessionId, - PromiseId aPromiseId, - nsTArray<uint8_t>& aResponse) override; - - void CloseSession(const nsAString& aSessionId, - PromiseId aPromiseId) override; - - void RemoveSession(const nsAString& aSessionId, - PromiseId aPromiseId) override; - - void Shutdown() override; - - void Terminated() override; - - const nsCString& GetNodeId() const override; - - void OnSetSessionId(uint32_t aCreateSessionToken, - const nsAString& aSessionId) override; - - void OnResolveLoadSessionPromise(uint32_t aPromiseId, bool aSuccess) override; - - void OnSessionMessage(const nsAString& aSessionId, - dom::MediaKeyMessageType aMessageType, - nsTArray<uint8_t>& aMessage) override; - - void OnExpirationChange(const nsAString& aSessionId, - UnixTime aExpiryTime) override; - - void OnSessionClosed(const nsAString& aSessionId) override; - - void OnSessionError(const nsAString& aSessionId, - nsresult aException, - uint32_t aSystemCode, - const nsAString& aMsg) override; - - void OnRejectPromise(uint32_t aPromiseId, - nsresult aCode, - const nsCString& aMsg) override; - - RefPtr<DecryptPromise> Decrypt(MediaRawData* aSample) override; - void OnDecrypted(uint32_t aId, - DecryptStatus aResult, - const nsTArray<uint8_t>& aDecryptedData) override; - - void RejectPromise(PromiseId aId, nsresult aCode, - const nsCString& aReason) override; - - // Resolves promise with "undefined". - // Can be called from any thread. - void ResolvePromise(PromiseId aId) override; - - // Threadsafe. - const nsString& KeySystem() const override; - - CDMCaps& Capabilites() override; - - void OnKeyStatusesChange(const nsAString& aSessionId) override; - - void GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId, - nsTArray<nsCString>& aSessionIds) override; - -#ifdef DEBUG - bool IsOnOwnerThread() override; -#endif - -private: - virtual ~MediaDrmCDMProxy(); - - void OnCDMCreated(uint32_t aPromiseId); - - struct CreateSessionData { - MediaKeySessionType mSessionType; - uint32_t mCreateSessionToken; - PromiseId mPromiseId; - nsCString mInitDataType; - nsTArray<uint8_t> mInitData; - }; - - struct UpdateSessionData { - PromiseId mPromiseId; - nsCString mSessionId; - nsTArray<uint8_t> mResponse; - }; - - struct SessionOpData { - PromiseId mPromiseId; - nsCString mSessionId; - }; - - class RejectPromiseTask : public Runnable { - public: - RejectPromiseTask(MediaDrmCDMProxy* aProxy, - PromiseId aId, - nsresult aCode, - const nsCString& aReason) - : mProxy(aProxy) - , mId(aId) - , mCode(aCode) - , mReason(aReason) - { - } - NS_METHOD Run() { - mProxy->RejectPromise(mId, mCode, mReason); - return NS_OK; - } - private: - RefPtr<MediaDrmCDMProxy> mProxy; - PromiseId mId; - nsresult mCode; - nsCString mReason; - }; - - nsCString mNodeId; - mozilla::UniquePtr<MediaDrmProxySupport> mCDM; - nsAutoPtr<MediaDrmCDMCallbackProxy> mCallback; - bool mShutdownCalled; - -// ===================================================================== -// For MediaDrmProxySupport - void md_Init(uint32_t aPromiseId); - void md_CreateSession(nsAutoPtr<CreateSessionData> aData); - void md_UpdateSession(nsAutoPtr<UpdateSessionData> aData); - void md_CloseSession(nsAutoPtr<SessionOpData> aData); - void md_Shutdown(); -// ===================================================================== -}; - -} // namespace mozilla -#endif // MediaDrmCDMProxy_h_
\ No newline at end of file diff --git a/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp b/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp deleted file mode 100644 index 83f0529d26..0000000000 --- a/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "MediaDrmProxySupport.h" -#include "mozilla/EMEUtils.h" -#include "FennecJNINatives.h" -#include "MediaCodec.h" // For MediaDrm::KeyStatus -#include "MediaPrefs.h" - -using namespace mozilla::java; - -namespace mozilla { - -LogModule* GetMDRMNLog() { - static LazyLogModule log("MediaDrmProxySupport"); - return log; -} - -class MediaDrmJavaCallbacksSupport - : public MediaDrmProxy::NativeMediaDrmProxyCallbacks::Natives<MediaDrmJavaCallbacksSupport> -{ -public: - typedef MediaDrmProxy::NativeMediaDrmProxyCallbacks::Natives<MediaDrmJavaCallbacksSupport> MediaDrmProxyNativeCallbacks; - using MediaDrmProxyNativeCallbacks::DisposeNative; - using MediaDrmProxyNativeCallbacks::AttachNative; - - MediaDrmJavaCallbacksSupport(DecryptorProxyCallback* aDecryptorProxyCallback) - : mDecryptorProxyCallback(aDecryptorProxyCallback) - { - MOZ_ASSERT(aDecryptorProxyCallback); - } - /* - * Native implementation, called by Java. - */ - void OnSessionCreated(int aCreateSessionToken, - int aPromiseId, - jni::ByteArray::Param aSessionId, - jni::ByteArray::Param aRequest); - - void OnSessionUpdated(int aPromiseId, jni::ByteArray::Param aSessionId); - - void OnSessionClosed(int aPromiseId, jni::ByteArray::Param aSessionId); - - void OnSessionMessage(jni::ByteArray::Param aSessionId, - int /*mozilla::dom::MediaKeyMessageType*/ aSessionMessageType, - jni::ByteArray::Param aRequest); - - void OnSessionError(jni::ByteArray::Param aSessionId, - jni::String::Param aMessage); - - void OnSessionBatchedKeyChanged(jni::ByteArray::Param, - jni::ObjectArray::Param); - - void OnRejectPromise(int aPromiseId, jni::String::Param aMessage); - -private: - DecryptorProxyCallback* mDecryptorProxyCallback; -}; // MediaDrmJavaCallbacksSupport - -void -MediaDrmJavaCallbacksSupport::OnSessionCreated(int aCreateSessionToken, - int aPromiseId, - jni::ByteArray::Param aSessionId, - jni::ByteArray::Param aRequest) -{ - MOZ_ASSERT(NS_IsMainThread()); - auto reqDataArray = aRequest->GetElements(); - nsCString sessionId(reinterpret_cast<char*>(aSessionId->GetElements().Elements()), - aSessionId->Length()); - MDRMN_LOG("SessionId(%s) closed", sessionId.get()); - - mDecryptorProxyCallback->SetSessionId(aCreateSessionToken, sessionId); - mDecryptorProxyCallback->ResolvePromise(aPromiseId); -} - -void -MediaDrmJavaCallbacksSupport::OnSessionUpdated(int aPromiseId, - jni::ByteArray::Param aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - MDRMN_LOG("SessionId(%s) closed", - nsCString(reinterpret_cast<char*>(aSessionId->GetElements().Elements()), - aSessionId->Length()).get()); - mDecryptorProxyCallback->ResolvePromise(aPromiseId); -} - -void -MediaDrmJavaCallbacksSupport::OnSessionClosed(int aPromiseId, - jni::ByteArray::Param aSessionId) -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCString sessionId(reinterpret_cast<char*>(aSessionId->GetElements().Elements()), - aSessionId->Length()); - MDRMN_LOG("SessionId(%s) closed", sessionId.get()); - mDecryptorProxyCallback->ResolvePromise(aPromiseId); - mDecryptorProxyCallback->SessionClosed(sessionId); -} - -void -MediaDrmJavaCallbacksSupport::OnSessionMessage(jni::ByteArray::Param aSessionId, - int /*mozilla::dom::MediaKeyMessageType*/ aMessageType, - jni::ByteArray::Param aRequest) -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCString sessionId(reinterpret_cast<char*>(aSessionId->GetElements().Elements()), - aSessionId->Length()); - auto reqDataArray = aRequest->GetElements(); - - nsTArray<uint8_t> retRequest; - retRequest.AppendElements(reinterpret_cast<uint8_t*>(reqDataArray.Elements()), - reqDataArray.Length()); - - mDecryptorProxyCallback->SessionMessage(sessionId, - static_cast<dom::MediaKeyMessageType>(aMessageType), - retRequest); -} - -void -MediaDrmJavaCallbacksSupport::OnSessionError(jni::ByteArray::Param aSessionId, - jni::String::Param aMessage) -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCString sessionId(reinterpret_cast<char*>(aSessionId->GetElements().Elements()), - aSessionId->Length()); - nsCString errorMessage = aMessage->ToCString(); - MDRMN_LOG("SessionId(%s)", sessionId.get()); - // TODO: We cannot get system error code from media drm API. - // Currently use -1 as an error code. - mDecryptorProxyCallback->SessionError(sessionId, - NS_ERROR_DOM_INVALID_STATE_ERR, - -1, - errorMessage); -} - -// TODO: MediaDrm.KeyStatus defined the status code not included -// dom::MediaKeyStatus::Released and dom::MediaKeyStatus::Output_downscaled. -// Should keep tracking for this if it will be changed in the future. -static dom::MediaKeyStatus -MediaDrmKeyStatusToMediaKeyStatus(int aStatusCode) -{ - using mozilla::java::sdk::KeyStatus; - switch (aStatusCode) { - case KeyStatus::STATUS_USABLE: return dom::MediaKeyStatus::Usable; - case KeyStatus::STATUS_EXPIRED: return dom::MediaKeyStatus::Expired; - case KeyStatus::STATUS_OUTPUT_NOT_ALLOWED: return dom::MediaKeyStatus::Output_restricted; - case KeyStatus::STATUS_INTERNAL_ERROR: return dom::MediaKeyStatus::Internal_error; - case KeyStatus::STATUS_PENDING: return dom::MediaKeyStatus::Status_pending; - default: return dom::MediaKeyStatus::Internal_error; - } -} - -void -MediaDrmJavaCallbacksSupport::OnSessionBatchedKeyChanged(jni::ByteArray::Param aSessionId, - jni::ObjectArray::Param aKeyInfos) -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCString sessionId(reinterpret_cast<char*>(aSessionId->GetElements().Elements()), - aSessionId->Length()); - nsTArray<jni::Object::LocalRef> keyInfosObjectArray(aKeyInfos->GetElements()); - - nsTArray<CDMKeyInfo> keyInfosArray; - - for (auto&& keyInfoObject : keyInfosObjectArray) { - java::SessionKeyInfo::LocalRef keyInfo(mozilla::Move(keyInfoObject)); - mozilla::jni::ByteArray::LocalRef keyIdByteArray = keyInfo->KeyId(); - nsTArray<int8_t> keyIdInt8Array = keyIdByteArray->GetElements(); - // Cast nsTArray<int8_t> to nsTArray<uint8_t> - nsTArray<uint8_t>* keyId = reinterpret_cast<nsTArray<uint8_t>*>(&keyIdInt8Array); - auto keyStatus = keyInfo->Status(); // int32_t - keyInfosArray.AppendElement(CDMKeyInfo(*keyId, - dom::Optional<dom::MediaKeyStatus>( - MediaDrmKeyStatusToMediaKeyStatus(keyStatus) - ) - ) - ); - } - - mDecryptorProxyCallback->BatchedKeyStatusChanged(sessionId, - keyInfosArray); -} - -void -MediaDrmJavaCallbacksSupport::OnRejectPromise(int aPromiseId, jni::String::Param aMessage) -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCString reason = aMessage->ToCString(); - MDRMN_LOG("OnRejectPromise aMessage(%s) ", reason.get()); - // Current implementation assume all the reject from MediaDrm is due to invalid state. - // Other cases should be handled before calling into MediaDrmProxy API. - mDecryptorProxyCallback->RejectPromise(aPromiseId, - NS_ERROR_DOM_INVALID_STATE_ERR, - reason); -} - -MediaDrmProxySupport::MediaDrmProxySupport(const nsAString& aKeySystem) - : mKeySystem(aKeySystem), mDestroyed(false) -{ - mJavaCallbacks = MediaDrmProxy::NativeMediaDrmProxyCallbacks::New(); - - mBridgeProxy = - MediaDrmProxy::Create(mKeySystem, - mJavaCallbacks, - MediaPrefs::PDMAndroidRemoteCodecEnabled()); -} - -MediaDrmProxySupport::~MediaDrmProxySupport() -{ - MOZ_ASSERT(mDestroyed, "Shutdown() should be called before !!"); - MediaDrmJavaCallbacksSupport::DisposeNative(mJavaCallbacks); -} - -nsresult -MediaDrmProxySupport::Init(DecryptorProxyCallback* aCallback) -{ - MOZ_ASSERT(mJavaCallbacks); - - mCallback = aCallback; - MediaDrmJavaCallbacksSupport::AttachNative(mJavaCallbacks, - mozilla::MakeUnique<MediaDrmJavaCallbacksSupport>(mCallback)); - return mBridgeProxy != nullptr ? NS_OK : NS_ERROR_FAILURE; -} - -void -MediaDrmProxySupport::CreateSession(uint32_t aCreateSessionToken, - uint32_t aPromiseId, - const nsCString& aInitDataType, - const nsTArray<uint8_t>& aInitData, - MediaDrmSessionType aSessionType) -{ - MOZ_ASSERT(mBridgeProxy); - - auto initDataBytes = - mozilla::jni::ByteArray::New(reinterpret_cast<const int8_t*>(&aInitData[0]), - aInitData.Length()); - // TODO: aSessionType is not used here. - // Refer to - // http://androidxref.com/5.1.1_r6/xref/external/chromium_org/media/base/android/java/src/org/chromium/media/MediaDrmBridge.java#420 - // it is hard code to streaming type. - mBridgeProxy->CreateSession(aCreateSessionToken, - aPromiseId, - NS_ConvertUTF8toUTF16(aInitDataType), - initDataBytes); -} - -void -MediaDrmProxySupport::UpdateSession(uint32_t aPromiseId, - const nsCString& aSessionId, - const nsTArray<uint8_t>& aResponse) -{ - MOZ_ASSERT(mBridgeProxy); - - auto response = - mozilla::jni::ByteArray::New(reinterpret_cast<const int8_t*>(aResponse.Elements()), - aResponse.Length()); - mBridgeProxy->UpdateSession(aPromiseId, - NS_ConvertUTF8toUTF16(aSessionId), - response); -} - -void -MediaDrmProxySupport::CloseSession(uint32_t aPromiseId, - const nsCString& aSessionId) -{ - MOZ_ASSERT(mBridgeProxy); - - mBridgeProxy->CloseSession(aPromiseId, NS_ConvertUTF8toUTF16(aSessionId)); -} - -void -MediaDrmProxySupport::Shutdown() -{ - MOZ_ASSERT(mBridgeProxy); - - if (mDestroyed) { - return; - } - mBridgeProxy->Destroy(); - mDestroyed = true; -} - -} // namespace mozilla
\ No newline at end of file diff --git a/dom/media/eme/mediadrm/MediaDrmProxySupport.h b/dom/media/eme/mediadrm/MediaDrmProxySupport.h deleted file mode 100644 index b119633f52..0000000000 --- a/dom/media/eme/mediadrm/MediaDrmProxySupport.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef MediaDrmProxySupport_H -#define MediaDrmProxySupport_H - -#include "mozilla/DecryptorProxyCallback.h" -#include "mozilla/Logging.h" -#include "FennecJNIWrappers.h" -#include "nsString.h" - - -namespace mozilla { - -enum MediaDrmSessionType { - kKeyStreaming = 1, - kKeyOffline = 2, - kKeyRelease = 3, -}; - -#ifndef MDRMN_LOG - LogModule* GetMDRMNLog(); - #define MDRMN_LOG(x, ...) MOZ_LOG(GetMDRMNLog(), mozilla::LogLevel::Debug,\ - ("[MediaDrmProxySupport][%s]" x, __FUNCTION__, ##__VA_ARGS__)) -#endif - -class MediaDrmProxySupport final -{ -public: - - MediaDrmProxySupport(const nsAString& aKeySystem); - ~MediaDrmProxySupport(); - - /* - * APIs to act as GMPDecryptorAPI, discarding unnecessary calls. - */ - nsresult Init(DecryptorProxyCallback* aCallback); - - void CreateSession(uint32_t aCreateSessionToken, - uint32_t aPromiseId, - const nsCString& aInitDataType, - const nsTArray<uint8_t>& aInitData, - MediaDrmSessionType aSessionType); - - void UpdateSession(uint32_t aPromiseId, - const nsCString& aSessionId, - const nsTArray<uint8_t>& aResponse); - - void CloseSession(uint32_t aPromiseId, - const nsCString& aSessionId); - - void Shutdown(); - -private: - const nsString mKeySystem; - java::MediaDrmProxy::GlobalRef mBridgeProxy; - java::MediaDrmProxy::NativeMediaDrmProxyCallbacks::GlobalRef mJavaCallbacks; - DecryptorProxyCallback* mCallback; - bool mDestroyed; - -}; - -} // namespace mozilla -#endif // MediaDrmProxySupport_H
\ No newline at end of file diff --git a/dom/media/eme/mediadrm/moz.build b/dom/media/eme/mediadrm/moz.build deleted file mode 100644 index e425ff5bbb..0000000000 --- a/dom/media/eme/mediadrm/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# 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/. - -EXPORTS.mozilla += [ - 'MediaDrmCDMCallbackProxy.h', - 'MediaDrmCDMProxy.h', - 'MediaDrmProxySupport.h', -] - -SOURCES += [ - 'MediaDrmCDMCallbackProxy.cpp', - 'MediaDrmCDMProxy.cpp', - 'MediaDrmProxySupport.cpp', -] - -FINAL_LIBRARY = 'xul'
\ No newline at end of file diff --git a/dom/media/eme/moz.build b/dom/media/eme/moz.build index 495665dd70..7b1ad9d843 100644 --- a/dom/media/eme/moz.build +++ b/dom/media/eme/moz.build @@ -36,9 +36,6 @@ SOURCES += [ 'MediaKeySystemAccessManager.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - DIRS += ['mediadrm'] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/dom/media/gmp/moz.build b/dom/media/gmp/moz.build index 6e9e92e8a5..fb8e6532fc 100644 --- a/dom/media/gmp/moz.build +++ b/dom/media/gmp/moz.build @@ -76,16 +76,6 @@ if CONFIG['MOZ_EME']: 'GMPCDMProxy.h', ] -# We link GMPLoader into xul on B2G/Fennec as its code does not need to be -# covered by a DRM vendor's voucher. -if CONFIG['OS_TARGET'] == 'Android': - SOURCES += [ - 'GMPLoader.cpp', - ] - USE_LIBS += [ - 'rlz', - ] - SOURCES += [ 'GMPAudioDecoderChild.cpp', 'GMPAudioDecoderParent.cpp', diff --git a/dom/media/systemservices/OpenSLESProvider.cpp b/dom/media/systemservices/OpenSLESProvider.cpp deleted file mode 100644 index c7348afa0b..0000000000 --- a/dom/media/systemservices/OpenSLESProvider.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "OpenSLESProvider.h" -#include "mozilla/Logging.h" -#include "nsDebug.h" - -#include <dlfcn.h> -#include <SLES/OpenSLES_Android.h> -#include <SLES/OpenSLES_AndroidConfiguration.h> - -// MOZ_LOG=OpenSLESProvider:5 -#undef LOG -#undef LOG_ENABLED -mozilla::LazyLogModule gOpenSLESProviderLog("OpenSLESProvider"); -#define LOG(args) MOZ_LOG(gOpenSLESProviderLog, mozilla::LogLevel::Debug, args) -#define LOG_ENABLED() MOZ_LOG_TEST(gOpenSLESProviderLog, mozilla::LogLevel::Debug) - -namespace mozilla { - -OpenSLESProvider::OpenSLESProvider() - : mLock("OpenSLESProvider.mLock"), - mSLEngine(nullptr), - mSLEngineUsers(0), - mIsRealized(false), - mOpenSLESLib(nullptr) -{ - LOG(("OpenSLESProvider being initialized")); -} - -OpenSLESProvider::~OpenSLESProvider() -{ - if (mOpenSLESLib) { - LOG(("OpenSLES Engine was not properly Destroyed")); - (void)dlclose(mOpenSLESLib); - } -} - -/* static */ -OpenSLESProvider& OpenSLESProvider::getInstance() -{ - // This doesn't need a Mutex in C++11 or GCC 4.3+, see N2660 and - // https://gcc.gnu.org/projects/cxx0x.html - static OpenSLESProvider instance; - return instance; -} - -/* static */ -SLresult OpenSLESProvider::Get(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions) -{ - OpenSLESProvider& provider = OpenSLESProvider::getInstance(); - return provider.GetEngine(aObjectm, aOptionCount, aOptions); -} - -SLresult OpenSLESProvider::GetEngine(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions) -{ - MutexAutoLock lock(mLock); - LOG(("Getting OpenSLES engine")); - // Bug 1042051: Validate options are the same - if (mSLEngine != nullptr) { - *aObjectm = mSLEngine; - mSLEngineUsers++; - LOG(("Returning existing engine, %d users", mSLEngineUsers)); - return SL_RESULT_SUCCESS; - } else { - int res = ConstructEngine(aObjectm, aOptionCount, aOptions); - if (res == SL_RESULT_SUCCESS) { - // Bug 1042051: Store engine options - mSLEngine = *aObjectm; - mSLEngineUsers++; - LOG(("Returning new engine")); - } else { - LOG(("Error getting engine: %d", res)); - } - return res; - } -} - -SLresult OpenSLESProvider::ConstructEngine(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions) -{ - mLock.AssertCurrentThreadOwns(); - - if (!mOpenSLESLib) { - mOpenSLESLib = dlopen("libOpenSLES.so", RTLD_LAZY); - if (!mOpenSLESLib) { - LOG(("Failed to dlopen OpenSLES library")); - return SL_RESULT_MEMORY_FAILURE; - } - } - - typedef SLresult (*slCreateEngine_t)(SLObjectItf *, - SLuint32, - const SLEngineOption *, - SLuint32, - const SLInterfaceID *, - const SLboolean *); - - slCreateEngine_t f_slCreateEngine = - (slCreateEngine_t)dlsym(mOpenSLESLib, "slCreateEngine"); - int result = f_slCreateEngine(aObjectm, aOptionCount, aOptions, 0, NULL, NULL); - return result; -} - -/* static */ -void OpenSLESProvider::Destroy(SLObjectItf * aObjectm) -{ - OpenSLESProvider& provider = OpenSLESProvider::getInstance(); - provider.DestroyEngine(aObjectm); -} - -void OpenSLESProvider::DestroyEngine(SLObjectItf * aObjectm) -{ - MutexAutoLock lock(mLock); - NS_ASSERTION(mOpenSLESLib, "OpenSLES destroy called but library is not open"); - - mSLEngineUsers--; - LOG(("Freeing engine, %d users left", mSLEngineUsers)); - if (mSLEngineUsers) { - return; - } - - (*(*aObjectm))->Destroy(*aObjectm); - // This assumes SLObjectItf is a pointer, but given the previous line, - // that's a given. - *aObjectm = nullptr; - - (void)dlclose(mOpenSLESLib); - mOpenSLESLib = nullptr; - mIsRealized = false; -} - -/* static */ -SLresult OpenSLESProvider::Realize(SLObjectItf aObjectm) -{ - OpenSLESProvider& provider = OpenSLESProvider::getInstance(); - return provider.RealizeEngine(aObjectm); -} - -SLresult OpenSLESProvider::RealizeEngine(SLObjectItf aObjectm) -{ - MutexAutoLock lock(mLock); - NS_ASSERTION(mOpenSLESLib, "OpenSLES realize called but library is not open"); - NS_ASSERTION(aObjectm != nullptr, "OpenSLES realize engine with empty ObjectItf"); - - if (mIsRealized) { - LOG(("Not realizing already realized engine")); - return SL_RESULT_SUCCESS; - } else { - SLresult res = (*aObjectm)->Realize(aObjectm, SL_BOOLEAN_FALSE); - if (res != SL_RESULT_SUCCESS) { - LOG(("Error realizing OpenSLES engine: %d", res)); - } else { - LOG(("Realized OpenSLES engine")); - mIsRealized = true; - } - return res; - } -} - -} // namespace mozilla - -extern "C" { -SLresult mozilla_get_sles_engine(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions) -{ - return mozilla::OpenSLESProvider::Get(aObjectm, aOptionCount, aOptions); -} - -void mozilla_destroy_sles_engine(SLObjectItf * aObjectm) -{ - mozilla::OpenSLESProvider::Destroy(aObjectm); -} - -SLresult mozilla_realize_sles_engine(SLObjectItf aObjectm) -{ - return mozilla::OpenSLESProvider::Realize(aObjectm); -} - -} - diff --git a/dom/media/systemservices/OpenSLESProvider.h b/dom/media/systemservices/OpenSLESProvider.h deleted file mode 100644 index 6253e9519e..0000000000 --- a/dom/media/systemservices/OpenSLESProvider.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 50; 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/. */ - -#ifndef _OPENSLESPROVIDER_H_ -#define _OPENSLESPROVIDER_H_ - -#include <SLES/OpenSLES.h> -#include <mozilla/Types.h> - -#ifdef __cplusplus -extern "C" { -#endif -extern MOZ_EXPORT -SLresult mozilla_get_sles_engine(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions); -extern MOZ_EXPORT -void mozilla_destroy_sles_engine(SLObjectItf * aObjectm); -/* Realize is always in synchronous mode. */ -extern MOZ_EXPORT -SLresult mozilla_realize_sles_engine(SLObjectItf aObjectm); -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -#include "mozilla/Mutex.h" - -extern mozilla::LazyLogModule gOpenSLESProviderLog; - -namespace mozilla { - -class OpenSLESProvider { -public: - static SLresult Get(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions); - static void Destroy(SLObjectItf * aObjectm); - static SLresult Realize(SLObjectItf aObjectm); -private: - OpenSLESProvider(); - ~OpenSLESProvider(); - OpenSLESProvider(OpenSLESProvider const&); // NO IMPLEMENTATION - void operator=(OpenSLESProvider const&); // NO IMPLEMENTATION - static OpenSLESProvider& getInstance(); - SLresult GetEngine(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions); - SLresult ConstructEngine(SLObjectItf * aObjectm, - SLuint32 aOptionCount, - const SLEngineOption *aOptions); - SLresult RealizeEngine(SLObjectItf aObjectm); - void DestroyEngine(SLObjectItf * aObjectm); - - // Protect all our internal variables - mozilla::Mutex mLock; - SLObjectItf mSLEngine; - int mSLEngineUsers; - bool mIsRealized; - void *mOpenSLESLib; -}; - -} //namespace -#endif // cplusplus - -#endif /* _OPENSLESPROVIDER_H_ */ diff --git a/dom/media/systemservices/moz.build b/dom/media/systemservices/moz.build index 7d566c42ce..8fb5e54a19 100644 --- a/dom/media/systemservices/moz.build +++ b/dom/media/systemservices/moz.build @@ -29,15 +29,6 @@ if CONFIG['OS_TARGET'] == 'WINNT': else: DEFINES['WEBRTC_POSIX'] = True - -if CONFIG['OS_TARGET'] == 'Android': - EXPORTS += [ - 'OpenSLESProvider.h' - ] - SOURCES += [ - 'OpenSLESProvider.cpp', - ] - if CONFIG['_MSC_VER']: DEFINES['__PRETTY_FUNCTION__'] = '__FUNCSIG__' diff --git a/dom/moz.build b/dom/moz.build index b324de2cb0..e01516b937 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -112,6 +112,6 @@ TEST_DIRS += [ 'imptests', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'windows', 'android'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'windows'): TEST_DIRS += ['plugins/test'] diff --git a/dom/system/android/AndroidLocationProvider.cpp b/dom/system/android/AndroidLocationProvider.cpp deleted file mode 100644 index 48694012a7..0000000000 --- a/dom/system/android/AndroidLocationProvider.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "nsGeolocation.h" -#include "nsGeoPosition.h" -#include "AndroidLocationProvider.h" -#include "GeneratedJNIWrappers.h" - -using namespace mozilla; - -extern nsIGeolocationUpdate *gLocationCallback; - -NS_IMPL_ISUPPORTS(AndroidLocationProvider, nsIGeolocationProvider) - -AndroidLocationProvider::AndroidLocationProvider() -{ -} - -AndroidLocationProvider::~AndroidLocationProvider() -{ - NS_IF_RELEASE(gLocationCallback); -} - -NS_IMETHODIMP -AndroidLocationProvider::Startup() -{ - java::GeckoAppShell::EnableLocation(true); - return NS_OK; -} - -NS_IMETHODIMP -AndroidLocationProvider::Watch(nsIGeolocationUpdate* aCallback) -{ - NS_IF_RELEASE(gLocationCallback); - gLocationCallback = aCallback; - NS_IF_ADDREF(gLocationCallback); - return NS_OK; -} - -NS_IMETHODIMP -AndroidLocationProvider::Shutdown() -{ - java::GeckoAppShell::EnableLocation(false); - return NS_OK; -} - -NS_IMETHODIMP -AndroidLocationProvider::SetHighAccuracy(bool enable) -{ - java::GeckoAppShell::EnableLocationHighAccuracy(enable); - return NS_OK; -} diff --git a/dom/system/android/AndroidLocationProvider.h b/dom/system/android/AndroidLocationProvider.h deleted file mode 100644 index f6dc905b73..0000000000 --- a/dom/system/android/AndroidLocationProvider.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef AndroidLocationProvider_h -#define AndroidLocationProvider_h - -#include "nsIGeolocationProvider.h" - -class AndroidLocationProvider final : public nsIGeolocationProvider -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIGEOLOCATIONPROVIDER - - AndroidLocationProvider(); -private: - ~AndroidLocationProvider(); -}; - -#endif /* AndroidLocationProvider_h */ diff --git a/dom/system/android/moz.build b/dom/system/android/moz.build deleted file mode 100644 index ad4a7c2341..0000000000 --- a/dom/system/android/moz.build +++ /dev/null @@ -1,16 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# 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/. - -SOURCES += [ - 'AndroidLocationProvider.cpp', - 'nsHapticFeedback.cpp', -] - -include('/ipc/chromium/chromium-config.mozbuild') - -FINAL_LIBRARY = 'xul' -LOCAL_INCLUDES += [ - '/dom/geolocation', -] diff --git a/dom/system/android/nsHapticFeedback.cpp b/dom/system/android/nsHapticFeedback.cpp deleted file mode 100644 index 37b51767aa..0000000000 --- a/dom/system/android/nsHapticFeedback.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "mozilla/dom/ContentChild.h" -#include "nsHapticFeedback.h" -#include "GeneratedJNIWrappers.h" - -using namespace mozilla; - -NS_IMPL_ISUPPORTS(nsHapticFeedback, nsIHapticFeedback) - -NS_IMETHODIMP -nsHapticFeedback::PerformSimpleAction(int32_t aType) -{ - java::GeckoAppShell::PerformHapticFeedback(aType == LongPress); - return NS_OK; -} diff --git a/dom/system/android/nsHapticFeedback.h b/dom/system/android/nsHapticFeedback.h deleted file mode 100644 index 3b5c01c445..0000000000 --- a/dom/system/android/nsHapticFeedback.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "nsIHapticFeedback.h" - -class nsHapticFeedback final : public nsIHapticFeedback -{ -private: - ~nsHapticFeedback() {} - -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIHAPTICFEEDBACK -}; diff --git a/dom/system/moz.build b/dom/system/moz.build index fb41fd4f2d..31097d2481 100644 --- a/dom/system/moz.build +++ b/dom/system/moz.build @@ -7,8 +7,6 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] if toolkit == 'windows': DIRS += ['windows'] -elif toolkit == 'android': - DIRS += ['android'] elif toolkit in ('gtk2', 'gtk3'): DIRS += ['linux'] diff --git a/dom/xbl/builtin/android/jar.mn b/dom/xbl/builtin/android/jar.mn deleted file mode 100644 index 9f05c2dd6c..0000000000 --- a/dom/xbl/builtin/android/jar.mn +++ /dev/null @@ -1,6 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -toolkit.jar: -* content/global/platformHTMLBindings.xml (platformHTMLBindings.xml) diff --git a/dom/xbl/builtin/android/moz.build b/dom/xbl/builtin/android/moz.build deleted file mode 100644 index 635fa39c99..0000000000 --- a/dom/xbl/builtin/android/moz.build +++ /dev/null @@ -1,6 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# 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/. - -JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file diff --git a/dom/xbl/builtin/android/platformHTMLBindings.xml b/dom/xbl/builtin/android/platformHTMLBindings.xml deleted file mode 100644 index 03363c1b5e..0000000000 --- a/dom/xbl/builtin/android/platformHTMLBindings.xml +++ /dev/null @@ -1,162 +0,0 @@ -<?xml version="1.0"?> -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - - -<bindings id="htmlBindings" - xmlns="http://www.mozilla.org/xbl" - xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - - <binding id="inputFields" bindToUntrustedContent="true"> - <handlers> -#include ../input-fields-base.inc - <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/> - - <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/> - - <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_END" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" /> - <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" /> - - <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/> - <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/> - </handlers> - </binding> - - <binding id="textAreas" bindToUntrustedContent="true"> - <handlers> -#include ../textareas-base.inc - <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/> - - <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/> - - <handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_UP" modifiers="shift,alt" command="cmd_selectTop"/> - <handler event="keypress" keycode="VK_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/> - - <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift,alt" command="cmd_selectTop"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/> - - <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_END" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" /> - <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" /> - <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" /> - <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" /> - - <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/> - <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/> - </handlers> - </binding> - - <binding id="browser"> - <handlers> -#include ../browser-base.inc - <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious" /> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext" /> - <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" /> - <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" /> - <handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" /> - <handler event="keypress" keycode="VK_RIGHT" modifiers="control,shift" command="cmd_selectWordNext" /> - <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/> - - <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectLinePrevious" /> - <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectLineNext" /> - <handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_UP" modifiers="shift,alt" command="cmd_selectTop"/> - <handler event="keypress" keycode="VK_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/> - - <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift,alt" command="cmd_selectTop"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/> - - <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_END" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" /> - <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" /> - <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" /> - <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" /> - - <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/> - <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/> - </handlers> - </binding> - - <binding id="editor"> - <handlers> -#include ../editor-base.inc - <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/> - - <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/> - <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/> - - <handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_UP" modifiers="shift,alt" command="cmd_selectTop"/> - <handler event="keypress" keycode="VK_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/> - - <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift,alt" command="cmd_selectTop"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/> - - <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/> - <handler event="keypress" keycode="VK_END" command="cmd_endLine"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" /> - <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" /> - <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/> - <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/> - <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" /> - <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" /> - - <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/> - <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/> - </handlers> - </binding> -</bindings> diff --git a/dom/xbl/builtin/moz.build b/dom/xbl/builtin/moz.build index c51001b4c9..b6c41678c4 100644 --- a/dom/xbl/builtin/moz.build +++ b/dom/xbl/builtin/moz.build @@ -5,8 +5,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': DIRS += ['win'] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - DIRS += ['android'] elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): DIRS += ['unix'] else: diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py index 86fc554a16..22801ea9a8 100755 --- a/gfx/skia/generate_mozbuild.py +++ b/gfx/skia/generate_mozbuild.py @@ -64,11 +64,7 @@ LOCAL_INCLUDES += [ 'skia/src/utils/win', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'): - DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0 - if CONFIG['MOZ_WIDGET_TOOLKIT'] in { - 'android', 'gtk2', 'gtk3', 'uikit', @@ -143,7 +139,7 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']: '-Wno-unused-private-field', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] @@ -153,7 +149,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): import json -platforms = ['linux', 'mac', 'android', 'win'] +platforms = ['linux', 'mac', 'win'] def generate_opt_sources(): opt_sources = {'opts': {''}} @@ -261,14 +257,6 @@ def generate_separated_sources(platform_sources): 'skia/src/ports/SkImageEncoder_none.cpp', 'skia/src/ports/SkImageGenerator_none.cpp', }, - 'android': { - # 'skia/src/ports/SkDebug_android.cpp', - 'skia/src/ports/SkFontHost_cairo.cpp', - # 'skia/src/ports/SkFontHost_FreeType.cpp', - # 'skia/src/ports/SkFontHost_FreeType_common.cpp', - # 'skia/src/ports/SkTime_Unix.cpp', - # 'skia/src/utils/SkThreadUtils_pthread.cpp', - }, 'linux': { 'skia/src/ports/SkFontHost_cairo.cpp', }, @@ -455,9 +443,6 @@ def write_mozbuild(sources): f.write("if CONFIG['MOZ_ENABLE_SKIA_GPU']:\n") write_sources(f, sources['gpu'], 4) - f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'):\n") - write_sources(f, sources['android'], 4) - f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'uikit'}:\n") write_sources(f, sources['mac'], 4) diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build index d2ab9566fe..1d9d342f41 100644 --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -516,18 +516,6 @@ if CONFIG['MOZ_ENABLE_SKIA_GPU']: 'skia/src/gpu/GrResourceCache.cpp', 'skia/src/image/SkImage_Gpu.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'): - SOURCES += [ - 'skia/src/ports/SkDebug_android.cpp', - 'skia/src/ports/SkOSFile_posix.cpp', - 'skia/src/ports/SkOSLibrary_posix.cpp', - 'skia/src/ports/SkTLS_pthread.cpp', - 'skia/src/utils/SkThreadUtils_pthread.cpp', - ] - SOURCES += [ - 'skia/src/ports/SkFontHost_cairo.cpp', - 'skia/src/ports/SkFontHost_FreeType_common.cpp', - ] if CONFIG['MOZ_WIDGET_TOOLKIT'] in {'uikit'}: SOURCES += [ 'skia/src/ports/SkDebug_stdio.cpp', @@ -674,11 +662,7 @@ LOCAL_INCLUDES += [ 'skia/src/utils/win', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android'): - DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0 - if CONFIG['MOZ_WIDGET_TOOLKIT'] in { - 'android', 'gtk2', 'gtk3', 'uikit', @@ -749,7 +733,7 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']: '-Wno-unused-private-field', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] diff --git a/intl/locale/unix/moz.build b/intl/locale/unix/moz.build index 68a151b656..42ea11a697 100644 --- a/intl/locale/unix/moz.build +++ b/intl/locale/unix/moz.build @@ -9,20 +9,15 @@ SOURCES += [ 'nsPosixLocale.cpp', ] -if CONFIG['OS_TARGET'] == 'Android': - SOURCES += [ - 'nsAndroidCharset.cpp', - ] -else: - SOURCES += [ - 'nsUNIXCharset.cpp', - ] - GENERATED_FILES = [ - 'unixcharset.properties.h', - ] - unixcharset = GENERATED_FILES['unixcharset.properties.h'] - unixcharset.script = '../props2arrays.py' - unixcharset.inputs = ['unixcharset.properties'] +SOURCES += [ + 'nsUNIXCharset.cpp', +] +GENERATED_FILES = [ + 'unixcharset.properties.h', +] +unixcharset = GENERATED_FILES['unixcharset.properties.h'] +unixcharset.script = '../props2arrays.py' +unixcharset.inputs = ['unixcharset.properties'] FINAL_LIBRARY = 'xul' @@ -31,6 +26,7 @@ LOCAL_INCLUDES += [ ] # CODESET is not automatically defined on some older versions of Redhat. +# XXXMC: Which ones? Do we still support those older versions? # Define _XOPEN_SOURCE so CODESET will get defined and thus allow # nl_langinfo(CODESET) to compile on these systems. if CONFIG['OS_ARCH'] == 'Linux': diff --git a/intl/locale/unix/nsAndroidCharset.cpp b/intl/locale/unix/nsAndroidCharset.cpp deleted file mode 100644 index ed646039c6..0000000000 --- a/intl/locale/unix/nsAndroidCharset.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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 "nsIPlatformCharset.h" -#include "nsPlatformCharset.h" - -NS_IMPL_ISUPPORTS(nsPlatformCharset, nsIPlatformCharset) - -nsPlatformCharset::nsPlatformCharset() -{ -} - -nsPlatformCharset::~nsPlatformCharset() -{ -} - -NS_IMETHODIMP -nsPlatformCharset::Init() -{ - return NS_OK; -} - -NS_IMETHODIMP -nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) -{ - oResult.AssignLiteral("UTF-8"); - return NS_OK; -} - -NS_IMETHODIMP -nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACString &oResult) -{ - oResult.AssignLiteral("UTF-8"); - return NS_OK; -} - -nsresult -nsPlatformCharset::InitGetCharset(nsACString &oString) -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::VerifyCharset(nsCString &aCharset) -{ - return NS_OK; -} diff --git a/ipc/chromium/moz.build b/ipc/chromium/moz.build index 92dd3b872a..4050307fe9 100644 --- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -124,12 +124,6 @@ if os_linux: 'src/base/process_util_linux.cc', 'src/base/time_posix.cc', ] - if CONFIG['OS_TARGET'] == 'Android': - UNIFIED_SOURCES += [ - 'src/base/message_pump_android.cc', - ] - DEFINES['ANDROID'] = True - DEFINES['_POSIX_MONOTONIC_CLOCK'] = 0 if os_bsd or os_linux or os_solaris: if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: diff --git a/ipc/chromium/src/third_party/libeventcommon.mozbuild b/ipc/chromium/src/third_party/libeventcommon.mozbuild index 43749dcc23..dbef7705eb 100644 --- a/ipc/chromium/src/third_party/libeventcommon.mozbuild +++ b/ipc/chromium/src/third_party/libeventcommon.mozbuild @@ -26,10 +26,7 @@ else: libevent_include_suffix = 'solaris' else: os_linux = 1 - if CONFIG['OS_TARGET'] == 'Android': - libevent_include_suffix = 'android' - else: - libevent_include_suffix = 'linux' + libevent_include_suffix = 'linux' if os_posix: DEFINES['HAVE_CONFIG_H'] = True diff --git a/ipc/chromium/src/third_party/moz.build b/ipc/chromium/src/third_party/moz.build index 6435717688..bc4a80ab98 100644 --- a/ipc/chromium/src/third_party/moz.build +++ b/ipc/chromium/src/third_party/moz.build @@ -44,11 +44,8 @@ if os_macosx or os_bsd: if os_linux: SOURCES += [ 'libevent/epoll.c', + 'libevent/epoll_sub.c', ] - if CONFIG['OS_TARGET'] != 'Android': - SOURCES += [ - 'libevent/epoll_sub.c', - ] if os_solaris: SOURCES += [ diff --git a/media/libaom/moz.build b/media/libaom/moz.build index aedac31022..68da0406c0 100644 --- a/media/libaom/moz.build +++ b/media/libaom/moz.build @@ -27,7 +27,7 @@ if CONFIG['CPU_ARCH'] == 'x86_64': ASFLAGS += [ '-I%s/media/libaom/config/mac/x64/' % TOPSRCDIR ] LOCAL_INCLUDES += [ '/media/libaom/config/mac/x64/' ] EXPORTS.aom += [ 'config/mac/x64/config/aom_config.h' ] - else: # Android, Linux, BSDs, etc. + else: # Linux, SunOS, etc. ASFLAGS += [ '-I%s/media/libaom/config/linux/x64/' % TOPSRCDIR ] LOCAL_INCLUDES += [ '/media/libaom/config/linux/x64/' ] EXPORTS.aom += [ 'config/linux/x64/config/aom_config.h' ] @@ -45,7 +45,7 @@ elif CONFIG['CPU_ARCH'] == 'x86': LOCAL_INCLUDES += [ '/media/libaom/config/win/ia32/' ] EXPORTS.aom += [ 'config/win/ia32/config/aom_config.h' ] NO_PGO = True - else: # Android, Linux, BSDs, etc. + else: # Linux, SunOS, etc. ASFLAGS += [ '-I%s/media/libaom/config/linux/ia32/' % TOPSRCDIR ] LOCAL_INCLUDES += [ '/media/libaom/config/linux/ia32/' ] EXPORTS.aom += [ 'config/linux/ia32/config/aom_config.h' ] @@ -71,11 +71,6 @@ elif CONFIG['CPU_ARCH'] == 'arm': if f.endswith('neon.c'): SOURCES[f].flags += CONFIG['VPX_ASFLAGS'] - if CONFIG['OS_TARGET'] == 'Android': - # For cpu-features.h - LOCAL_INCLUDES += [ - '%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'], - ] if CONFIG['CLANG_CXX']: ASFLAGS += [ '-no-integrated-as', @@ -96,16 +91,6 @@ ALLOW_COMPILER_WARNINGS = True FINAL_LIBRARY = 'gkmedias' -if CONFIG['OS_TARGET'] == 'Android': - # Older versions of the Android NDK don't pre-define anything to indicate - # the OS they're on, so do it for them. - DEFINES['__linux__'] = True - - if not CONFIG['MOZ_WEBRTC']: - SOURCES += [ - '%%%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'], - ] - if CONFIG['CLANG_CL'] or not CONFIG['_MSC_VER']: for f in SOURCES: if f.endswith('sse2.c'): diff --git a/media/libstagefright/moz.build b/media/libstagefright/moz.build index a8876638aa..f1f23eabf7 100644 --- a/media/libstagefright/moz.build +++ b/media/libstagefright/moz.build @@ -35,16 +35,15 @@ elif CONFIG['OS_TARGET'] in ('DragonFly', 'FreeBSD', 'OpenBSD', 'NetBSD', else: DEFINES['HAVE_SYS_UIO_H'] = True -if CONFIG['OS_TARGET'] != 'Android': - DEFINES['FAKE_LOG_DEVICE'] = True - SOURCES += [ - 'system/core/liblog/fake_log_device.c', - ] - UNIFIED_SOURCES += [ - 'system/core/libcutils/strdup16to8.c', - 'system/core/liblog/logd_write.c', - 'system/core/liblog/logprint.c', - ] +DEFINES['FAKE_LOG_DEVICE'] = True +SOURCES += [ + 'system/core/liblog/fake_log_device.c', +] +UNIFIED_SOURCES += [ + 'system/core/libcutils/strdup16to8.c', + 'system/core/liblog/logd_write.c', + 'system/core/liblog/logprint.c', +] EXPORTS.mp4_demuxer += [ 'binding/include/mp4_demuxer/Adts.h', diff --git a/media/libtheora/moz.build b/media/libtheora/moz.build index 0a88d8f92c..8bcdb5fd47 100644 --- a/media/libtheora/moz.build +++ b/media/libtheora/moz.build @@ -94,10 +94,6 @@ if CONFIG['GNU_AS']: 'OC_ARM_ASM_MEDIA', 'OC_ARM_ASM_NEON'): DEFINES[var] = True - # The Android NDK doesn't pre-define anything to indicate the OS it's - # on, so do it for them. - if CONFIG['OS_TARGET'] == 'Android': - DEFINES['__linux__'] = True SOURCES += [ '!%s.s' % f for f in [ 'armbits-gnu', diff --git a/media/libvpx/moz.build b/media/libvpx/moz.build index 1630f6da45..c53ddb2f25 100644 --- a/media/libvpx/moz.build +++ b/media/libvpx/moz.build @@ -45,11 +45,6 @@ if CONFIG['VPX_ARM_ASM']: if f.endswith('.c') and 'neon' in f: SOURCES[f].flags += CONFIG['VPX_ASFLAGS'] - if CONFIG['OS_TARGET'] == 'Android': - # For cpu-features.h - LOCAL_INCLUDES += [ - '%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'], - ] if CONFIG['CLANG_CXX']: ASFLAGS += [ '-no-integrated-as', @@ -72,16 +67,6 @@ FINAL_LIBRARY = 'gkmedias' DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h' -if CONFIG['OS_TARGET'] == 'Android': - # Older versions of the Android NDK don't pre-define anything to indicate - # the OS they're on, so do it for them. - DEFINES['__linux__'] = True - - if not CONFIG['MOZ_WEBRTC']: - SOURCES += [ - '%%%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'], - ] - if CONFIG['CLANG_CL'] or not CONFIG['_MSC_VER']: for f in SOURCES: if f.endswith('.c'): @@ -112,9 +97,3 @@ ASFLAGS += [ '-I%s/media/libvpx/' % TOPSRCDIR, '-I%s/media/libvpx/vpx_ports/' % TOPSRCDIR, ] - -if CONFIG['OS_TARGET'] == 'Android': - # For LIBVPX_RAND - ASFLAGS += [ - '-D__ANDROID__' - ] diff --git a/media/libyuv/PRESUBMIT.py b/media/libyuv/PRESUBMIT.py index 58242bd984..e194fa35a6 100644 --- a/media/libyuv/PRESUBMIT.py +++ b/media/libyuv/PRESUBMIT.py @@ -50,15 +50,6 @@ def GetPreferredTryMasters(project, change): 'linux_msan', 'linux_ubsan', 'linux_ubsan_vptr', - 'android', - 'android_rel', - 'android_clang', - 'android_arm64', - 'android_mips', - 'android_x64', - 'android_x86', - 'android_gn', - 'android_gn_rel', ] if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files): return {} diff --git a/media/libyuv/gyp_libyuv b/media/libyuv/gyp_libyuv index 445b924f16..bce1061a17 100644 --- a/media/libyuv/gyp_libyuv +++ b/media/libyuv/gyp_libyuv @@ -75,7 +75,7 @@ if __name__ == '__main__': # Automatically turn on crosscompile support for platforms that need it. if all(('ninja' in os.environ.get('GYP_GENERATORS', ''), - gyp_vars_dict.get('OS') in ['android', 'ios'], + gyp_vars_dict.get('OS') in ['ios'], 'GYP_CROSSCOMPILE' not in os.environ)): os.environ['GYP_CROSSCOMPILE'] = '1' diff --git a/media/libyuv/setup_links.py b/media/libyuv/setup_links.py index b2b459e60c..b3c8c9a0af 100644 --- a/media/libyuv/setup_links.py +++ b/media/libyuv/setup_links.py @@ -60,27 +60,6 @@ DIRECTORIES = [ from sync_chromium import get_target_os_list target_os = get_target_os_list() -if 'android' in target_os: - DIRECTORIES += [ - 'base', - 'third_party/android_platform', - 'third_party/android_tools', - 'third_party/appurify-python', - 'third_party/ashmem', - 'third_party/catapult', - 'third_party/icu', - 'third_party/ijar', - 'third_party/jsr-305', - 'third_party/junit', - 'third_party/libxml', - 'third_party/mockito', - 'third_party/modp_b64', - 'third_party/protobuf', - 'third_party/requests', - 'third_party/robolectric', - 'tools/android', - 'tools/grit', - ] if 'ios' in target_os: DIRECTORIES.append('third_party/class-dump') diff --git a/media/mtransport/common.build b/media/mtransport/common.build index 3ba5b63efc..eb262df185 100644 --- a/media/mtransport/common.build +++ b/media/mtransport/common.build @@ -61,12 +61,6 @@ elif CONFIG['OS_TARGET'] == 'Linux': LOCAL_INCLUDES += [ '/media/mtransport/third_party/nrappkit/src/port/linux/include', ] -elif CONFIG['OS_TARGET'] == 'Android': - DEFINES['LINUX'] = True - DEFINES['ANDROID'] = True - LOCAL_INCLUDES += [ - '/media/mtransport/third_party/nrappkit/src/port/android/include', - ] elif CONFIG['OS_TARGET'] == 'WINNT': DEFINES['WIN'] = True # for stun.h diff --git a/python/compare-locales/compare_locales/checks.py b/python/compare-locales/compare_locales/checks.py index ee3bef03dd..0faffcc698 100644 --- a/python/compare-locales/compare_locales/checks.py +++ b/python/compare-locales/compare_locales/checks.py @@ -351,88 +351,9 @@ class DTDChecker(Checker): for t in self.processContent(self.texthandler.textcontent): yield t - -class PrincessAndroid(DTDChecker): - """Checker for the string values that Android puts into an XML container. - - http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling # noqa - has more info. Check for unescaped apostrophes and bad unicode escapes. - """ - quoted = re.compile("(?P<q>[\"']).*(?P=q)$") - - def unicode_escape(self, str): - """Helper method to try to decode all unicode escapes in a string. - - This code uses the standard python decode for unicode-escape, but - that's somewhat tricky, as its input needs to be ascii. To get to - ascii, the unicode string gets converted to ascii with - backslashreplace, i.e., all non-ascii unicode chars get unicode - escaped. And then we try to roll all of that back. - Now, when that hits an error, that's from the original string, and we - need to search for the actual error position in the original string, - as the backslashreplace code changes string positions quite badly. - See also the last check in TestAndroid.test_android_dtd, with a - lengthy chinese string. - """ - val = str.encode('ascii', 'backslashreplace') - try: - val.decode('unicode-escape') - except UnicodeDecodeError, e: - args = list(e.args) - badstring = args[1][args[2]:args[3]] - i = len(args[1][:args[2]].decode('unicode-escape')) - args[2] = i - args[3] = i + len(badstring) - raise UnicodeDecodeError(*args) - - @classmethod - def use(cls, file): - """Use this Checker only for DTD files in embedding/android.""" - return (file.module in ("embedding/android", - "mobile/android/base") and - cls.pattern.match(file.file)) - - def processContent(self, val): - """Actual check code. - Check for unicode escapes and unescaped quotes and apostrophes, - if string's not quoted. - """ - # first, try to decode unicode escapes - try: - self.unicode_escape(val) - except UnicodeDecodeError, e: - yield ('error', e.args[2], e.args[4], 'android') - # check for unescaped single or double quotes. - # first, see if the complete string is single or double quoted, - # that changes the rules - m = self.quoted.match(val) - if m: - q = m.group('q') - offset = 0 - val = val[1:-1] # strip quotes - else: - q = "[\"']" - offset = -1 - stray_quot = re.compile(r"[\\\\]*(%s)" % q) - - for m in stray_quot.finditer(val): - if len(m.group(0)) % 2: - # found an unescaped single or double quote, which message? - if m.group(1) == '"': - msg = u"Quotes in Android DTDs need escaping with \\\" "\ - u"or \\u0022, or put string in apostrophes." - else: - msg = u"Apostrophes in Android DTDs need escaping with "\ - u"\\' or \\u0027, or use \u2019, or put string in "\ - u"quotes." - yield ('error', m.end(0)+offset, msg, 'android') - - def getChecker(file, reference=None): if PropertiesChecker.use(file): return PropertiesChecker() - if PrincessAndroid.use(file): - return PrincessAndroid(reference) if DTDChecker.use(file): return DTDChecker(reference) return None diff --git a/python/mozbuild/mozbuild/backend/mach_commands.py b/python/mozbuild/mozbuild/backend/mach_commands.py index 5608d40b11..f2448b2f44 100644 --- a/python/mozbuild/mozbuild/backend/mach_commands.py +++ b/python/mozbuild/mozbuild/backend/mach_commands.py @@ -24,16 +24,13 @@ from mach.decorators import ( class MachCommands(MachCommandBase): @Command('ide', category='devenv', description='Generate a project and launch an IDE.') - @CommandArgument('ide', choices=['eclipse', 'visualstudio', 'androidstudio', 'intellij']) + @CommandArgument('ide', choices=['eclipse', 'visualstudio', 'intellij']) @CommandArgument('args', nargs=argparse.REMAINDER) def eclipse(self, ide, args): if ide == 'eclipse': backend = 'CppEclipse' elif ide == 'visualstudio': backend = 'VisualStudio' - elif ide == 'androidstudio' or ide == 'intellij': - # The build backend for Android Studio and IntelliJ is just the regular one. - backend = 'RecursiveMake' if ide == 'eclipse': try: @@ -42,8 +39,8 @@ class MachCommands(MachCommandBase): print('Eclipse CDT 8.4 or later must be installed in your PATH.') print('Download: http://www.eclipse.org/cdt/downloads.php') return 1 - elif ide == 'androidstudio' or ide =='intellij': - studio = ['studio'] if ide == 'androidstudio' else ['idea'] + elif ide =='intellij': + studio = ['idea'] if sys.platform != 'darwin': try: which.which(studio[0]) @@ -57,7 +54,7 @@ class MachCommands(MachCommandBase): studio = ['open', '-a', d] break else: - print('Android Studio or IntelliJ IDEA 14 is not installed in /Applications.') + print('IntelliJ IDEA 14 is not installed in /Applications.') return 1 # Here we refresh the whole build. 'build export' is sufficient here and is probably more @@ -67,7 +64,7 @@ class MachCommands(MachCommandBase): if res != 0: return 1 - if ide in ('androidstudio', 'intellij'): + if ide in ('intellij'): res = self._mach_context.commands.dispatch('package', self._mach_context) if res != 0: return 1 @@ -87,7 +84,7 @@ class MachCommands(MachCommandBase): elif ide == 'visualstudio': visual_studio_workspace_dir = self.get_visualstudio_workspace_path() process = subprocess.check_call(['explorer.exe', visual_studio_workspace_dir]) - elif ide == 'androidstudio' or ide == 'intellij': + elif ide == 'intellij': gradle_dir = None if self.is_gradle_project_already_imported(): gradle_dir = self.get_gradle_project_path() @@ -103,7 +100,7 @@ class MachCommands(MachCommandBase): return os.path.join(self.topobjdir, 'msvc', 'mozilla.sln') def get_gradle_project_path(self): - return os.path.join(self.topobjdir, 'mobile', 'android', 'gradle') + return os.path.join(self.topobjdir, 'mobile', 'gradle') def get_gradle_import_path(self): return os.path.join(self.get_gradle_project_path(), 'build.gradle') @@ -114,19 +111,13 @@ class MachCommands(MachCommandBase): def get_mac_ide_preferences(self, ide): if sys.platform == 'darwin': - if ide == 'androidstudio': - return ['/Applications/Android Studio.app'] - else: - return [ - '/Applications/IntelliJ IDEA 14 EAP.app', - '/Applications/IntelliJ IDEA 14.app', - '/Applications/IntelliJ IDEA 14 CE EAP.app', - '/Applications/IntelliJ IDEA 14 CE.app'] + return [ + '/Applications/IntelliJ IDEA 14 EAP.app', + '/Applications/IntelliJ IDEA 14.app', + '/Applications/IntelliJ IDEA 14 CE EAP.app', + '/Applications/IntelliJ IDEA 14 CE.app'] def print_ide_error(self, ide): - if ide == 'androidstudio': - print('Android Studio is not installed in your PATH.') - print('You can generate a command-line launcher from Android Studio->Tools->Create Command-line launcher with script name \'studio\'') - elif ide == 'intellij': + if ide == 'intellij': print('IntelliJ is not installed in your PATH.') print('You can generate a command-line launcher from IntelliJ IDEA->Tools->Create Command-line launcher with script name \'idea\'') diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 9db1005d11..24791b6182 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -777,13 +777,6 @@ class MachCommandConditions(object): return False @staticmethod - def is_android(cls): - """Must have an Android build.""" - if hasattr(cls, 'substs'): - return cls.substs.get('MOZ_WIDGET_TOOLKIT') == 'android' - return False - - @staticmethod def is_hg(cls): """Must have a mercurial source checkout.""" if hasattr(cls, 'substs'): diff --git a/python/mozbuild/mozbuild/config_status.py b/python/mozbuild/mozbuild/config_status.py index 3557bbf778..fa15fa65bb 100644 --- a/python/mozbuild/mozbuild/config_status.py +++ b/python/mozbuild/mozbuild/config_status.py @@ -177,7 +177,3 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, if os.name == 'nt' and 'VisualStudio' not in options.backend: print(VISUAL_STUDIO_ADVERTISEMENT) - # Advertise Eclipse if it is appropriate. - if MachCommandConditions.is_android(env): - if 'AndroidEclipse' not in options.backend: - print(ANDROID_IDE_ADVERTISEMENT) diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py index 00d9ff9bbf..a7d84def00 100644 --- a/python/mozbuild/mozbuild/configure/constants.py +++ b/python/mozbuild/mozbuild/configure/constants.py @@ -16,7 +16,6 @@ CompilerType = EnumString.subclass( ) OS = EnumString.subclass( - 'Android', 'DragonFly', 'FreeBSD', 'GNU', diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index bd3fbe921f..d1a1e1393e 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -1149,9 +1149,6 @@ class Install(MachCommandBase): @CommandArgument('--verbose', '-v', action='store_true', help='Print verbose output when installing to an Android emulator.') def install(self, verbose=False): - if conditions.is_android(self): - from mozrunner.devices.android_device import verify_android_device - verify_android_device(self, verbose=verbose) ret = self._run_make(directory=".", target='install', ensure_exit_code=False) if ret == 0: self.notify('Install complete') @@ -1205,47 +1202,33 @@ class RunProgram(MachCommandBase): def run(self, params, remote, background, noprofile, disable_e10s, debug, debugger, debugparams, slowscript, dmd, mode, stacks, show_dump_stats): - if conditions.is_android(self): - # Running Firefox for Android is completely different - if dmd: - print("DMD is not supported for Firefox for Android") - return 1 - from mozrunner.devices.android_device import verify_android_device, run_firefox_for_android - if not (debug or debugger or debugparams): - verify_android_device(self, install=True) - return run_firefox_for_android(self, params) - verify_android_device(self, install=True, debugger=True) - args = [''] - - else: - - try: - binpath = self.get_binary_path('app') - except Exception as e: - print("It looks like your program isn't built.", - "You can run |mach build| to build it.") - print(e) - return 1 + try: + binpath = self.get_binary_path('app') + except Exception as e: + print("It looks like your program isn't built.", + "You can run |mach build| to build it.") + print(e) + return 1 - args = [binpath] + args = [binpath] - if params: - args.extend(params) + if params: + args.extend(params) - if not remote: - args.append('-no-remote') + if not remote: + args.append('-no-remote') - if not background and sys.platform == 'darwin': - args.append('-foreground') + if not background and sys.platform == 'darwin': + args.append('-foreground') - no_profile_option_given = \ - all(p not in params for p in ['-profile', '--profile', '-P']) - if no_profile_option_given and not noprofile: - path = os.path.join(self.topobjdir, 'tmp', 'scratch_user') - if not os.path.isdir(path): - os.makedirs(path) - args.append('-profile') - args.append(path) + no_profile_option_given = \ + all(p not in params for p in ['-profile', '--profile', '-P']) + if no_profile_option_given and not noprofile: + path = os.path.join(self.topobjdir, 'tmp', 'scratch_user') + if not os.path.isdir(path): + os.makedirs(path) + args.append('-profile') + args.append(path) extra_env = {'MOZ_CRASHREPORTER_DISABLE': '1'} if disable_e10s: diff --git a/services/common/moz.build b/services/common/moz.build index d315ed624f..855f71f5b9 100644 --- a/services/common/moz.build +++ b/services/common/moz.build @@ -3,9 +3,6 @@ # 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/. -with Files('**'): - BUG_COMPONENT = ('Mozilla Services', 'Firefox: Common') - TEST_DIRS += ['tests'] EXTRA_COMPONENTS += [ @@ -14,26 +11,19 @@ EXTRA_COMPONENTS += [ EXTRA_JS_MODULES['services-common'] += [ 'async.js', + 'hawkclient.js', + 'hawkrequest.js', 'logmanager.js', 'observers.js', 'rest.js', 'stringbundle.js', + 'tokenserverclient.js', 'utils.js', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - EXTRA_JS_MODULES['services-common'] += [ - 'hawkclient.js', - 'hawkrequest.js', - 'tokenserverclient.js', - ] - - TESTING_JS_MODULES.services.common += [ - 'modules-testing/storageserver.js', - ] - TESTING_JS_MODULES.services.common += [ 'modules-testing/logging.js', + 'modules-testing/storageserver.js', 'modules-testing/utils.js', ] diff --git a/storage/moz.build b/storage/moz.build index d1ad9229f1..02e421b4b2 100644 --- a/storage/moz.build +++ b/storage/moz.build @@ -84,15 +84,11 @@ include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' -# Don't use the jemalloc allocator on Android, because we can't guarantee -# that Gecko will configure sqlite before it is first used (bug 730495). -# # Note: On Windows our sqlite build assumes we use jemalloc. If you disable # MOZ_STORAGE_MEMORY on Windows, you will also need to change the "ifdef # MOZ_MEMORY" options in db/sqlite3/src/Makefile.in. if CONFIG['MOZ_MEMORY']: - if CONFIG['OS_TARGET'] != 'Android': - DEFINES['MOZ_STORAGE_MEMORY'] = True + DEFINES['MOZ_STORAGE_MEMORY'] = True # This is the default value. If we ever change it when compiling sqlite, we # will need to change it here as well. diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index fb261ec827..a667c05488 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -60,15 +60,6 @@ test path(s): Please check spelling and make sure there are mochitests living there. '''.lstrip() -ROBOCOP_TESTS_NOT_FOUND = ''' -The robocop command could not find any tests under the following -test path(s): - -{} - -Please check spelling and make sure the named tests exist. -'''.lstrip() - NOW_RUNNING = ''' ###### ### Now running mochitest-{}. @@ -236,28 +227,6 @@ class MochitestRunner(MozbuildObject): return runtestsremote.run_test_harness(parser, options) - def run_robocop_test(self, context, tests, suite=None, **kwargs): - host_ret = verify_host_bin() - if host_ret != 0: - return host_ret - - import imp - path = os.path.join(self.mochitest_dir, 'runrobocop.py') - with open(path, 'r') as fh: - imp.load_module('runrobocop', fh, path, - ('.py', 'r', imp.PY_SOURCE)) - import runrobocop - - options = Namespace(**kwargs) - - from manifestparser import TestManifest - if tests and not options.manifestFile: - manifest = TestManifest() - manifest.tests.extend(tests) - options.manifestFile = manifest - - return runrobocop.run_test_harness(parser, options) - # parser @@ -281,14 +250,6 @@ def setup_argument_parser(): from mochitest_options import MochitestArgumentParser - if conditions.is_android(build_obj): - # On Android, check for a connected device (and offer to start an - # emulator if appropriate) before running tests. This check must - # be done in this admittedly awkward place because - # MochitestArgumentParser initialization fails if no device is found. - from mozrunner.devices.android_device import verify_android_device - verify_android_device(build_obj, install=True, xre=True) - global parser parser = MochitestArgumentParser() return parser @@ -467,55 +428,6 @@ class MachCommands(MachCommandBase): # TODO consolidate summaries from all suites return overall - -@CommandProvider -class RobocopCommands(MachCommandBase): - - @Command('robocop', category='testing', - conditions=[conditions.is_android], - description='Run a Robocop test.', - parser=setup_argument_parser) - @CommandArgument('--serve', default=False, action='store_true', - help='Run no tests but start the mochi.test web server ' - 'and launch Fennec with a test profile.') - def run_robocop(self, serve=False, **kwargs): - if serve: - kwargs['autorun'] = False - - if not kwargs.get('robocopIni'): - kwargs['robocopIni'] = os.path.join(self.topobjdir, '_tests', 'testing', - 'mochitest', 'robocop.ini') - - if not kwargs.get('robocopApk'): - kwargs['robocopApk'] = os.path.join(self.topobjdir, 'mobile', 'android', - 'tests', 'browser', 'robocop', - 'robocop-debug.apk') - - from mozbuild.controller.building import BuildDriver - self._ensure_state_subdir_exists('.') - - test_paths = kwargs['test_paths'] - kwargs['test_paths'] = [] - - from mozbuild.testing import TestResolver - resolver = self._spawn(TestResolver) - tests = list(resolver.resolve_tests(paths=test_paths, cwd=self._mach_context.cwd, - flavor='instrumentation', subsuite='robocop')) - driver = self._spawn(BuildDriver) - driver.install_tests(tests) - - if len(tests) < 1: - print(ROBOCOP_TESTS_NOT_FOUND.format('\n'.join( - sorted(list(test_paths))))) - return 1 - - from mozrunner.devices.android_device import grant_runtime_permissions - grant_runtime_permissions(self) - - mochitest = self._spawn(MochitestRunner) - return mochitest.run_robocop_test(self._mach_context, tests, 'robocop', **kwargs) - - # NOTE python/mach/mach/commands/commandinfo.py references this function # by name. If this function is renamed or removed, that file should # be updated accordingly as well. diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py index 9e61670a51..796a29b0dc 100644 --- a/testing/mochitest/mochitest_options.py +++ b/testing/mochitest/mochitest_options.py @@ -868,16 +868,6 @@ class AndroidArguments(ArgumentContainer): "help": "ssl port of the remote web server", "suppress": True, }], - [["--robocop-ini"], - {"dest": "robocopIni", - "default": "", - "help": "name of the .ini file containing the list of tests to run", - }], - [["--robocop-apk"], - {"dest": "robocopApk", - "default": "", - "help": "name of the Robocop APK to use for ADB test running", - }], [["--remoteTestRoot"], {"dest": "remoteTestRoot", "default": None, @@ -964,36 +954,6 @@ class AndroidArguments(ArgumentContainer): f.write("%s" % os.getpid()) f.close() - # Robocop specific options - if options.robocopIni != "": - if not os.path.exists(options.robocopIni): - parser.error( - "Unable to find specified robocop .ini manifest '%s'" % - options.robocopIni) - options.robocopIni = os.path.abspath(options.robocopIni) - - if not options.robocopApk and build_obj: - options.robocopApk = os.path.join(build_obj.topobjdir, 'mobile', 'android', - 'tests', 'browser', - 'robocop', 'robocop-debug.apk') - - if options.robocopApk != "": - if not os.path.exists(options.robocopApk): - parser.error( - "Unable to find robocop APK '%s'" % - options.robocopApk) - options.robocopApk = os.path.abspath(options.robocopApk) - - # Disable e10s by default on Android because we don't run Android - # e10s jobs anywhere yet. - options.e10s = False - mozinfo.update({'e10s': options.e10s}) - - # allow us to keep original application around for cleanup while - # running robocop via 'am' - options.remoteappname = options.app - return options - container_map = { 'generic': [MochitestArguments], diff --git a/testing/mochitest/moz.build b/testing/mochitest/moz.build index 16f7154112..e1397df095 100644 --- a/testing/mochitest/moz.build +++ b/testing/mochitest/moz.build @@ -60,7 +60,6 @@ TEST_HARNESS_FILES.testing.mochitest += [ 'nested_setup.js', 'pywebsocket_wrapper.py', 'redirect.html', - 'runrobocop.py', 'runtests.py', 'runtestsremote.py', 'server.js', diff --git a/testing/mochitest/runrobocop.py b/testing/mochitest/runrobocop.py deleted file mode 100644 index c95964e8d3..0000000000 --- a/testing/mochitest/runrobocop.py +++ /dev/null @@ -1,587 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import json -import os -import shutil -import sys -import tempfile -import traceback - -sys.path.insert( - 0, os.path.abspath( - os.path.realpath( - os.path.dirname(__file__)))) - -from automation import Automation -from remoteautomation import RemoteAutomation, fennecLogcatFilters -from runtests import KeyValueParseError, MochitestDesktop, MessageLogger, parseKeyValue -from mochitest_options import MochitestArgumentParser - -from manifestparser import TestManifest -from manifestparser.filters import chunk_by_slice -import mozdevice -import mozinfo - -SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) - - -class RobocopTestRunner(MochitestDesktop): - """ - A test harness for Robocop. Robocop tests are UI tests for Firefox for Android, - based on the Robotium test framework. This harness leverages some functionality - from mochitest, for convenience. - """ - auto = None - dm = None - # Some robocop tests run for >60 seconds without generating any output. - NO_OUTPUT_TIMEOUT = 180 - - def __init__(self, automation, devmgr, options): - """ - Simple one-time initialization. - """ - MochitestDesktop.__init__(self, options) - - self.auto = automation - self.dm = devmgr - self.dm.default_timeout = 320 - self.options = options - self.options.logFile = "robocop.log" - self.environment = self.auto.environment - self.deviceRoot = self.dm.getDeviceRoot() - self.remoteProfile = options.remoteTestRoot + "/profile" - self.remoteProfileCopy = options.remoteTestRoot + "/profile-copy" - self.auto.setRemoteProfile(self.remoteProfile) - self.remoteConfigFile = os.path.join( - self.deviceRoot, "robotium.config") - self.remoteLog = options.remoteLogFile - self.auto.setRemoteLog(self.remoteLog) - self.remoteScreenshots = "/mnt/sdcard/Robotium-Screenshots" - self.remoteMozLog = os.path.join(options.remoteTestRoot, "mozlog") - self.auto.setServerInfo( - self.options.webServer, self.options.httpPort, self.options.sslPort) - self.localLog = options.logFile - self.localProfile = None - productPieces = self.options.remoteProductName.split('.') - if (productPieces is not None): - self.auto.setProduct(productPieces[0]) - else: - self.auto.setProduct(self.options.remoteProductName) - self.auto.setAppName(self.options.remoteappname) - self.certdbNew = True - self.remoteCopyAvailable = True - self.passed = 0 - self.failed = 0 - self.todo = 0 - - def startup(self): - """ - Second-stage initialization: One-time initialization which may require cleanup. - """ - # Despite our efforts to clean up servers started by this script, in practice - # we still see infrequent cases where a process is orphaned and interferes - # with future tests, typically because the old server is keeping the port in use. - # Try to avoid those failures by checking for and killing orphan servers before - # trying to start new ones. - self.killNamedOrphans('ssltunnel') - self.killNamedOrphans('xpcshell') - self.auto.deleteANRs() - self.auto.deleteTombstones() - self.dm.killProcess(self.options.app.split('/')[-1]) - self.dm.removeDir(self.remoteScreenshots) - self.dm.removeDir(self.remoteMozLog) - self.dm.mkDir(self.remoteMozLog) - self.dm.mkDir(os.path.dirname(self.options.remoteLogFile)) - # Add Android version (SDK level) to mozinfo so that manifest entries - # can be conditional on android_version. - androidVersion = self.dm.shellCheckOutput( - ['getprop', 'ro.build.version.sdk']) - self.log.info( - "Android sdk version '%s'; will use this to filter manifests" % - str(androidVersion)) - mozinfo.info['android_version'] = androidVersion - if (self.options.dm_trans == 'adb' and self.options.robocopApk): - self.dm._checkCmd(["install", "-r", self.options.robocopApk]) - self.log.debug("Robocop APK %s installed" % - self.options.robocopApk) - # Display remote diagnostics; if running in mach, keep output terse. - if self.options.log_mach is None: - self.printDeviceInfo() - self.setupLocalPaths() - self.buildProfile() - # ignoreSSLTunnelExts is a workaround for bug 1109310 - self.startServers( - self.options, - debuggerInfo=None, - ignoreSSLTunnelExts=True) - self.log.debug("Servers started") - - def cleanup(self): - """ - Cleanup at end of job run. - """ - self.log.debug("Cleaning up...") - self.stopServers() - self.dm.killProcess(self.options.app.split('/')[-1]) - blobberUploadDir = os.environ.get('MOZ_UPLOAD_DIR', None) - if blobberUploadDir: - self.log.debug("Pulling any remote moz logs and screenshots to %s." % - blobberUploadDir) - self.dm.getDirectory(self.remoteMozLog, blobberUploadDir) - self.dm.getDirectory(self.remoteScreenshots, blobberUploadDir) - MochitestDesktop.cleanup(self, self.options) - if self.localProfile: - os.system("rm -Rf %s" % self.localProfile) - self.dm.removeDir(self.remoteProfile) - self.dm.removeDir(self.remoteProfileCopy) - self.dm.removeDir(self.remoteScreenshots) - self.dm.removeDir(self.remoteMozLog) - self.dm.removeFile(self.remoteConfigFile) - if self.dm.fileExists(self.remoteLog): - self.dm.removeFile(self.remoteLog) - self.log.debug("Cleanup complete.") - - def findPath(self, paths, filename=None): - for path in paths: - p = path - if filename: - p = os.path.join(p, filename) - if os.path.exists(self.getFullPath(p)): - return path - return None - - def makeLocalAutomation(self): - localAutomation = Automation() - localAutomation.IS_WIN32 = False - localAutomation.IS_LINUX = False - localAutomation.IS_MAC = False - localAutomation.UNIXISH = False - hostos = sys.platform - if (hostos == 'mac' or hostos == 'darwin'): - localAutomation.IS_MAC = True - elif (hostos == 'linux' or hostos == 'linux2'): - localAutomation.IS_LINUX = True - localAutomation.UNIXISH = True - elif (hostos == 'win32' or hostos == 'win64'): - localAutomation.BIN_SUFFIX = ".exe" - localAutomation.IS_WIN32 = True - return localAutomation - - def setupLocalPaths(self): - """ - Setup xrePath and utilityPath and verify xpcshell. - - This is similar to switchToLocalPaths in runtestsremote.py. - """ - localAutomation = self.makeLocalAutomation() - paths = [ - self.options.xrePath, - localAutomation.DIST_BIN, - self.auto._product, - os.path.join('..', self.auto._product) - ] - self.options.xrePath = self.findPath(paths) - if self.options.xrePath is None: - self.log.error( - "unable to find xulrunner path for %s, please specify with --xre-path" % - os.name) - sys.exit(1) - self.log.debug("using xre path %s" % self.options.xrePath) - xpcshell = "xpcshell" - if (os.name == "nt"): - xpcshell += ".exe" - if self.options.utilityPath: - paths = [self.options.utilityPath, self.options.xrePath] - else: - paths = [self.options.xrePath] - self.options.utilityPath = self.findPath(paths, xpcshell) - if self.options.utilityPath is None: - self.log.error( - "unable to find utility path for %s, please specify with --utility-path" % - os.name) - sys.exit(1) - self.log.debug("using utility path %s" % self.options.utilityPath) - xpcshell_path = os.path.join(self.options.utilityPath, xpcshell) - if localAutomation.elf_arm(xpcshell_path): - self.log.error('xpcshell at %s is an ARM binary; please use ' - 'the --utility-path argument to specify the path ' - 'to a desktop version.' % xpcshell_path) - sys.exit(1) - self.log.debug("xpcshell found at %s" % xpcshell_path) - - def buildProfile(self): - """ - Build a profile locally, keep it locally for use by servers and - push a copy to the remote profile-copy directory. - - This is similar to buildProfile in runtestsremote.py. - """ - self.options.extraPrefs.append('browser.search.suggest.enabled=true') - self.options.extraPrefs.append('browser.search.suggest.prompted=true') - self.options.extraPrefs.append('layout.css.devPixelsPerPx=1.0') - self.options.extraPrefs.append('browser.chrome.dynamictoolbar=false') - self.options.extraPrefs.append('browser.snippets.enabled=false') - self.options.extraPrefs.append('browser.casting.enabled=true') - self.options.extraPrefs.append('extensions.autoupdate.enabled=false') - - # Override the telemetry init delay for integration testing. - self.options.extraPrefs.append('toolkit.telemetry.initDelay=1') - - self.options.extensionsToExclude.extend([ - 'mochikit@mozilla.org', - 'worker-test@mozilla.org.xpi', - 'workerbootstrap-test@mozilla.org.xpi', - 'indexedDB-test@mozilla.org.xpi', - ]) - - manifest = MochitestDesktop.buildProfile(self, self.options) - self.localProfile = self.options.profilePath - self.log.debug("Profile created at %s" % self.localProfile) - # some files are not needed for robocop; save time by not pushing - shutil.rmtree(os.path.join(self.localProfile, 'webapps')) - os.remove(os.path.join(self.localProfile, 'userChrome.css')) - try: - self.dm.pushDir(self.localProfile, self.remoteProfileCopy) - except mozdevice.DMError: - self.log.error( - "Automation Error: Unable to copy profile to device.") - raise - - return manifest - - def setupRemoteProfile(self): - """ - Remove any remote profile and re-create it. - """ - self.log.debug("Updating remote profile at %s" % self.remoteProfile) - self.dm.removeDir(self.remoteProfile) - if self.remoteCopyAvailable: - try: - self.dm.shellCheckOutput( - ['cp', '-r', self.remoteProfileCopy, self.remoteProfile], - root=True, timeout=60) - except mozdevice.DMError: - # For instance, cp is not available on some older versions of - # Android. - self.log.info( - "Unable to copy remote profile; falling back to push.") - self.remoteCopyAvailable = False - if not self.remoteCopyAvailable: - self.dm.pushDir(self.localProfile, self.remoteProfile) - - def parseLocalLog(self): - """ - Read and parse the local log file, noting any failures. - """ - with open(self.localLog) as currentLog: - data = currentLog.readlines() - os.unlink(self.localLog) - start_found = False - end_found = False - fail_found = False - for line in data: - try: - message = json.loads(line) - if not isinstance(message, dict) or 'action' not in message: - continue - except ValueError: - continue - if message['action'] == 'test_end': - end_found = True - start_found = False - break - if start_found and not end_found: - if 'status' in message: - if 'expected' in message: - self.failed += 1 - elif message['status'] == 'PASS': - self.passed += 1 - elif message['status'] == 'FAIL': - self.todo += 1 - if message['action'] == 'test_start': - start_found = True - if 'expected' in message: - fail_found = True - result = 0 - if fail_found: - result = 1 - if not end_found: - self.log.info( - "PROCESS-CRASH | Automation Error: Missing end of test marker (process crashed?)") - result = 1 - return result - - def logTestSummary(self): - """ - Print a summary of all tests run to stdout, for treeherder parsing - (logging via self.log does not work here). - """ - print("0 INFO TEST-START | Shutdown") - print("1 INFO Passed: %s" % (self.passed)) - print("2 INFO Failed: %s" % (self.failed)) - print("3 INFO Todo: %s" % (self.todo)) - print("4 INFO SimpleTest FINISHED") - if self.failed > 0: - return 1 - return 0 - - def printDeviceInfo(self, printLogcat=False): - """ - Log remote device information and logcat (if requested). - - This is similar to printDeviceInfo in runtestsremote.py - """ - try: - if printLogcat: - logcat = self.dm.getLogcat( - filterOutRegexps=fennecLogcatFilters) - self.log.info( - '\n' + - ''.join(logcat).decode( - 'utf-8', - 'replace')) - self.log.info("Device info:") - devinfo = self.dm.getInfo() - for category in devinfo: - if type(devinfo[category]) is list: - self.log.info(" %s:" % category) - for item in devinfo[category]: - self.log.info(" %s" % item) - else: - self.log.info(" %s: %s" % (category, devinfo[category])) - self.log.info("Test root: %s" % self.dm.deviceRoot) - except mozdevice.DMError: - self.log.warning("Error getting device information") - - def setupRobotiumConfig(self, browserEnv): - """ - Create robotium.config and push it to the device. - """ - fHandle = tempfile.NamedTemporaryFile(suffix='.config', - prefix='robotium-', - dir=os.getcwd(), - delete=False) - fHandle.write("profile=%s\n" % (self.remoteProfile)) - fHandle.write("logfile=%s\n" % (self.options.remoteLogFile)) - fHandle.write("host=http://mochi.test:8888/tests\n") - fHandle.write( - "rawhost=http://%s:%s/tests\n" % - (self.options.remoteWebServer, self.options.httpPort)) - if browserEnv: - envstr = "" - delim = "" - for key, value in browserEnv.items(): - try: - value.index(',') - self.log.error("setupRobotiumConfig: browserEnv - Found a ',' " - "in our value, unable to process value. key=%s,value=%s" % - (key, value)) - self.log.error("browserEnv=%s" % browserEnv) - except ValueError: - envstr += "%s%s=%s" % (delim, key, value) - delim = "," - fHandle.write("envvars=%s\n" % envstr) - fHandle.close() - self.dm.removeFile(self.remoteConfigFile) - self.dm.pushFile(fHandle.name, self.remoteConfigFile) - os.unlink(fHandle.name) - - def buildBrowserEnv(self): - """ - Return an environment dictionary suitable for remote use. - - This is similar to buildBrowserEnv in runtestsremote.py. - """ - browserEnv = self.environment( - xrePath=None, - debugger=None) - # remove desktop environment not used on device - if "MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA" in browserEnv: - del browserEnv["MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA"] - if "XPCOM_MEM_BLOAT_LOG" in browserEnv: - del browserEnv["XPCOM_MEM_BLOAT_LOG"] - browserEnv["MOZ_LOG_FILE"] = os.path.join( - self.remoteMozLog, - self.mozLogName) - - try: - browserEnv.update( - dict( - parseKeyValue( - self.options.environment, - context='--setenv'))) - except KeyValueParseError as e: - self.log.error(str(e)) - return None - - return browserEnv - - def runSingleTest(self, test): - """ - Run the specified test. - """ - self.log.debug("Running test %s" % test['name']) - self.mozLogName = "moz-%s.log" % test['name'] - browserEnv = self.buildBrowserEnv() - self.setupRobotiumConfig(browserEnv) - self.setupRemoteProfile() - self.options.app = "am" - if self.options.autorun: - # This launches a test (using "am instrument") and instructs - # Fennec to /quit/ the browser (using Robocop:Quit) and to - # /finish/ all opened activities. - browserArgs = [ - "instrument", - "-w", - "-e", "quit_and_finish", "1", - "-e", "deviceroot", self.deviceRoot, - "-e", "class", - "org.mozilla.gecko.tests.%s" % test['name'].split('/')[-1].split('.java')[0], - "org.mozilla.roboexample.test/org.mozilla.gecko.FennecInstrumentationTestRunner"] - else: - # This does not launch a test at all. It launches an activity - # that starts Fennec and then waits indefinitely, since cat - # never returns. - browserArgs = ["start", "-n", - "org.mozilla.roboexample.test/org.mozilla." - "gecko.LaunchFennecWithConfigurationActivity", "&&", "cat"] - self.dm.default_timeout = sys.maxint # Forever. - self.log.info("") - self.log.info("Serving mochi.test Robocop root at http://%s:%s/tests/robocop/" % - (self.options.remoteWebServer, self.options.httpPort)) - self.log.info("") - result = -1 - log_result = -1 - try: - self.dm.recordLogcat() - timeout = self.options.timeout - if not timeout: - timeout = self.NO_OUTPUT_TIMEOUT - result = self.auto.runApp( - None, browserEnv, "am", self.localProfile, browserArgs, - timeout=timeout, symbolsPath=self.options.symbolsPath) - self.log.debug("runApp completes with status %d" % result) - if result != 0: - self.log.error("runApp() exited with code %s" % result) - if self.dm.fileExists(self.remoteLog): - self.dm.getFile(self.remoteLog, self.localLog) - self.dm.removeFile(self.remoteLog) - self.log.debug("Remote log %s retrieved to %s" % - (self.remoteLog, self.localLog)) - else: - self.log.warning( - "Unable to retrieve log file (%s) from remote device" % - self.remoteLog) - log_result = self.parseLocalLog() - if result != 0 or log_result != 0: - # Display remote diagnostics; if running in mach, keep output - # terse. - if self.options.log_mach is None: - self.printDeviceInfo(printLogcat=True) - except: - self.log.error( - "Automation Error: Exception caught while running tests") - traceback.print_exc() - result = 1 - self.log.debug("Test %s completes with status %d (log status %d)" % - (test['name'], int(result), int(log_result))) - return result - - def runTests(self): - self.startup() - if isinstance(self.options.manifestFile, TestManifest): - mp = self.options.manifestFile - else: - mp = TestManifest(strict=False) - mp.read(self.options.robocopIni) - filters = [] - if self.options.totalChunks: - filters.append( - chunk_by_slice(self.options.thisChunk, self.options.totalChunks)) - robocop_tests = mp.active_tests( - exists=False, filters=filters, **mozinfo.info) - if not self.options.autorun: - # Force a single loop iteration. The iteration will start Fennec and - # the httpd server, but not actually run a test. - self.options.test_paths = [robocop_tests[0]['name']] - active_tests = [] - for test in robocop_tests: - if self.options.test_paths and test['name'] not in self.options.test_paths: - continue - if 'disabled' in test: - self.log.info('TEST-INFO | skipping %s | %s' % - (test['name'], test['disabled'])) - continue - active_tests.append(test) - self.log.suite_start([t['name'] for t in active_tests]) - worstTestResult = None - for test in active_tests: - result = self.runSingleTest(test) - if worstTestResult is None or worstTestResult == 0: - worstTestResult = result - if worstTestResult is None: - self.log.warning( - "No tests run. Did you pass an invalid TEST_PATH?") - worstTestResult = 1 - else: - print "INFO | runtests.py | Test summary: start." - logResult = self.logTestSummary() - print "INFO | runtests.py | Test summary: end." - if worstTestResult == 0: - worstTestResult = logResult - return worstTestResult - - -def run_test_harness(parser, options): - parser.validate(options) - - if options is None: - raise ValueError( - "Invalid options specified, use --help for a list of valid options") - message_logger = MessageLogger(logger=None) - process_args = {'messageLogger': message_logger} - auto = RemoteAutomation(None, "fennec", processArgs=process_args) - auto.setDeviceManager(options.dm) - runResult = -1 - robocop = RobocopTestRunner(auto, options.dm, options) - - # Check that Firefox is installed - expected = options.app.split('/')[-1] - installed = options.dm.shellCheckOutput(['pm', 'list', 'packages', expected]) - if expected not in installed: - robocop.log.error("%s is not installed on this device" % expected) - return 1 - - try: - message_logger.logger = robocop.log - message_logger.buffering = False - robocop.message_logger = message_logger - robocop.log.debug("options=%s" % vars(options)) - runResult = robocop.runTests() - except KeyboardInterrupt: - robocop.log.info("runrobocop.py | Received keyboard interrupt") - runResult = -1 - except: - traceback.print_exc() - robocop.log.error( - "runrobocop.py | Received unexpected exception while running tests") - runResult = 1 - finally: - try: - robocop.cleanup() - except mozdevice.DMError: - # ignore device error while cleaning up - pass - message_logger.finish() - return runResult - - -def main(args=sys.argv[1:]): - parser = MochitestArgumentParser(app='android') - options = parser.parse_args(args) - return run_test_harness(parser, options) - -if __name__ == "__main__": - sys.exit(main()) diff --git a/testing/mozharness/mozharness/mozilla/building/buildbase.py b/testing/mozharness/mozharness/mozilla/building/buildbase.py index 8a2e172cbd..9fd507816d 100755 --- a/testing/mozharness/mozharness/mozilla/building/buildbase.py +++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py @@ -100,7 +100,6 @@ class MakeUploadOutputParser(OutputParser): ('symbolsUrl', "m.endswith('crashreporter-symbols.zip') or " "m.endswith('crashreporter-symbols-full.zip')"), ('testsUrl', "m.endswith(('tests.tar.bz2', 'tests.zip'))"), - ('robocopApkUrl', "m.endswith('apk') and 'robocop' in m"), ('jsshellUrl', "'jsshell-' in m and m.endswith('.zip')"), ('partialMarUrl', "m.endswith('.mar') and '.partial.' in m"), ('completeMarUrl', "m.endswith('.mar')"), @@ -1497,7 +1496,6 @@ or run without that action (ie: --no-{action})" ('symbolsUrl', lambda m: m.endswith('crashreporter-symbols.zip') or m.endswith('crashreporter-symbols-full.zip')), ('testsUrl', lambda m: m.endswith(('tests.tar.bz2', 'tests.zip'))), - ('robocopApkUrl', lambda m: m.endswith('apk') and 'robocop' in m), ('jsshellUrl', lambda m: 'jsshell-' in m and m.endswith('.zip')), # Temporarily use "TC" in MarUrl parameters. We don't want to # override these to point to taskcluster just yet, and still diff --git a/testing/mozharness/mozharness/mozilla/testing/errors.py b/testing/mozharness/mozharness/mozilla/testing/errors.py index 3937b28c43..3061b5f16d 100644 --- a/testing/mozharness/mozharness/mozilla/testing/errors.py +++ b/testing/mozharness/mozharness/mozilla/testing/errors.py @@ -62,7 +62,6 @@ TinderBoxPrintRe = { 'fail_group': "Unexpected", 'known_fail_group': "Known problems", }, - "robocop_summary": _mochitest_summary, "instrumentation_summary": _mochitest_summary, "cppunittest_summary": { 'regex': re.compile(r'''cppunittests INFO \| (Passed|Failed): (\d+)'''), diff --git a/testing/mozharness/mozharness/mozilla/testing/testbase.py b/testing/mozharness/mozharness/mozilla/testing/testbase.py index 9f13ae1003..2ab2b7e43a 100755 --- a/testing/mozharness/mozharness/mozilla/testing/testbase.py +++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py @@ -427,7 +427,6 @@ You can set this by: # This is a difference in the convention of the configs more than # to how these tests are run, so we pave over these differences here. aliases = { - 'robocop': 'mochitest', 'mochitest-chrome': 'mochitest', 'mochitest-media': 'mochitest', 'mochitest-plain-clipboard': 'mochitest', diff --git a/testing/mozharness/scripts/android_emulator_unittest.py b/testing/mozharness/scripts/android_emulator_unittest.py index 2d17b9cb65..84c5447ed3 100644 --- a/testing/mozharness/scripts/android_emulator_unittest.py +++ b/testing/mozharness/scripts/android_emulator_unittest.py @@ -113,7 +113,6 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin self.test_url = c.get('test_url') self.test_packages_url = c.get('test_packages_url') self.test_manifest = c.get('test_manifest') - self.robocop_path = os.path.join(abs_dirs['abs_work_dir'], "robocop.apk") self.minidump_stackwalk_path = c.get("minidump_stackwalk_path") self.emulator = c.get('emulator') self.test_suite = c.get('test_suite') @@ -359,17 +358,6 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin install_ok = True return install_ok - def _install_robocop_apk(self): - install_ok = False - if int(self.sdk_level) >= 23: - cmd = [self.adb_path, '-s', self.emulator['device_id'], 'install', '-r', '-g', self.robocop_path] - else: - cmd = [self.adb_path, '-s', self.emulator['device_id'], 'install', '-r', self.robocop_path] - out = self._run_with_timeout(300, cmd) - if 'Success' in out: - install_ok = True - return install_ok - def _dump_host_state(self): self._run_proc(['ps', '-ef']) self._run_proc(['netstat', '-a', '-p', '-n', '-t', '-u']) @@ -642,14 +630,10 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin def download_and_extract(self): """ - Download and extract fennec APK, tests.zip, host utils, and robocop (if required). + Download and extract fennec APK, tests.zip, host utils (if required). """ super(AndroidEmulatorTest, self).download_and_extract(suite_categories=[self.test_suite]) dirs = self.query_abs_dirs() - if self.test_suite.startswith('robocop'): - robocop_url = self.installer_url[:self.installer_url.rfind('/')] + '/robocop.apk' - self.info("Downloading robocop...") - self.download_file(robocop_url, 'robocop.apk', dirs['abs_work_dir'], error_level=FATAL) self.rmtree(dirs['abs_xre_dir']) self.mkdir_p(dirs['abs_xre_dir']) if self.config["hostutils_manifest_path"]: @@ -682,12 +666,6 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin if not install_ok: self.fatal('INFRA-ERROR: Failed to install %s on %s' % (self.installer_path, self.emulator["name"])) - # Install Robocop if required - if self.test_suite.startswith('robocop'): - install_ok = self._retry(3, 30, self._install_robocop_apk, "Install Robocop APK") - if not install_ok: - self.fatal('INFRA-ERROR: Failed to install %s on %s' % (self.robocop_path, self.emulator["name"])) - self.info("Finished installing apps for %s" % self.emulator["name"]) def run_tests(self): diff --git a/testing/mozharness/scripts/release/antivirus.py b/testing/mozharness/scripts/release/antivirus.py index b40dc5cc01..a28c3fd2f5 100644 --- a/testing/mozharness/scripts/release/antivirus.py +++ b/testing/mozharness/scripts/release/antivirus.py @@ -69,7 +69,6 @@ class AntivirusScan(BaseScript, VirtualenvMixin): r"^.*json$", r"^.*/host.*$", r"^.*/mar-tools/.*$", - r"^.*robocop.apk$", r"^.*contrib.*" ] CACHE_DIR = 'cache' diff --git a/testing/mozharness/scripts/release/beet_mover.py b/testing/mozharness/scripts/release/beet_mover.py index adc8b19e11..0f3c187530 100755 --- a/testing/mozharness/scripts/release/beet_mover.py +++ b/testing/mozharness/scripts/release/beet_mover.py @@ -107,7 +107,6 @@ DEFAULT_EXCLUDES = [ r"^.*json$", r"^.*/host.*$", r"^.*/mar-tools/.*$", - r"^.*robocop.apk$", r"^.*contrib.*" ] CACHE_DIR = 'cache' diff --git a/testing/mozharness/scripts/release/push-candidate-to-releases.py b/testing/mozharness/scripts/release/push-candidate-to-releases.py index 5339fa38a8..977a26c481 100644 --- a/testing/mozharness/scripts/release/push-candidate-to-releases.py +++ b/testing/mozharness/scripts/release/push-candidate-to-releases.py @@ -48,7 +48,6 @@ class ReleasePusher(BaseScript, VirtualenvMixin): r"^.*json$", r"^.*/host.*$", r"^.*/mar-tools/.*$", - r"^.*robocop.apk$", r"^.*bouncer.apk$", r"^.*contrib.*", r"^.*/beetmover-checksums/.*$", diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index a28f0eb9e6..81f07be661 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -184,11 +184,6 @@ if CONFIG['MOZ_ALSA']: if CONFIG['HAVE_CLOCK_MONOTONIC']: OS_LIBS += CONFIG['REALTIME_LIBS'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - OS_LIBS += [ - 'GLESv2', - ] - if 'rtsp' in CONFIG['NECKO_PROTOCOLS']: OS_LIBS += [ 'stagefright_foundation', diff --git a/tools/power/moz.build b/tools/power/moz.build index 517f969c1e..004dd3354c 100644 --- a/tools/power/moz.build +++ b/tools/power/moz.build @@ -8,8 +8,7 @@ do_rapl = False if CONFIG['OS_ARCH'] == 'Darwin' and CONFIG['CPU_ARCH'] == 'x86_64': do_rapl = True -if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android' and \ - CONFIG['CPU_ARCH'] in ('x86', 'x86_64'): +if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['CPU_ARCH'] in ('x86', 'x86_64'): do_rapl = True if do_rapl: |