summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-23 11:29:12 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:54:30 +0200
commit7494866cb521d964bc60314cd180ed5df11a7afe (patch)
treeea027806fcf2d876aca71edbceb88b8c76f1e63b
parent19bf63b0ee0ef9e156d8484bf3555501ad14933e (diff)
downloadUXP-7494866cb521d964bc60314cd180ed5df11a7afe.tar
UXP-7494866cb521d964bc60314cd180ed5df11a7afe.tar.gz
UXP-7494866cb521d964bc60314cd180ed5df11a7afe.tar.lz
UXP-7494866cb521d964bc60314cd180ed5df11a7afe.tar.xz
UXP-7494866cb521d964bc60314cd180ed5df11a7afe.zip
Issue #1053 - Remove android support from hal
-rw-r--r--hal/android/AndroidAlarm.cpp48
-rw-r--r--hal/android/AndroidHal.cpp175
-rw-r--r--hal/android/AndroidSensor.cpp25
-rw-r--r--hal/moz.build24
4 files changed, 4 insertions, 268 deletions
diff --git a/hal/android/AndroidAlarm.cpp b/hal/android/AndroidAlarm.cpp
deleted file mode 100644
index 3b2613be8..000000000
--- a/hal/android/AndroidAlarm.cpp
+++ /dev/null
@@ -1,48 +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 "Hal.h"
-
-#include "GeneratedJNINatives.h"
-#include "GeneratedJNIWrappers.h"
-
-using namespace mozilla::hal;
-
-namespace mozilla {
-
-class AlarmReceiver : public java::AlarmReceiver::Natives<AlarmReceiver>
-{
-private:
- AlarmReceiver();
-
-public:
- static void NotifyAlarmFired() {
- hal::NotifyAlarmFired();
- }
-};
-
-namespace hal_impl {
-
-bool
-EnableAlarm()
-{
- AlarmReceiver::Init();
- return true;
-}
-
-void
-DisableAlarm()
-{
- java::GeckoAppShell::DisableAlarm();
-}
-
-bool
-SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
-{
- return java::GeckoAppShell::SetAlarm(aSeconds, aNanoseconds);
-}
-
-} // hal_impl
-} // mozilla
diff --git a/hal/android/AndroidHal.cpp b/hal/android/AndroidHal.cpp
deleted file mode 100644
index 495b623ef..000000000
--- a/hal/android/AndroidHal.cpp
+++ /dev/null
@@ -1,175 +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 "Hal.h"
-#include "HalImpl.h"
-#include "WindowIdentifier.h"
-#include "AndroidBridge.h"
-#include "mozilla/dom/network/Constants.h"
-#include "mozilla/dom/ScreenOrientation.h"
-#include "nsIScreenManager.h"
-#include "nsServiceManagerUtils.h"
-
-using namespace mozilla::dom;
-using namespace mozilla::hal;
-
-namespace java = mozilla::java;
-
-namespace mozilla {
-namespace hal_impl {
-
-void
-Vibrate(const nsTArray<uint32_t> &pattern, const WindowIdentifier &)
-{
- // Ignore the WindowIdentifier parameter; it's here only because hal::Vibrate,
- // hal_sandbox::Vibrate, and hal_impl::Vibrate all must have the same
- // signature.
-
- // Strangely enough, the Android Java API seems to treat vibrate([0]) as a
- // nop. But we want to treat vibrate([0]) like CancelVibrate! (Note that we
- // also need to treat vibrate([]) as a call to CancelVibrate.)
- bool allZero = true;
- for (uint32_t i = 0; i < pattern.Length(); i++) {
- if (pattern[i] != 0) {
- allZero = false;
- break;
- }
- }
-
- if (allZero) {
- hal_impl::CancelVibrate(WindowIdentifier());
- return;
- }
-
- AndroidBridge* b = AndroidBridge::Bridge();
- if (!b) {
- return;
- }
-
- b->Vibrate(pattern);
-}
-
-void
-CancelVibrate(const WindowIdentifier &)
-{
- // Ignore WindowIdentifier parameter.
-
- java::GeckoAppShell::CancelVibrate();
-}
-
-void
-EnableBatteryNotifications()
-{
- java::GeckoAppShell::EnableBatteryNotifications();
-}
-
-void
-DisableBatteryNotifications()
-{
- java::GeckoAppShell::DisableBatteryNotifications();
-}
-
-void
-GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
-{
- AndroidBridge::Bridge()->GetCurrentBatteryInformation(aBatteryInfo);
-}
-
-void
-EnableNetworkNotifications()
-{
- java::GeckoAppShell::EnableNetworkNotifications();
-}
-
-void
-DisableNetworkNotifications()
-{
- java::GeckoAppShell::DisableNetworkNotifications();
-}
-
-void
-GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
-{
- AndroidBridge::Bridge()->GetCurrentNetworkInformation(aNetworkInfo);
-}
-
-void
-EnableScreenConfigurationNotifications()
-{
- java::GeckoAppShell::EnableScreenOrientationNotifications();
-}
-
-void
-DisableScreenConfigurationNotifications()
-{
- java::GeckoAppShell::DisableScreenOrientationNotifications();
-}
-
-void
-GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
-{
- AndroidBridge* bridge = AndroidBridge::Bridge();
- if (!bridge) {
- return;
- }
-
- nsresult rv;
- nsCOMPtr<nsIScreenManager> screenMgr =
- do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
- if (NS_FAILED(rv)) {
- NS_ERROR("Can't find nsIScreenManager!");
- return;
- }
-
- nsIntRect rect;
- int32_t colorDepth, pixelDepth;
- int16_t angle;
- ScreenOrientationInternal orientation;
- nsCOMPtr<nsIScreen> screen;
-
- screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
- screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
- screen->GetColorDepth(&colorDepth);
- screen->GetPixelDepth(&pixelDepth);
- orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
- angle = bridge->GetScreenAngle();
-
- *aScreenConfiguration =
- hal::ScreenConfiguration(rect, orientation, angle, colorDepth, pixelDepth);
-}
-
-bool
-LockScreenOrientation(const ScreenOrientationInternal& aOrientation)
-{
- // Force the default orientation to be portrait-primary.
- ScreenOrientationInternal orientation =
- aOrientation == eScreenOrientation_Default ? eScreenOrientation_PortraitPrimary
- : aOrientation;
-
- switch (orientation) {
- // The Android backend only supports these orientations.
- case eScreenOrientation_PortraitPrimary:
- case eScreenOrientation_PortraitSecondary:
- case eScreenOrientation_PortraitPrimary | eScreenOrientation_PortraitSecondary:
- case eScreenOrientation_LandscapePrimary:
- case eScreenOrientation_LandscapeSecondary:
- case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
- case eScreenOrientation_Default:
- java::GeckoAppShell::LockScreenOrientation(orientation);
- return true;
- default:
- return false;
- }
-}
-
-void
-UnlockScreenOrientation()
-{
- java::GeckoAppShell::UnlockScreenOrientation();
-}
-
-} // hal_impl
-} // mozilla
-
diff --git a/hal/android/AndroidSensor.cpp b/hal/android/AndroidSensor.cpp
deleted file mode 100644
index cb1060342..000000000
--- a/hal/android/AndroidSensor.cpp
+++ /dev/null
@@ -1,25 +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 "Hal.h"
-#include "GeneratedJNIWrappers.h"
-
-using namespace mozilla::hal;
-
-namespace mozilla {
-namespace hal_impl {
-
-void
-EnableSensorNotifications(SensorType aSensor) {
- java::GeckoAppShell::EnableSensor(aSensor);
-}
-
-void
-DisableSensorNotifications(SensorType aSensor) {
- java::GeckoAppShell::DisableSensor(aSensor);
-}
-
-} // hal_impl
-} // mozilla
diff --git a/hal/moz.build b/hal/moz.build
index 8d2950ac0..a1acfa320 100644
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -25,21 +25,7 @@ SOURCES += [
'Hal.cpp',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
- LOCAL_INCLUDES += [
- '/widget/android',
- ]
- UNIFIED_SOURCES += [
- 'android/AndroidAlarm.cpp',
- 'android/AndroidSensor.cpp',
- 'fallback/FallbackPower.cpp',
- 'linux/LinuxMemory.cpp',
- ]
- # AndroidHal.cpp cannot be built in unified mode because it relies on HalImpl.h.
- SOURCES += [
- 'android/AndroidHal.cpp',
- ]
-elif CONFIG['OS_TARGET'] == 'Linux':
+if CONFIG['OS_TARGET'] == 'Linux':
UNIFIED_SOURCES += [
'fallback/FallbackAlarm.cpp',
'fallback/FallbackScreenConfiguration.cpp',
@@ -117,11 +103,9 @@ UNIFIED_SOURCES += [
'fallback/FallbackWakeLocks.cpp',
]
-# Fallbacks for backends implemented on Android only.
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
- UNIFIED_SOURCES += [
- 'fallback/FallbackNetwork.cpp',
- ]
+UNIFIED_SOURCES += [
+ 'fallback/FallbackNetwork.cpp',
+]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
UNIFIED_SOURCES += [