Backed out changeset 684888aeee81 (bug 1287946)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 21 Jul 2016 08:07:12 +0200
changeset 331092 5643545ad4992dc69233b6b5bef4887fb10fec0c
parent 331091 d3a44f609b1ff8f6b7c0fc43931cf06fe3a29550
child 331093 de1db0ba27a71eb7d6c8ce93123967e5ab582b2e
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1287946
milestone50.0a1
backs out684888aeee810cbf3ab28acdd4edb8e92d6cbc59
Backed out changeset 684888aeee81 (bug 1287946)
dom/gamepad/android/AndroidGamepad.cpp
dom/ipc/ContentParent.cpp
dom/media/fmp4/MP4Decoder.cpp
dom/media/mediasource/MediaSource.cpp
dom/media/platforms/android/AndroidDecoderModule.cpp
dom/media/platforms/android/AndroidDecoderModule.h
dom/media/webrtc/MediaEngineDefault.cpp
dom/mobilemessage/android/SmsManager.h
dom/plugins/base/android/ANPEvent.cpp
dom/plugins/base/android/ANPNativeWindow.cpp
dom/plugins/base/android/ANPSystem.cpp
dom/plugins/base/android/ANPVideo.cpp
dom/plugins/base/android/ANPWindow.cpp
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/system/android/AndroidLocationProvider.cpp
dom/system/android/nsHapticFeedback.cpp
gfx/gl/AndroidSurfaceTexture.cpp
gfx/gl/AndroidSurfaceTexture.h
gfx/layers/apz/src/AndroidAPZ.cpp
gfx/layers/apz/src/AndroidAPZ.h
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/thebes/gfxAndroidPlatform.cpp
hal/android/AndroidAlarm.cpp
hal/android/AndroidHal.cpp
hal/android/AndroidSensor.cpp
media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp
mobile/android/components/build/nsAndroidHistory.cpp
mobile/android/components/build/nsShellService.cpp
netwerk/base/Tickler.cpp
netwerk/protocol/device/AndroidCaptureProvider.cpp
netwerk/protocol/device/CameraStreamImpl.cpp
netwerk/system/android/nsAndroidNetworkLinkService.cpp
toolkit/components/alerts/nsAlertsService.cpp
toolkit/components/downloads/nsDownloadManager.cpp
toolkit/components/jsdownloads/src/DownloadPlatform.cpp
toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp
toolkit/xre/nsAppRunner.cpp
tools/profiler/core/GeckoSampler.cpp
tools/profiler/core/platform.cpp
uriloader/exthandler/android/nsAndroidHandlerApp.cpp
uriloader/exthandler/android/nsExternalSharingAppService.cpp
uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
widget/android/ANRReporter.h
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/GeckoNetworkManager.h
widget/android/GeckoScreenOrientation.h
widget/android/GeneratedJNINatives.h
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
widget/android/NativeJSContainer.h
widget/android/PrefsHelper.h
widget/android/ThumbnailHelper.h
widget/android/jni/Utils.cpp
widget/android/nsAndroidProtocolHandler.cpp
widget/android/nsAppShell.cpp
widget/android/nsClipboard.cpp
widget/android/nsLookAndFeel.cpp
widget/android/nsScreenManagerAndroid.cpp
widget/android/nsWindow.cpp
widget/android/nsWindow.h
xpcom/base/nsSystemInfo.cpp
xpcom/components/ManifestParser.cpp
xpcom/io/nsLocalFileUnix.cpp
--- a/dom/gamepad/android/AndroidGamepad.cpp
+++ b/dom/gamepad/android/AndroidGamepad.cpp
@@ -1,23 +1,23 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "AndroidBridge.h"
 
 namespace mozilla {
 namespace dom {
 
 void StartGamepadMonitoring()
 {
-  java::GeckoAppShell::StartMonitoringGamepad();
+  widget::GeckoAppShell::StartMonitoringGamepad();
 }
 
 void StopGamepadMonitoring()
 {
-  java::GeckoAppShell::StopMonitoringGamepad();
+  widget::GeckoAppShell::StopMonitoringGamepad();
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2832,17 +2832,17 @@ ContentParent::RecvGetIconForExtension(c
 bool
 ContentParent::RecvGetShowPasswordSetting(bool* showPassword)
 {
   // default behavior is to show the last password character
   *showPassword = true;
 #ifdef MOZ_WIDGET_ANDROID
   NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available");
 
-  *showPassword = java::GeckoAppShell::GetShowPasswordSetting();
+  *showPassword = mozilla::widget::GeckoAppShell::GetShowPasswordSetting();
 #endif
   return true;
 }
 
 bool
 ContentParent::RecvFirstIdle()
 {
   // When the ContentChild goes idle, it sends us a FirstIdle message
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -17,16 +17,17 @@
 #include "nsContentTypeParser.h"
 #include "VideoUtils.h"
 
 #ifdef XP_WIN
 #include "mozilla/WindowsVersion.h"
 #endif
 #ifdef MOZ_WIDGET_ANDROID
 #include "nsIGfxInfo.h"
+#include "AndroidBridge.h"
 #endif
 #include "mozilla/layers/LayersTypes.h"
 
 #include "PDMFactory.h"
 
 namespace mozilla {
 
 MP4Decoder::MP4Decoder(MediaDecoderOwner* aOwner)
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -27,16 +27,20 @@
 #include "nsPIDOMWindow.h"
 #include "nsString.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Logging.h"
 #include "nsServiceManagerUtils.h"
 #include "gfxPlatform.h"
 #include "mozilla/Snprintf.h"
 
+#ifdef MOZ_WIDGET_ANDROID
+#include "AndroidBridge.h"
+#endif
+
 struct JSContext;
 class JSObject;
 
 mozilla::LogModule* GetMediaSourceLog()
 {
   static mozilla::LazyLogModule sLogModule("MediaSource");
   return sLogModule;
 }
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -30,17 +30,17 @@ static PRLogModuleInfo* AndroidDecoderMo
 
 #undef LOG
 #define LOG(arg, ...) MOZ_LOG(AndroidDecoderModuleLog(), \
     mozilla::LogLevel::Debug, ("AndroidDecoderModule(%p)::%s: " arg, \
       this, __func__, ##__VA_ARGS__))
 
 using namespace mozilla;
 using namespace mozilla::gl;
-using namespace mozilla::java::sdk;
+using namespace mozilla::widget::sdk;
 using media::TimeUnit;
 
 namespace mozilla {
 
 #define INVOKE_CALLBACK(Func, ...) \
   if (mCallback) { \
     mCallback->Func(__VA_ARGS__); \
   } else { \
@@ -174,19 +174,19 @@ public:
   {
     JNIEnv* const env = jni::GetEnvForThread();
 
     jni::ByteBuffer::LocalRef buffer(env);
     NS_ENSURE_SUCCESS_VOID(aFormat->GetByteBuffer(NS_LITERAL_STRING("csd-0"),
                                                   &buffer));
 
     if (!buffer && aConfig.mCodecSpecificConfig->Length() >= 2) {
-      buffer = jni::ByteBuffer::New(
-          aConfig.mCodecSpecificConfig->Elements(),
-          aConfig.mCodecSpecificConfig->Length());
+      buffer = jni::Object::LocalRef::Adopt(
+          env, env->NewDirectByteBuffer(aConfig.mCodecSpecificConfig->Elements(),
+          aConfig.mCodecSpecificConfig->Length()));
       NS_ENSURE_SUCCESS_VOID(aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"),
                                                     buffer));
     }
   }
 
   const char* GetDescriptionName() const override
   {
     return "android audio decoder";
@@ -272,17 +272,17 @@ AndroidDecoderModule::SupportsMimeType(c
 
   if ((VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8) &&
        !GetFeatureStatus(nsIGfxInfo::FEATURE_VP8_HW_DECODE)) ||
       (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9) &&
        !GetFeatureStatus(nsIGfxInfo::FEATURE_VP9_HW_DECODE))) {
     return false;
   }
 
-  return java::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
+  return widget::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
       nsCString(TranslateMimeType(aMimeType)));
 }
 
 already_AddRefed<MediaDataDecoder>
 AndroidDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   MediaFormat::LocalRef format;
 
--- a/dom/media/platforms/android/AndroidDecoderModule.h
+++ b/dom/media/platforms/android/AndroidDecoderModule.h
@@ -38,17 +38,17 @@ public:
   DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 };
 
 class MediaCodecDataDecoder : public MediaDataDecoder {
 public:
 
   MediaCodecDataDecoder(MediaData::Type aType,
                         const nsACString& aMimeType,
-                        java::sdk::MediaFormat::Param aFormat,
+                        widget::sdk::MediaFormat::Param aFormat,
                         MediaDataDecoderCallback* aCallback);
 
   virtual ~MediaCodecDataDecoder();
 
   RefPtr<MediaDataDecoder::InitPromise> Init() override;
   nsresult Flush() override;
   nsresult Drain() override;
   nsresult Shutdown() override;
@@ -68,60 +68,60 @@ protected:
     kStopping,
     kShutdown
   };
 
   friend class AndroidDecoderModule;
 
   static const char* ModuleStateStr(ModuleState aState);
 
-  virtual nsresult InitDecoder(java::sdk::Surface::Param aSurface);
+  virtual nsresult InitDecoder(widget::sdk::Surface::Param aSurface);
 
-  virtual nsresult Output(java::sdk::BufferInfo::Param aInfo, void* aBuffer,
-      java::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
+  virtual nsresult Output(widget::sdk::BufferInfo::Param aInfo, void* aBuffer,
+      widget::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
   {
     return NS_OK;
   }
 
-  virtual nsresult PostOutput(java::sdk::BufferInfo::Param aInfo,
-      java::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
+  virtual nsresult PostOutput(widget::sdk::BufferInfo::Param aInfo,
+      widget::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
   {
     return NS_OK;
   }
 
   virtual void Cleanup() {};
 
   nsresult ResetInputBuffers();
   nsresult ResetOutputBuffers();
 
   nsresult GetInputBuffer(JNIEnv* env, int index, jni::Object::LocalRef* buffer);
   bool WaitForInput();
   already_AddRefed<MediaRawData> PeekNextSample();
   nsresult QueueSample(const MediaRawData* aSample);
   nsresult QueueEOS();
   void HandleEOS(int32_t aOutputStatus);
   Maybe<media::TimeUnit> GetOutputDuration();
-  nsresult ProcessOutput(java::sdk::BufferInfo::Param aInfo,
-                         java::sdk::MediaFormat::Param aFormat,
+  nsresult ProcessOutput(widget::sdk::BufferInfo::Param aInfo,
+                         widget::sdk::MediaFormat::Param aFormat,
                          int32_t aStatus);
   ModuleState State() const;
   // Sets decoder state and returns whether the new state has become effective.
   bool State(ModuleState aState);
   void DecoderLoop();
 
   virtual void ClearQueue();
 
   MediaData::Type mType;
 
   nsAutoCString mMimeType;
-  java::sdk::MediaFormat::GlobalRef mFormat;
+  widget::sdk::MediaFormat::GlobalRef mFormat;
 
   MediaDataDecoderCallback* mCallback;
 
-  java::sdk::MediaCodec::GlobalRef mDecoder;
+  widget::sdk::MediaCodec::GlobalRef mDecoder;
 
   jni::ObjectArray::GlobalRef mInputBuffers;
   jni::ObjectArray::GlobalRef mOutputBuffers;
 
   nsCOMPtr<nsIThread> mThread;
 
   // Only these members are protected by mMonitor.
   Monitor mMonitor;
--- a/dom/media/webrtc/MediaEngineDefault.cpp
+++ b/dom/media/webrtc/MediaEngineDefault.cpp
@@ -14,16 +14,17 @@
 #include "prmem.h"
 #include "nsContentUtils.h"
 
 #include "nsIFilePicker.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #ifdef MOZ_WIDGET_ANDROID
+#include "AndroidBridge.h"
 #include "nsISupportsUtils.h"
 #endif
 
 #ifdef MOZ_WEBRTC
 #include "YuvStamper.h"
 #endif
 
 #define AUDIO_RATE mozilla::MediaEngine::DEFAULT_SAMPLE_RATE
--- a/dom/mobilemessage/android/SmsManager.h
+++ b/dom/mobilemessage/android/SmsManager.h
@@ -5,17 +5,17 @@
 
 #ifndef SmsManager_h__
 #define SmsManager_h__
 
 #include "GeneratedJNINatives.h"
 
 namespace mozilla {
 
-class SmsManager : public java::GeckoSmsManager::Natives<SmsManager>
+class SmsManager : public widget::GeckoSmsManager::Natives<SmsManager>
 {
 private:
     SmsManager();
 
 public:
     static void NotifySmsReceived(int32_t aId,
                                   jni::String::Param aSender,
                                   jni::String::Param aBody,
--- a/dom/plugins/base/android/ANPEvent.cpp
+++ b/dom/plugins/base/android/ANPEvent.cpp
@@ -3,16 +3,17 @@
  * 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 "assert.h"
 #include "ANPBase.h"
 #include <android/log.h>
 #include "nsThreadUtils.h"
 #include "nsNPAPIPluginInstance.h"
+#include "AndroidBridge.h"
 #include "nsNPAPIPlugin.h"
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_event_##name
 
 void
 anp_event_postEvent(NPP instance, const ANPEvent* event)
 {
--- a/dom/plugins/base/android/ANPNativeWindow.cpp
+++ b/dom/plugins/base/android/ANPNativeWindow.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: IDL; 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/. */
 
 // must include config.h first for webkit to fiddle with new/delete
 #include <android/log.h>
+#include "AndroidBridge.h"
 #include "ANPBase.h"
 #include "nsIPluginInstanceOwner.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsNPAPIPluginInstance.h"
 #include "gfxRect.h"
 
 using namespace mozilla;
 
--- a/dom/plugins/base/android/ANPSystem.cpp
+++ b/dom/plugins/base/android/ANPSystem.cpp
@@ -1,23 +1,22 @@
 /* -*- Mode: IDL; 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 "base/basictypes.h"
 
+#include "assert.h"
 #include "ANPBase.h"
-#include "GeneratedJNIWrappers.h"
+#include <android/log.h>
+#include "nsNPAPIPluginInstance.h"
+#include "AndroidBridge.h"
+#include "nsNPAPIPlugin.h"
 #include "PluginPRLibrary.h"
-#include "assert.h"
-#include "nsNPAPIPluginInstance.h"
-#include "nsNPAPIPlugin.h"
-
-#include <android/log.h>
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_system_##name
 
 const char*
 anp_system_getApplicationDataDirectory(NPP instance)
 {
   static const char *dir = nullptr;
@@ -56,17 +55,17 @@ jclass anp_system_loadJavaClass(NPP inst
   LOG("%s", __PRETTY_FUNCTION__);
 
   nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
   mozilla::PluginPRLibrary* lib = static_cast<mozilla::PluginPRLibrary*>(pinst->GetPlugin()->GetLibrary());
 
   nsCString libName;
   lib->GetLibraryPath(libName);
 
-  return mozilla::java::GeckoAppShell::LoadPluginClass(className, libName).Forget();
+  return mozilla::widget::GeckoAppShell::LoadPluginClass(className, libName).Forget();
 }
 
 void anp_system_setPowerState(NPP instance, ANPPowerState powerState)
 {
   nsNPAPIPluginInstance* pinst = nsNPAPIPluginInstance::GetFromNPP(instance);
 
   if (pinst) {
     pinst->SetWakeLock(powerState == kScreenOn_ANPPowerState);
--- a/dom/plugins/base/android/ANPVideo.cpp
+++ b/dom/plugins/base/android/ANPVideo.cpp
@@ -1,13 +1,14 @@
 /* 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 <android/log.h>
+#include "AndroidBridge.h"
 #include "ANPBase.h"
 #include "nsIPluginInstanceOwner.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsNPAPIPluginInstance.h"
 #include "gfxRect.h"
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_video_##name
--- a/dom/plugins/base/android/ANPWindow.cpp
+++ b/dom/plugins/base/android/ANPWindow.cpp
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "base/basictypes.h"
 #include "assert.h"
 #include "ANPBase.h"
 #include <android/log.h>
+#include "AndroidBridge.h"
 #include "nsNPAPIPluginInstance.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsWindow.h"
 #include "mozilla/dom/ScreenOrientation.h"
 
 #undef LOG
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #define ASSIGN(obj, name)   (obj)->name = anp_window_##name
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -96,17 +96,17 @@ using mozilla::plugins::PluginModuleCont
 #include "mozilla/a11y/Compatibility.h"
 #endif
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include <android/log.h>
 #include "android_npapi.h"
 #include "ANPBase.h"
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 #undef LOG
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
 #endif
 
 #include "nsIAudioChannelAgent.h"
 #include "AudioChannelService.h"
 
 using namespace mozilla;
@@ -2110,17 +2110,17 @@ NPError
 
     case kSupportedDrawingModel_ANPGetValue: {
       LOG("get supported drawing model");
       return NPERR_GENERIC_ERROR;
     }
 
     case kJavaContext_ANPGetValue: {
       LOG("get java context");
-      auto ret = java::GeckoAppShell::GetContext();
+      auto ret = widget::GeckoAppShell::GetContext();
       if (!ret)
         return NPERR_GENERIC_ERROR;
 
       *static_cast<jobject*>(result) = ret.Forget();
       return NPERR_NO_ERROR;
     }
 
     case kAudioTrackInterfaceV1_ANPGetValue: {
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -783,17 +783,17 @@ void nsNPAPIPluginInstance::NotifyFullSc
 
   if (RUNNING != mRunning || mFullScreen == aFullScreen)
     return;
 
   mFullScreen = aFullScreen;
   SendLifecycleEvent(this, mFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction);
 
   if (mFullScreen && mFullScreenOrientation != dom::eScreenOrientation_None) {
-    java::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
+    widget::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
   }
 }
 
 void nsNPAPIPluginInstance::NotifySize(nsIntSize size)
 {
   if (kOpenGL_ANPDrawingModel != GetANPDrawingModel() ||
       size == mCurrentSize)
     return;
@@ -840,21 +840,21 @@ void nsNPAPIPluginInstance::SetFullScree
 
   uint32_t oldOrientation = mFullScreenOrientation;
   mFullScreenOrientation = orientation;
 
   if (mFullScreen) {
     // We're already fullscreen so immediately apply the orientation change
 
     if (mFullScreenOrientation != dom::eScreenOrientation_None) {
-      java::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
+      widget::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
     } else if (oldOrientation != dom::eScreenOrientation_None) {
       // We applied an orientation when we entered fullscreen, but
       // we don't want it anymore
-      java::GeckoAppShell::UnlockScreenOrientation();
+      widget::GeckoAppShell::UnlockScreenOrientation();
     }
   }
 }
 
 void nsNPAPIPluginInstance::PopPostedEvent(PluginEventRunnable* r)
 {
   mPostedEvents.RemoveElement(r);
 }
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1554,17 +1554,17 @@ bool nsPluginInstanceOwner::AddPluginVie
   return true;
 }
 
 void nsPluginInstanceOwner::RemovePluginView()
 {
   if (!mInstance || !mJavaView)
     return;
 
-  java::GeckoAppShell::RemovePluginView(
+  widget::GeckoAppShell::RemovePluginView(
       jni::Object::Ref::From(jobject(mJavaView)), mFullScreen);
   jni::GetGeckoThreadEnv()->DeleteGlobalRef((jobject)mJavaView);
   mJavaView = nullptr;
 
   if (mFullScreen)
     sFullScreenInstance = nullptr;
 }
 
--- a/dom/system/android/AndroidLocationProvider.cpp
+++ b/dom/system/android/AndroidLocationProvider.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "AndroidBridge.h"
 #include "AndroidLocationProvider.h"
-#include "GeneratedJNIWrappers.h"
 
 using namespace mozilla;
 
 extern nsIGeolocationUpdate *gLocationCallback;
 
 NS_IMPL_ISUPPORTS(AndroidLocationProvider, nsIGeolocationProvider)
 
 AndroidLocationProvider::AndroidLocationProvider()
@@ -22,34 +22,34 @@ AndroidLocationProvider::AndroidLocation
 AndroidLocationProvider::~AndroidLocationProvider()
 {
     NS_IF_RELEASE(gLocationCallback);
 }
 
 NS_IMETHODIMP
 AndroidLocationProvider::Startup()
 {
-    java::GeckoAppShell::EnableLocation(true);
+    widget::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);
+    widget::GeckoAppShell::EnableLocation(false);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 AndroidLocationProvider::SetHighAccuracy(bool enable)
 {
-    java::GeckoAppShell::EnableLocationHighAccuracy(enable);
+    widget::GeckoAppShell::EnableLocationHighAccuracy(enable);
     return NS_OK;
 }
--- a/dom/system/android/nsHapticFeedback.cpp
+++ b/dom/system/android/nsHapticFeedback.cpp
@@ -1,20 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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"
+#include "AndroidBridge.h"
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsHapticFeedback, nsIHapticFeedback)
 
 NS_IMETHODIMP
 nsHapticFeedback::PerformSimpleAction(int32_t aType)
 {
-    java::GeckoAppShell::PerformHapticFeedback(aType == LongPress);
+    widget::GeckoAppShell::PerformHapticFeedback(aType == LongPress);
     return NS_OK;
 }
--- a/gfx/gl/AndroidSurfaceTexture.cpp
+++ b/gfx/gl/AndroidSurfaceTexture.cpp
@@ -15,18 +15,18 @@
 #include "nsThreadUtils.h"
 #include "mozilla/gfx/Matrix.h"
 #include "GeneratedJNIWrappers.h"
 #include "SurfaceTexture.h"
 #include "GLContext.h"
 
 using namespace mozilla;
 using namespace mozilla::jni;
-using namespace mozilla::java;
-using namespace mozilla::java::sdk;
+using namespace mozilla::widget;
+using namespace mozilla::widget::sdk;
 
 namespace mozilla {
 namespace gl {
 
 // Maintains a mapping between AndroidSurfaceTexture instances and their
 // unique numerical IDs. [thread-safe]
 class InstanceMap
 {
--- a/gfx/gl/AndroidSurfaceTexture.h
+++ b/gfx/gl/AndroidSurfaceTexture.h
@@ -78,27 +78,27 @@ public:
   // if the upstream callback is received on a different thread
   void SetFrameAvailableCallback(nsIRunnable* aRunnable);
 
   // Only should be called by AndroidJNI when we get a
   // callback from the underlying SurfaceTexture instance
   void NotifyFrameAvailable();
 
   GLuint Texture() const { return mTexture; }
-  const java::sdk::Surface::Ref& JavaSurface() const { return mSurface; }
+  const widget::sdk::Surface::Ref& JavaSurface() const { return mSurface; }
 
 private:
   AndroidSurfaceTexture();
   ~AndroidSurfaceTexture();
 
   bool Init(GLContext* aContext, GLuint aTexture);
 
   GLuint mTexture;
-  java::sdk::SurfaceTexture::GlobalRef mSurfaceTexture;
-  java::sdk::Surface::GlobalRef mSurface;
+  widget::sdk::SurfaceTexture::GlobalRef mSurfaceTexture;
+  widget::sdk::Surface::GlobalRef mSurface;
 
   GLContext* mAttachedContext;
 
   RefPtr<AndroidNativeWindow> mNativeWindow;
   int mID;
   nsCOMPtr<nsIRunnable> mFrameAvailableCallback;
 
   mutable Monitor mMonitor;
--- a/gfx/layers/apz/src/AndroidAPZ.cpp
+++ b/gfx/layers/apz/src/AndroidAPZ.cpp
@@ -16,32 +16,29 @@
 // #define ANDROID_APZ_LOG(...) printf_stderr("ANDROID_APZ: " __VA_ARGS__)
 
 static float sMaxFlingSpeed = 0.0f;
 
 namespace mozilla {
 namespace layers {
 
 AndroidSpecificState::AndroidSpecificState() {
-  using namespace mozilla::java;
-
-  sdk::ViewConfiguration::LocalRef config;
-  if (sdk::ViewConfiguration::Get(GeckoAppShell::GetApplicationContext(), &config) == NS_OK) {
+  widget::sdk::ViewConfiguration::LocalRef config;
+  if (widget::sdk::ViewConfiguration::Get(widget::GeckoAppShell::GetApplicationContext(), &config) == NS_OK) {
     int32_t speed = 0;
     if (config->GetScaledMaximumFlingVelocity(&speed) == NS_OK) {
       sMaxFlingSpeed = (float)speed * 0.001f;
     } else {
       ANDROID_APZ_LOG("%p Failed to query ViewConfiguration for scaled maximum fling velocity\n", this);
     }
   } else {
     ANDROID_APZ_LOG("%p Failed to get ViewConfiguration\n", this);
   }
-
-  StackScroller::LocalRef scroller;
-  if (StackScroller::New(GeckoAppShell::GetApplicationContext(), &scroller) != NS_OK) {
+  widget::StackScroller::LocalRef scroller;
+  if (widget::StackScroller::New(widget::GeckoAppShell::GetApplicationContext(), &scroller) != NS_OK) {
     ANDROID_APZ_LOG("%p Failed to create Android StackScroller\n", this);
     return;
   }
   mOverScroller = scroller;
 }
 
 const float BOUNDS_EPSILON = 1.0f;
 
--- a/gfx/layers/apz/src/AndroidAPZ.h
+++ b/gfx/layers/apz/src/AndroidAPZ.h
@@ -17,17 +17,17 @@ namespace layers {
 class AndroidSpecificState : public PlatformSpecificStateBase {
 public:
   AndroidSpecificState();
 
   virtual AndroidSpecificState* AsAndroidSpecificState() override {
     return this;
   }
 
-  java::StackScroller::GlobalRef mOverScroller;
+  widget::StackScroller::GlobalRef mOverScroller;
 };
 
 class AndroidFlingAnimation: public AsyncPanZoomAnimation {
 public:
   AndroidFlingAnimation(AsyncPanZoomController& aApzc,
                         PlatformSpecificStateBase* aPlatformSpecificState,
                         const RefPtr<const OverscrollHandoffChain>& aOverscrollHandoffChain,
                         bool aFlingIsHandoff /* ignored */,
@@ -35,17 +35,17 @@ public:
   virtual bool DoSample(FrameMetrics& aFrameMetrics,
                         const TimeDuration& aDelta) override;
 private:
   void DeferHandleFlingOverscroll(ParentLayerPoint& aVelocity);
   // Returns true if value is on or outside of axis bounds.
   bool CheckBounds(Axis& aAxis, float aValue, float aDirection, float* aClamped);
 
   AsyncPanZoomController& mApzc;
-  java::StackScroller::GlobalRef mOverScroller;
+  widget::StackScroller::GlobalRef mOverScroller;
   RefPtr<const OverscrollHandoffChain> mOverscrollHandoffChain;
   RefPtr<const AsyncPanZoomController> mScrolledApzc;
   bool mSentBounceX;
   bool mSentBounceY;
   long mFlingDuration;
   ParentLayerPoint mStartOffset;
   ParentLayerPoint mPreviousOffset;
   // Unit vector in the direction of the fling.
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -84,16 +84,20 @@
 # include "mozilla/widget/CompositorWidgetParent.h"
 #endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "GeckoTouchDispatcher.h"
 #include "nsScreenManagerGonk.h"
 #endif
 
+#ifdef MOZ_ANDROID_APZ
+#include "AndroidBridge.h"
+#endif
+
 #include "LayerScope.h"
 
 namespace mozilla {
 
 namespace layers {
 
 using namespace mozilla::ipc;
 using namespace mozilla::gfx;
--- a/gfx/thebes/gfxAndroidPlatform.cpp
+++ b/gfx/thebes/gfxAndroidPlatform.cpp
@@ -20,16 +20,20 @@
 #include "nsIScreen.h"
 #include "nsIScreenManager.h"
 #include "nsILocaleService.h"
 #include "nsServiceManagerUtils.h"
 #include "gfxPrefs.h"
 #include "cairo.h"
 #include "VsyncSource.h"
 
+#ifdef MOZ_WIDGET_ANDROID
+#include "AndroidBridge.h"
+#endif
+
 #ifdef MOZ_WIDGET_GONK
 #include <cutils/properties.h>
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "HwcComposer2D.h"
 #endif
 
 #include "ft2build.h"
 #include FT_FREETYPE_H
--- a/hal/android/AndroidAlarm.cpp
+++ b/hal/android/AndroidAlarm.cpp
@@ -1,23 +1,23 @@
 /* -*- 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 "AndroidBridge.h"
 
 #include "GeneratedJNINatives.h"
-#include "GeneratedJNIWrappers.h"
 
 using namespace mozilla::hal;
 
 namespace mozilla {
 
-class AlarmReceiver : public java::AlarmReceiver::Natives<AlarmReceiver>
+class AlarmReceiver : public widget::AlarmReceiver::Natives<AlarmReceiver>
 {
 private:
     AlarmReceiver();
 
 public:
     static void NotifyAlarmFired() {
         nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([=]() {
             hal::NotifyAlarmFired();
@@ -33,19 +33,19 @@ EnableAlarm()
 {
     AlarmReceiver::Init();
     return true;
 }
 
 void
 DisableAlarm()
 {
-    java::GeckoAppShell::DisableAlarm();
+    widget::GeckoAppShell::DisableAlarm();
 }
 
 bool
 SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
 {
-    return java::GeckoAppShell::SetAlarm(aSeconds, aNanoseconds);
+    return widget::GeckoAppShell::SetAlarm(aSeconds, aNanoseconds);
 }
 
 } // hal_impl
 } // mozilla
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -10,18 +10,16 @@
 #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
@@ -51,65 +49,65 @@ Vibrate(const nsTArray<uint32_t> &patter
   b->Vibrate(pattern);
 }
 
 void
 CancelVibrate(const WindowIdentifier &)
 {
   // Ignore WindowIdentifier parameter.
 
-  java::GeckoAppShell::CancelVibrate();
+  mozilla::widget::GeckoAppShell::CancelVibrate();
 }
 
 void
 EnableBatteryNotifications()
 {
-  java::GeckoAppShell::EnableBatteryNotifications();
+  mozilla::widget::GeckoAppShell::EnableBatteryNotifications();
 }
 
 void
 DisableBatteryNotifications()
 {
-  java::GeckoAppShell::DisableBatteryNotifications();
+  mozilla::widget::GeckoAppShell::DisableBatteryNotifications();
 }
 
 void
 GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
 {
   AndroidBridge::Bridge()->GetCurrentBatteryInformation(aBatteryInfo);
 }
 
 void
 EnableNetworkNotifications()
 {
-  java::GeckoAppShell::EnableNetworkNotifications();
+  mozilla::widget::GeckoAppShell::EnableNetworkNotifications();
 }
 
 void
 DisableNetworkNotifications()
 {
-  java::GeckoAppShell::DisableNetworkNotifications();
+  mozilla::widget::GeckoAppShell::DisableNetworkNotifications();
 }
 
 void
 GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
 {
   AndroidBridge::Bridge()->GetCurrentNetworkInformation(aNetworkInfo);
 }
 
 void
 EnableScreenConfigurationNotifications()
 {
-  java::GeckoAppShell::EnableScreenOrientationNotifications();
+  mozilla::widget::GeckoAppShell::EnableScreenOrientationNotifications();
 }
 
 void
 DisableScreenConfigurationNotifications()
 {
-  java::GeckoAppShell::DisableScreenOrientationNotifications();
+  mozilla::widget::GeckoAppShell::DisableScreenOrientationNotifications();
 }
 
 void
 GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
 {
   AndroidBridge* bridge = AndroidBridge::Bridge();
   if (!bridge) {
     return;
@@ -152,24 +150,24 @@ LockScreenOrientation(const ScreenOrient
     // 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);
+      mozilla::widget::GeckoAppShell::LockScreenOrientation(orientation);
       return true;
     default:
       return false;
   }
 }
 
 void
 UnlockScreenOrientation()
 {
-  java::GeckoAppShell::UnlockScreenOrientation();
+  mozilla::widget::GeckoAppShell::UnlockScreenOrientation();
 }
 
 } // hal_impl
 } // mozilla
 
--- a/hal/android/AndroidSensor.cpp
+++ b/hal/android/AndroidSensor.cpp
@@ -1,25 +1,25 @@
 /* -*- 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"
+#include "AndroidBridge.h"
 
 using namespace mozilla::hal;
 
 namespace mozilla {
 namespace hal_impl {
 
 void
 EnableSensorNotifications(SensorType aSensor) {
-  java::GeckoAppShell::EnableSensor(aSensor);
+  widget::GeckoAppShell::EnableSensor(aSensor);
 }
 
 void
 DisableSensorNotifications(SensorType aSensor) {
-  java::GeckoAppShell::DisableSensor(aSensor);
+  widget::GeckoAppShell::DisableSensor(aSensor);
 }
 
 } // hal_impl
 } // mozilla
--- a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp
@@ -21,17 +21,17 @@
 #include "VideoConduit.h"
 #include "libyuv/convert_from.h"
 #include "libyuv/convert.h"
 #include "libyuv/row.h"
 
 #include <webrtc/common_video/libyuv/include/webrtc_libyuv.h>
 
 using namespace mozilla;
-using namespace mozilla::java::sdk;
+using namespace mozilla::widget::sdk;
 
 static const int32_t DECODER_TIMEOUT = 10 * PR_USEC_PER_MSEC; // 10ms
 static const char MEDIACODEC_VIDEO_MIME_VP8[] = "video/x-vnd.on2.vp8";
 
 namespace mozilla {
 
 static const char* logTag ="WebrtcMediaCodecVP8VideoCodec";
 
--- a/mobile/android/components/build/nsAndroidHistory.cpp
+++ b/mobile/android/components/build/nsAndroidHistory.cpp
@@ -1,19 +1,19 @@
 /* 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 "nsThreadUtils.h"
 #include "nsAndroidHistory.h"
 #include "nsComponentManagerUtils.h"
+#include "AndroidBridge.h"
+#include "Link.h"
 #include "nsIURI.h"
 #include "nsIObserverService.h"
-#include "GeneratedJNIWrappers.h"
-#include "Link.h"
 
 #include "mozilla/Services.h"
 #include "mozilla/Preferences.h"
 
 #define NS_LINK_VISITED_EVENT_TOPIC "link-visited"
 
 // We copy Places here.
 // Note that we don't yet observe this pref at runtime.
@@ -72,17 +72,17 @@ nsAndroidHistory::RegisterVisitedCallbac
   nsTArray<Link*>* list = mListeners.Get(uriString);
   if (! list) {
     list = new nsTArray<Link*>();
     mListeners.Put(uriString, list);
   }
   list->AppendElement(aContent);
 
   if (jni::IsAvailable()) {
-    java::GeckoAppShell::CheckURIVisited(uriString);
+    widget::GeckoAppShell::CheckURIVisited(uriString);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidHistory::UnregisterVisitedCallback(nsIURI *aURI, Link *aContent)
 {
@@ -198,17 +198,17 @@ void
 nsAndroidHistory::SaveVisitURI(nsIURI* aURI) {
   // Add the URI to our cache so we can take a fast path later
   AppendToRecentlyVisitedURIs(aURI);
 
   if (jni::IsAvailable()) {
     // Save this URI in our history
     nsAutoCString spec;
     (void)aURI->GetSpec(spec);
-    java::GeckoAppShell::MarkURIVisited(NS_ConvertUTF8toUTF16(spec));
+    widget::GeckoAppShell::MarkURIVisited(NS_ConvertUTF8toUTF16(spec));
   }
 
   // Finally, notify that we've been visited.
   nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
   if (obsService) {
     obsService->NotifyObservers(aURI, NS_LINK_VISITED_EVENT_TOPIC, nullptr);
   }
 }
@@ -287,17 +287,17 @@ nsAndroidHistory::SetURITitle(nsIURI *aU
     nsAutoCString uri;
     nsresult rv = aURI->GetSpec(uri);
     if (NS_FAILED(rv)) return rv;
     if (RemovePendingVisitURI(aURI)) {
       // We have a title, so aURI isn't a redirect, so save the visit now before setting the title.
       SaveVisitURI(aURI);
     }
     NS_ConvertUTF8toUTF16 uriString(uri);
-    java::GeckoAppShell::SetURITitle(uriString, aTitle);
+    widget::GeckoAppShell::SetURITitle(uriString, aTitle);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidHistory::NotifyVisited(nsIURI *aURI)
 {
   if (aURI && sHistory) {
--- a/mobile/android/components/build/nsShellService.cpp
+++ b/mobile/android/components/build/nsShellService.cpp
@@ -1,17 +1,17 @@
 /* -*- 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 "nsShellService.h"
 #include "nsString.h"
 
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsShellService, nsIShellService)
 
 NS_IMETHODIMP
 nsShellService::SwitchTask()
 {
@@ -20,11 +20,11 @@ nsShellService::SwitchTask()
 
 NS_IMETHODIMP
 nsShellService::CreateShortcut(const nsAString& aTitle, const nsAString& aURI,
                                 const nsAString& aIcondata, const nsAString& aIntent)
 {
   if (!aTitle.Length() || !aURI.Length())
     return NS_ERROR_FAILURE;
 
-  java::GeckoAppShell::CreateShortcut(aTitle, aURI);
+  widget::GeckoAppShell::CreateShortcut(aTitle, aURI);
   return NS_OK;
 }
--- a/netwerk/base/Tickler.cpp
+++ b/netwerk/base/Tickler.cpp
@@ -55,17 +55,17 @@ Tickler::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!mTimer);
   MOZ_ASSERT(!mActive);
   MOZ_ASSERT(!mThread);
   MOZ_ASSERT(!mFD);
 
   if (jni::IsAvailable()) {
-      java::GeckoAppShell::EnableNetworkNotifications();
+      widget::GeckoAppShell::EnableNetworkNotifications();
   }
 
   mFD = PR_OpenUDPSocket(PR_AF_INET);
   if (!mFD)
     return NS_ERROR_FAILURE;
 
   // make sure new socket has a ttl of 1
   // failure is not fatal.
--- a/netwerk/protocol/device/AndroidCaptureProvider.cpp
+++ b/netwerk/protocol/device/AndroidCaptureProvider.cpp
@@ -1,16 +1,17 @@
 /* -*- 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 "base/basictypes.h"
 #include "AndroidCaptureProvider.h"
 #include "nsXULAppAPI.h"
+#include "AndroidBridge.h"
 #include "nsStreamUtils.h"
 #include "nsThreadUtils.h"
 #include "nsMemory.h"
 #include "RawStructs.h"
 
 // The maximum number of frames we keep in our queue. Don't live in the past.
 #define MAX_FRAMES_QUEUED 10
 
--- a/netwerk/protocol/device/CameraStreamImpl.cpp
+++ b/netwerk/protocol/device/CameraStreamImpl.cpp
@@ -85,14 +85,14 @@ bool CameraStreamImpl::Init(const nsCStr
 {
     mCallback = aCallback;
     mWidth = width;
     mHeight = height;
     return AndroidBridge::Bridge()->InitCamera(contentType, camera, &mWidth, &mHeight, &mFps);
 }
 
 void CameraStreamImpl::Close() {
-    java::GeckoAppShell::CloseCamera();
+    mozilla::widget::GeckoAppShell::CloseCamera();
     mCallback = nullptr;
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/system/android/nsAndroidNetworkLinkService.cpp
+++ b/netwerk/system/android/nsAndroidNetworkLinkService.cpp
@@ -5,18 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAndroidNetworkLinkService.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 
 #include "AndroidBridge.h"
 
-namespace java = mozilla::java;
-
 NS_IMPL_ISUPPORTS(nsAndroidNetworkLinkService,
                   nsINetworkLinkService)
 
 nsAndroidNetworkLinkService::nsAndroidNetworkLinkService()
 {
 }
 
 nsAndroidNetworkLinkService::~nsAndroidNetworkLinkService()
@@ -28,36 +26,36 @@ nsAndroidNetworkLinkService::GetIsLinkUp
 {
   if (!mozilla::AndroidBridge::Bridge()) {
     // Fail soft here and assume a connection exists
     NS_WARNING("GetIsLinkUp is not supported without a bridge connection");
     *aIsUp = true;
     return NS_OK;
   }
 
-  *aIsUp = java::GeckoAppShell::IsNetworkLinkUp();
+  *aIsUp = mozilla::widget::GeckoAppShell::IsNetworkLinkUp();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidNetworkLinkService::GetLinkStatusKnown(bool *aIsKnown)
 {
   NS_ENSURE_TRUE(mozilla::AndroidBridge::Bridge(), NS_ERROR_NOT_IMPLEMENTED);
 
-  *aIsKnown = java::GeckoAppShell::IsNetworkLinkKnown();
+  *aIsKnown = mozilla::widget::GeckoAppShell::IsNetworkLinkKnown();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidNetworkLinkService::GetLinkType(uint32_t *aLinkType)
 {
   NS_ENSURE_ARG_POINTER(aLinkType);
 
   if (!mozilla::AndroidBridge::Bridge()) {
     // Fail soft here and assume a connection exists
     NS_WARNING("GetLinkType is not supported without a bridge connection");
     *aLinkType = nsINetworkLinkService::LINK_TYPE_UNKNOWN;
     return NS_OK;
   }
 
-  *aLinkType = java::GeckoAppShell::NetworkLinkType();
+  *aLinkType = mozilla::widget::GeckoAppShell::NetworkLinkType();
   return NS_OK;
 }
--- a/toolkit/components/alerts/nsAlertsService.cpp
+++ b/toolkit/components/alerts/nsAlertsService.cpp
@@ -292,17 +292,17 @@ NS_IMETHODIMP nsAlertsService::CloseAler
 {
   if (XRE_IsContentProcess()) {
     ContentChild* cpc = ContentChild::GetSingleton();
     cpc->SendCloseAlert(nsAutoString(aAlertName), IPC::Principal(aPrincipal));
     return NS_OK;
   }
 
 #ifdef MOZ_WIDGET_ANDROID
-  java::GeckoAppShell::CloseNotification(aAlertName);
+  widget::GeckoAppShell::CloseNotification(aAlertName);
   return NS_OK;
 #else
 
   nsresult rv;
   // Try the system notification service.
   if (mBackend) {
     rv = mBackend->CloseAlert(aAlertName, aPrincipal);
     if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -349,28 +349,29 @@ NS_IMETHODIMP nsAlertsService::SetManual
 }
 
 NS_IMETHODIMP nsAlertsService::OnProgress(const nsAString & aAlertName,
                                           int64_t aProgress,
                                           int64_t aProgressMax,
                                           const nsAString & aAlertText)
 {
 #ifdef MOZ_WIDGET_ANDROID
-  java::GeckoAppShell::AlertsProgressListener_OnProgress(
-      aAlertName, aProgress, aProgressMax, aAlertText);
+  widget::GeckoAppShell::AlertsProgressListener_OnProgress(aAlertName,
+                                                           aProgress, aProgressMax,
+                                                           aAlertText);
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif // !MOZ_WIDGET_ANDROID
 }
 
 NS_IMETHODIMP nsAlertsService::OnCancel(const nsAString & aAlertName)
 {
 #ifdef MOZ_WIDGET_ANDROID
-  java::GeckoAppShell::CloseNotification(aAlertName);
+  widget::GeckoAppShell::CloseNotification(aAlertName);
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif // !MOZ_WIDGET_ANDROID
 }
 
 already_AddRefed<nsIAlertsDoNotDisturb>
 nsAlertsService::GetDNDBackend()
--- a/toolkit/components/downloads/nsDownloadManager.cpp
+++ b/toolkit/components/downloads/nsDownloadManager.cpp
@@ -56,17 +56,17 @@
 #endif
 #endif
 
 #ifdef XP_MACOSX
 #include <CoreFoundation/CoreFoundation.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 #endif
 
 #ifdef MOZ_WIDGET_GTK
 #include <gtk/gtk.h>
 #endif
 
 using namespace mozilla;
 using mozilla::downloads::GenerateGUID;
@@ -2786,17 +2786,17 @@ nsDownload::SetState(DownloadState aStat
           if (addToRecentDocs) {
             nsCOMPtr<nsIMIMEInfo> mimeInfo;
             nsAutoCString contentType;
             GetMIMEInfo(getter_AddRefs(mimeInfo));
 
             if (mimeInfo)
               mimeInfo->GetMIMEType(contentType);
 
-            java::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
+            mozilla::widget::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
           }
 #else
           if (addToRecentDocs && !mPrivate) {
 #ifdef XP_WIN
             ::SHAddToRecentDocs(SHARD_PATHW, path.get());
 #elif defined(MOZ_WIDGET_GTK)
             GtkRecentManager* manager = gtk_recent_manager_get_default();
 
--- a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
+++ b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
@@ -22,17 +22,17 @@
 #include "nsILocalFileWin.h"
 #endif
 
 #ifdef XP_MACOSX
 #include <CoreFoundation/CoreFoundation.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 #endif
 
 #ifdef MOZ_WIDGET_GTK
 #include <gtk/gtk.h>
 #endif
 
 using namespace mozilla;
 
@@ -79,17 +79,17 @@ nsresult DownloadPlatform::DownloadDone(
   if (aTarget && NS_SUCCEEDED(aTarget->GetPath(path))) {
 #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_ANDROID)
     // On Windows and Gtk, add the download to the system's "recent documents"
     // list, with a pref to disable.
     {
       bool addToRecentDocs = Preferences::GetBool(PREF_BDM_ADDTORECENTDOCS);
 #ifdef MOZ_WIDGET_ANDROID
       if (addToRecentDocs) {
-        java::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
+        mozilla::widget::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
       }
 #else
       if (addToRecentDocs && !aIsPrivate) {
 #ifdef XP_WIN
         ::SHAddToRecentDocs(SHARD_PATHW, path.get());
 #elif defined(MOZ_WIDGET_GTK)
         GtkRecentManager* manager = gtk_recent_manager_get_default();
 
--- a/toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp
+++ b/toolkit/components/parentalcontrols/nsParentalControlsServiceAndroid.cpp
@@ -1,27 +1,25 @@
 /* -*- 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 "nsParentalControlsService.h"
+#include "AndroidBridge.h"
 #include "nsString.h"
 #include "nsIFile.h"
-#include "GeneratedJNIWrappers.h"
-
-namespace java = mozilla::java;
 
 NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService)
 
 nsParentalControlsService::nsParentalControlsService() :
   mEnabled(false)
 {
   if (mozilla::jni::IsAvailable()) {
-    mEnabled = java::Restrictions::IsUserRestricted();
+    mEnabled = mozilla::widget::Restrictions::IsUserRestricted();
   }
 }
 
 nsParentalControlsService::~nsParentalControlsService()
 {
 }
 
 NS_IMETHODIMP
@@ -89,15 +87,15 @@ nsParentalControlsService::IsAllowed(int
 
   if (mozilla::jni::IsAvailable()) {
     nsAutoCString url;
     if (aUri) {
       rv = aUri->GetSpec(url);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
-    *_retval = java::Restrictions::IsAllowed(aAction,
+    *_retval = mozilla::widget::Restrictions::IsAllowed(aAction,
                                                     NS_ConvertUTF8toUTF16(url));
     return rv;
   }
 
   return NS_ERROR_NOT_AVAILABLE;
 }
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -194,17 +194,17 @@
 #include "base/command_line.h"
 #include "GTestRunner.h"
 
 #ifdef MOZ_B2G_LOADER
 #include "ProcessUtils.h"
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 #endif
 
 #if defined(MOZ_SANDBOX)
 #if defined(XP_LINUX) && !defined(ANDROID)
 #include "mozilla/SandboxInfo.h"
 #elif defined(XP_WIN)
 #include "SandboxBroker.h"
 #endif
@@ -1715,17 +1715,17 @@ static nsresult LaunchChild(nsINativeApp
   if (aBlankCommandLine) {
     gRestartArgc = 1;
     gRestartArgv[gRestartArgc] = nullptr;
   }
 
   SaveToEnv("MOZ_LAUNCHED_CHILD=1");
 
 #if defined(MOZ_WIDGET_ANDROID)
-  java::GeckoAppShell::ScheduleRestart();
+  mozilla::widget::GeckoAppShell::ScheduleRestart();
 #else
 #if defined(XP_MACOSX)
   CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, true);
   uint32_t restartMode = 0;
   restartMode = gRestartMode;
   LaunchChildMac(gRestartArgc, gRestartArgv, restartMode);
 #else
   nsCOMPtr<nsIFile> lf;
@@ -1853,17 +1853,17 @@ ProfileLockedDialog(nsIFile* aProfileDir
 
     nsCOMPtr<nsIPromptService> ps
       (do_GetService(NS_PROMPTSERVICE_CONTRACTID));
     NS_ENSURE_TRUE(ps, NS_ERROR_FAILURE);
 
     if (aUnlocker) {
       int32_t button;
 #ifdef MOZ_WIDGET_ANDROID
-      java::GeckoAppShell::KillAnyZombies();
+      mozilla::widget::GeckoAppShell::KillAnyZombies();
       button = 0;
 #else
       const uint32_t flags =
         (nsIPromptService::BUTTON_TITLE_IS_STRING *
          nsIPromptService::BUTTON_POS_0) +
         (nsIPromptService::BUTTON_TITLE_CANCEL *
          nsIPromptService::BUTTON_POS_1);
 
@@ -1882,17 +1882,17 @@ ProfileLockedDialog(nsIFile* aProfileDir
 
         SaveFileToEnv("XRE_PROFILE_PATH", aProfileDir);
         SaveFileToEnv("XRE_PROFILE_LOCAL_PATH", aProfileLocalDir);
 
         return LaunchChild(aNative);
       }
     } else {
 #ifdef MOZ_WIDGET_ANDROID
-      if (java::GeckoAppShell::UnlockProfile()) {
+      if (mozilla::widget::GeckoAppShell::UnlockProfile()) {
         return NS_LockProfilePath(aProfileDir, aProfileLocalDir,
                                   nullptr, aResult);
       }
 #else
       rv = ps->Alert(nullptr, killTitle, killMessage);
       NS_ENSURE_SUCCESS_LOG(rv, rv);
 #endif
     }
--- a/tools/profiler/core/GeckoSampler.cpp
+++ b/tools/profiler/core/GeckoSampler.cpp
@@ -480,17 +480,17 @@ void BuildJavaThreadJSObject(SpliceableJ
           }
           break;
         }
         // the first time around, open the sample object and frames array
         if (firstRun) {
           firstRun = false;
 
           double sampleTime =
-              java::GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId);
+            mozilla::widget::GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId);
 
           aWriter.StartObjectElement();
             aWriter.DoubleProperty("time", sampleTime);
 
             aWriter.StartArrayProperty("frames");
         }
         // add a frame to the sample
         aWriter.StartObjectElement();
@@ -557,25 +557,25 @@ void GeckoSampler::StreamJSON(Spliceable
         if (os) {
           RefPtr<ProfileSaveEvent> pse = new ProfileSaveEvent(SubProcessCallback, &closure);
           os->NotifyObservers(pse, "profiler-subprocess", nullptr);
         }
       }
 
   #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
       if (ProfileJava()) {
-        java::GeckoJavaSampler::PauseJavaProfiling();
+        mozilla::widget::GeckoJavaSampler::PauseJavaProfiling();
 
         aWriter.Start();
         {
           BuildJavaThreadJSObject(aWriter);
         }
         aWriter.End();
 
-        java::GeckoJavaSampler::UnpauseJavaProfiling();
+        mozilla::widget::GeckoJavaSampler::UnpauseJavaProfiling();
       }
   #endif
 #endif
 
       SetPaused(false);
     }
     aWriter.EndArray();
   }
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -31,33 +31,33 @@
 #endif
 #include "ProfilerMarkers.h"
 
 #ifdef MOZ_TASK_TRACER
 #include "GeckoTaskTracer.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-  #include "GeneratedJNIWrappers.h"
+  #include "AndroidBridge.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
 #include "GeneratedJNINatives.h"
 #endif
 
 #ifndef SPS_STANDALONE
 #if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_x86_linux)
 # define USE_LUL_STACKWALK
 # include "lul/LulMain.h"
 # include "lul/platform-linux-lul.h"
 #endif
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-class GeckoJavaSampler : public java::GeckoJavaSampler::Natives<GeckoJavaSampler>
+class GeckoJavaSampler : public widget::GeckoJavaSampler::Natives<GeckoJavaSampler>
 {
 private:
   GeckoJavaSampler();
 
 public:
   static double GetProfilerTime() {
     if (!profiler_is_active()) {
       return 0.0;
@@ -820,17 +820,17 @@ void mozilla_sampler_start(int aProfileE
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
   if (t->ProfileJava()) {
     int javaInterval = aInterval;
     // Java sampling doesn't accuratly keep up with 1ms sampling
     if (javaInterval < 10) {
       aInterval = 10;
     }
-    java::GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000);
+    mozilla::widget::GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000);
   }
 #endif
 
 #ifndef SPS_STANDALONE
   if (t->AddMainThreadIO()) {
     if (!sInterposeObserver) {
       // Lazily create IO interposer observer
       sInterposeObserver = new mozilla::ProfilerIOInterposeObserver();
--- a/uriloader/exthandler/android/nsAndroidHandlerApp.cpp
+++ b/uriloader/exthandler/android/nsAndroidHandlerApp.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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 "nsAndroidHandlerApp.h"
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 
 using namespace mozilla;
 
 
 NS_IMPL_ISUPPORTS(nsAndroidHandlerApp, nsIHandlerApp, nsISharingHandlerApp)
 
 nsAndroidHandlerApp::nsAndroidHandlerApp(const nsAString& aName,
                                          const nsAString& aDescription,
@@ -71,21 +71,21 @@ nsAndroidHandlerApp::Equals(nsIHandlerAp
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowContext)
 {
   nsCString uriSpec;
   aURI->GetSpec(uriSpec);
-  return java::GeckoAppShell::OpenUriExternal(
+  return widget::GeckoAppShell::OpenUriExternal(
           uriSpec, mMimeType, mPackageName, mClassName,
           mAction, EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title)
 {
-  return java::GeckoAppShell::OpenUriExternal(
+  return widget::GeckoAppShell::OpenUriExternal(
           data, mMimeType, mPackageName, mClassName,
           mAction, EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
 }
 
--- a/uriloader/exthandler/android/nsExternalSharingAppService.cpp
+++ b/uriloader/exthandler/android/nsExternalSharingAppService.cpp
@@ -26,17 +26,17 @@ nsExternalSharingAppService::~nsExternal
 
 NS_IMETHODIMP
 nsExternalSharingAppService::ShareWithDefault(const nsAString & data,
                                               const nsAString & mime,
                                               const nsAString & title)
 {
   NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
   const nsString emptyString = EmptyString();
-  return java::GeckoAppShell::OpenUriExternal(data,
+  return widget::GeckoAppShell::OpenUriExternal(data,
       mime, emptyString, emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsExternalSharingAppService::GetSharingApps(const nsAString & aMIMEType,
                                             uint32_t *aLen,
                                             nsISharingHandlerApp ***aHandlers)
 {
--- a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
+++ b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
@@ -31,17 +31,17 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIUR
 
   nsAutoString mimeType;
   if (mType.Equals(uriScheme) || mType.Equals(uriSpec)) {
     mimeType = EmptyString();
   } else {
     mimeType = NS_ConvertUTF8toUTF16(mType);
   }
 
-  if (java::GeckoAppShell::OpenUriExternal(
+  if (widget::GeckoAppShell::OpenUriExternal(
       NS_ConvertUTF8toUTF16(uriSpec), mimeType, EmptyString(),
       EmptyString(), EmptyString(), EmptyString())) {
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
 bool
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -95,17 +95,17 @@
 #include "nsIDocShellTreeItem.h"
 #include "ExternalHelperAppChild.h"
 
 #ifdef XP_WIN
 #include "nsWindowsHelpers.h"
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 #endif
 
 #include "mozilla/Preferences.h"
 #include "mozilla/ipc/URIUtils.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsDeviceStorage.h"
 #endif
@@ -377,17 +377,17 @@ static nsresult GetDownloadDirectory(nsI
   dir = dsf->mFile;
 #elif defined(ANDROID)
   // We ask Java for the temporary download directory. The directory will be
   // different depending on whether we have the permission to write to the
   // public download directory or not.
   // In the case where we do not have the permission we will start the
   // download to the app cache directory and later move it to the final
   // destination after prompting for the permission.
-  auto downloadDir = java::DownloadsIntegration::GetTemporaryDownloadDirectory();
+  auto downloadDir = widget::DownloadsIntegration::GetTemporaryDownloadDirectory();
 
   nsresult rv;
   if (downloadDir) {
     nsCOMPtr<nsIFile> ldir;
     rv = NS_NewNativeLocalFile(downloadDir->ToCString(),
                                true, getter_AddRefs(ldir));
 
     NS_ENSURE_SUCCESS(rv, rv);
--- a/widget/android/ANRReporter.h
+++ b/widget/android/ANRReporter.h
@@ -5,17 +5,17 @@
 
 #ifndef ANRReporter_h__
 #define ANRReporter_h__
 
 #include "GeneratedJNINatives.h"
 
 namespace mozilla {
 
-class ANRReporter : public java::ANRReporter::Natives<ANRReporter>
+class ANRReporter : public widget::ANRReporter::Natives<ANRReporter>
 {
 private:
     ANRReporter();
 
 public:
     static bool RequestNativeStack(bool aUnwind);
     static jni::String::LocalRef GetNativeStack();
     static void ReleaseNativeStack();
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -52,17 +52,17 @@
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/ContentChild.h"
 #include "nsIObserverService.h"
 #include "MediaPrefs.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::jni;
-using namespace mozilla::java;
+using namespace mozilla::widget;
 
 AndroidBridge* AndroidBridge::sBridge = nullptr;
 pthread_t AndroidBridge::sJavaUiThread;
 static jobject sGlobalContext = nullptr;
 nsDataHashtable<nsStringHashKey, nsString> AndroidBridge::sStoragePaths;
 
 // This is a dummy class that can be used in the template for android::sp
 class AndroidRefable {
@@ -194,22 +194,22 @@ AndroidBridge::AndroidBridge()
   , mPresentationWindow(nullptr)
   , mPresentationSurface(nullptr)
 {
     ALOG_BRIDGE("AndroidBridge::Init");
 
     JNIEnv* const jEnv = jni::GetGeckoThreadEnv();
     AutoLocalJNIFrame jniFrame(jEnv);
 
-    mClassLoader = Object::GlobalRef(jEnv, java::GeckoThread::ClsLoader());
+    mClassLoader = Object::GlobalRef(jEnv, widget::GeckoThread::ClsLoader());
     mClassLoaderLoadClass = GetMethodID(
             jEnv, jEnv->GetObjectClass(mClassLoader.Get()),
             "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;");
 
-    mMessageQueue = java::GeckoThread::MsgQueue();
+    mMessageQueue = widget::GeckoThread::MsgQueue();
     auto msgQueueClass = Class::LocalRef::Adopt(
             jEnv, jEnv->GetObjectClass(mMessageQueue.Get()));
     // mMessageQueueNext must not be null
     mMessageQueueNext = GetMethodID(
             jEnv, msgQueueClass.Get(), "next", "()Landroid/os/Message;");
     // mMessageQueueMessages may be null (e.g. due to proguard optimization)
     mMessageQueueMessages = jEnv->GetFieldID(
             msgQueueClass.Get(), "mMessages", "Landroid/os/Message;");
@@ -982,17 +982,17 @@ AndroidBridge::GetCurrentBatteryInformat
     env->ReleaseDoubleArrayElements(arr.Get(), info, 0);
 }
 
 void
 AndroidBridge::HandleGeckoMessage(JSContext* cx, JS::HandleObject object)
 {
     ALOG_BRIDGE("%s", __PRETTY_FUNCTION__);
 
-    auto message = widget::CreateNativeJSContainer(cx, object);
+    auto message = mozilla::widget::CreateNativeJSContainer(cx, object);
     GeckoAppShell::HandleGeckoMessageWrapper(message);
 }
 
 nsresult
 AndroidBridge::GetSegmentInfoForText(const nsAString& aText,
                                      nsIMobileMessageCallback* aRequest)
 {
 #ifndef MOZ_WEBSMS_BACKEND
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -151,18 +151,18 @@ public:
     nsresult CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, jni::ByteBuffer::Param buffer, bool &shouldStore);
     void GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort);
     void ContentDocumentChanged();
     bool IsContentDocumentDisplayed();
 
     bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical,
                                    mozilla::ParentLayerPoint& aScrollOffset, mozilla::CSSToParentLayerScale& aZoom);
 
-    void SetLayerClient(java::GeckoLayerClient::Param jobj);
-    const java::GeckoLayerClient::Ref& GetLayerClient() { return mLayerClient; }
+    void SetLayerClient(widget::GeckoLayerClient::Param jobj);
+    const widget::GeckoLayerClient::Ref& GetLayerClient() { return mLayerClient; }
 
     bool GetHandlersForURL(const nsAString& aURL,
                            nsIMutableArray* handlersArray = nullptr,
                            nsIHandlerApp **aDefaultApp = nullptr,
                            const nsAString& aAction = EmptyString());
 
     bool GetHandlersForMimeType(const nsAString& aMimeType,
                                 nsIMutableArray* handlersArray = nullptr,
@@ -337,17 +337,17 @@ public:
 protected:
     static nsDataHashtable<nsStringHashKey, nsString> sStoragePaths;
 
     static pthread_t sJavaUiThread;
     static AndroidBridge* sBridge;
     nsTArray<nsCOMPtr<nsIMobileMessageCallback>> mSmsRequests;
     nsTArray<nsCOMPtr<nsIMobileMessageCursorCallback>> mSmsCursorRequests;
 
-    java::GeckoLayerClient::GlobalRef mLayerClient;
+    widget::GeckoLayerClient::GlobalRef mLayerClient;
 
     // the android.telephony.SmsMessage class
     jclass mAndroidSmsMessageClass;
 
     AndroidBridge();
     ~AndroidBridge();
 
     bool mOpenedGraphicsLibraries;
--- a/widget/android/GeckoNetworkManager.h
+++ b/widget/android/GeckoNetworkManager.h
@@ -11,17 +11,17 @@
 #include "nsCOMPtr.h"
 #include "nsINetworkLinkService.h"
 
 #include "mozilla/Services.h"
 
 namespace mozilla {
 
 class GeckoNetworkManager final
-    : public java::GeckoNetworkManager::Natives<GeckoNetworkManager>
+    : public widget::GeckoNetworkManager::Natives<GeckoNetworkManager>
     , public UsesGeckoThreadProxy
 {
     GeckoNetworkManager() = delete;
 
 public:
     static void
     OnConnectionChanged(int32_t aType, jni::String::Param aSubType,
                         bool aIsWifi, int32_t aGateway)
--- a/widget/android/GeckoScreenOrientation.h
+++ b/widget/android/GeckoScreenOrientation.h
@@ -12,17 +12,17 @@
 #include "nsIScreenManager.h"
 
 #include "mozilla/Hal.h"
 #include "mozilla/dom/ScreenOrientation.h"
 
 namespace mozilla {
 
 class GeckoScreenOrientation final
-    : public java::GeckoScreenOrientation::Natives<GeckoScreenOrientation>
+    : public widget::GeckoScreenOrientation::Natives<GeckoScreenOrientation>
     , public UsesGeckoThreadProxy
 {
     GeckoScreenOrientation() = delete;
 
 public:
     static void
     OnOrientationChange(int16_t aOrientation, int16_t aAngle)
     {
--- a/widget/android/GeneratedJNINatives.h
+++ b/widget/android/GeneratedJNINatives.h
@@ -6,17 +6,17 @@
 
 #ifndef GeneratedJNINatives_h
 #define GeneratedJNINatives_h
 
 #include "GeneratedJNIWrappers.h"
 #include "mozilla/jni/Natives.h"
 
 namespace mozilla {
-namespace java {
+namespace widget {
 
 template<class Impl>
 class ANRReporter::Natives : public mozilla::jni::NativeImpl<ANRReporter, Impl>
 {
 public:
     static const JNINativeMethod methods[3];
 };
 
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -3,17 +3,17 @@
 // from annotations on Java methods. To update, change the annotations on the
 // corresponding Java methods and rerun the build. Manually updating this file
 // will cause your build to fail.
 
 #include "GeneratedJNIWrappers.h"
 #include "mozilla/jni/Accessors.h"
 
 namespace mozilla {
-namespace java {
+namespace widget {
 
 const char ANRReporter::name[] =
         "org/mozilla/gecko/ANRReporter";
 
 constexpr char ANRReporter::GetNativeStack_t::name[];
 constexpr char ANRReporter::GetNativeStack_t::signature[];
 
 constexpr char ANRReporter::ReleaseNativeStack_t::name[];
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -5,17 +5,17 @@
 // will cause your build to fail.
 
 #ifndef GeneratedJNIWrappers_h
 #define GeneratedJNIWrappers_h
 
 #include "mozilla/jni/Refs.h"
 
 namespace mozilla {
-namespace java {
+namespace widget {
 
 class ANRReporter : public mozilla::jni::ObjectBase<ANRReporter, jobject>
 {
 public:
     static const char name[];
 
     explicit ANRReporter(const Context& ctx) : ObjectBase<ANRReporter, jobject>(ctx) {}
 
--- a/widget/android/NativeJSContainer.h
+++ b/widget/android/NativeJSContainer.h
@@ -7,16 +7,16 @@
 #define NativeJSObject_h__
 
 #include "GeneratedJNIWrappers.h"
 #include "jsapi.h"
 
 namespace mozilla {
 namespace widget {
 
-java::NativeJSContainer::LocalRef
-CreateNativeJSContainer(JSContext* cx, JS::HandleObject object);
+NativeJSContainer::LocalRef CreateNativeJSContainer(
+        JSContext* cx, JS::HandleObject object);
 
 } // namespace widget
 } // namespace mozilla
 
 #endif // NativeJSObject_h__
 
--- a/widget/android/PrefsHelper.h
+++ b/widget/android/PrefsHelper.h
@@ -15,17 +15,17 @@
 #include "mozilla/Maybe.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/UniquePtr.h"
 
 namespace mozilla {
 
 class PrefsHelper
-    : public java::PrefsHelper::Natives<PrefsHelper>
+    : public widget::PrefsHelper::Natives<PrefsHelper>
     , public UsesGeckoThreadProxy
 {
     PrefsHelper() = delete;
 
     static bool GetVariantPref(nsIObserverService* aObsServ,
                                nsIWritableVariant* aVariant,
                                jni::Object::Param aPrefHandler,
                                const jni::String::LocalRef& aPrefName)
@@ -35,57 +35,56 @@ class PrefsHelper
             return false;
         }
 
         uint16_t varType = nsIDataType::VTYPE_EMPTY;
         if (NS_FAILED(aVariant->GetDataType(&varType))) {
             return false;
         }
 
-        int32_t type = java::PrefsHelper::PREF_INVALID;
+        int32_t type = widget::PrefsHelper::PREF_INVALID;
         bool boolVal = false;
         int32_t intVal = 0;
         nsAutoString strVal;
 
         switch (varType) {
             case nsIDataType::VTYPE_BOOL:
-                type = java::PrefsHelper::PREF_BOOL;
+                type = widget::PrefsHelper::PREF_BOOL;
                 if (NS_FAILED(aVariant->GetAsBool(&boolVal))) {
                     return false;
                 }
                 break;
             case nsIDataType::VTYPE_INT32:
-                type = java::PrefsHelper::PREF_INT;
+                type = widget::PrefsHelper::PREF_INT;
                 if (NS_FAILED(aVariant->GetAsInt32(&intVal))) {
                     return false;
                 }
                 break;
             case nsIDataType::VTYPE_ASTRING:
-                type = java::PrefsHelper::PREF_STRING;
+                type = widget::PrefsHelper::PREF_STRING;
                 if (NS_FAILED(aVariant->GetAsAString(strVal))) {
                     return false;
                 }
                 break;
             default:
                 return false;
         }
 
         Maybe<jni::StringParam> jstrVal;
         jstrVal.emplace(nullptr);
-        if (type == java::PrefsHelper::PREF_STRING) {
+        if (type == widget::PrefsHelper::PREF_STRING) {
             jstrVal.reset();
             jstrVal.emplace(strVal, aPrefName.Env());
         }
 
         if (aPrefHandler) {
-            java::PrefsHelper::CallPrefHandler(
-                    aPrefHandler, type, aPrefName,
-                    boolVal, intVal, jstrVal.ref());
+            widget::PrefsHelper::CallPrefHandler(
+                    aPrefHandler, type, aPrefName, boolVal, intVal, jstrVal.ref());
         } else {
-            java::PrefsHelper::OnPrefChange(
+            widget::PrefsHelper::OnPrefChange(
                     aPrefName, type, boolVal, intVal, jstrVal.ref());
         }
         return true;
     }
 
     static bool SetVariantPref(nsIObserverService* aObsServ,
                                nsIWritableVariant* aVariant,
                                jni::String::Param aPrefName,
@@ -93,23 +92,23 @@ class PrefsHelper
                                int32_t aType,
                                bool aBoolVal,
                                int32_t aIntVal,
                                jni::String::Param aStrVal)
     {
         nsresult rv = NS_ERROR_FAILURE;
 
         switch (aType) {
-            case java::PrefsHelper::PREF_BOOL:
+            case widget::PrefsHelper::PREF_BOOL:
                 rv = aVariant->SetAsBool(aBoolVal);
                 break;
-            case java::PrefsHelper::PREF_INT:
+            case widget::PrefsHelper::PREF_INT:
                 rv = aVariant->SetAsInt32(aIntVal);
                 break;
-            case java::PrefsHelper::PREF_STRING:
+            case widget::PrefsHelper::PREF_STRING:
                 rv = aVariant->SetAsAString(aStrVal->ToString());
                 break;
         }
 
         if (NS_SUCCEEDED(rv)) {
             rv = aObsServ->NotifyObservers(aVariant, "android-set-pref",
                                            aPrefName->ToString().get());
         }
@@ -145,33 +144,33 @@ public:
         nsCOMPtr<nsIObserverService> obsServ;
         nsCOMPtr<nsIWritableVariant> value;
         nsAdoptingString strVal;
 
         for (jni::Object::LocalRef& nameRef : nameRefArray) {
             jni::String::LocalRef nameStr(mozilla::Move(nameRef));
             const nsCString& name = nameStr->ToCString();
 
-            int32_t type = java::PrefsHelper::PREF_INVALID;
+            int32_t type = widget::PrefsHelper::PREF_INVALID;
             bool boolVal = false;
             int32_t intVal = 0;
 
             switch (Preferences::GetType(name.get())) {
                 case nsIPrefBranch::PREF_BOOL:
-                    type = java::PrefsHelper::PREF_BOOL;
+                    type = widget::PrefsHelper::PREF_BOOL;
                     boolVal = Preferences::GetBool(name.get());
                     break;
 
                 case nsIPrefBranch::PREF_INT:
-                    type = java::PrefsHelper::PREF_INT;
+                    type = widget::PrefsHelper::PREF_INT;
                     intVal = Preferences::GetInt(name.get());
                     break;
 
                 case nsIPrefBranch::PREF_STRING:
-                    type = java::PrefsHelper::PREF_STRING;
+                    type = widget::PrefsHelper::PREF_STRING;
                     strVal = Preferences::GetLocalizedString(name.get());
                     if (!strVal) {
                         strVal = Preferences::GetString(name.get());
                     }
                     break;
 
                 default:
                     // Pref not found; try to find it.
@@ -191,28 +190,27 @@ public:
                         NS_WARNING(nsPrintfCString("Failed to get pref %s",
                                                    name.get()).get());
                     }
                     continue;
             }
 
             Maybe<jni::StringParam> jstrVal;
             jstrVal.emplace(nullptr);
-            if (type == java::PrefsHelper::PREF_STRING) {
+            if (type == widget::PrefsHelper::PREF_STRING) {
                 jstrVal.reset();
                 jstrVal.emplace(strVal, aCls.Env());
             }
 
-            java::PrefsHelper::CallPrefHandler(
-                    aPrefHandler, type, nameStr,
-                    boolVal, intVal, jstrVal.ref());
+            widget::PrefsHelper::CallPrefHandler(
+                    aPrefHandler, type, nameStr, boolVal, intVal, jstrVal.ref());
         }
 
-        java::PrefsHelper::CallPrefHandler(
-                aPrefHandler, java::PrefsHelper::PREF_FINISH,
+        widget::PrefsHelper::CallPrefHandler(
+                aPrefHandler, widget::PrefsHelper::PREF_FINISH,
                 nullptr, false, 0, nullptr);
     }
 
     static void SetPref(jni::String::Param aPrefName,
                         bool aFlush,
                         int32_t aType,
                         bool aBoolVal,
                         int32_t aIntVal,
@@ -230,23 +228,23 @@ public:
                 // The "pref" has changed; send a notification.
                 GetVariantPref(obsServ, value, nullptr,
                                jni::String::LocalRef(aPrefName));
                 return;
             }
         }
 
         switch (aType) {
-            case java::PrefsHelper::PREF_BOOL:
+            case widget::PrefsHelper::PREF_BOOL:
                 Preferences::SetBool(name.get(), aBoolVal);
                 break;
-            case java::PrefsHelper::PREF_INT:
+            case widget::PrefsHelper::PREF_INT:
                 Preferences::SetInt(name.get(), aIntVal);
                 break;
-            case java::PrefsHelper::PREF_STRING:
+            case widget::PrefsHelper::PREF_STRING:
                 Preferences::SetString(name.get(), aStrVal->ToString());
                 break;
             default:
                 MOZ_ASSERT(false, "Invalid pref type");
         }
 
         if (aFlush) {
             Preferences::GetService()->SavePrefFile(nullptr);
@@ -298,43 +296,42 @@ public:
 
         int32_t type = -1;
         bool boolVal = false;
         int32_t intVal = false;
         nsAdoptingString strVal;
 
         switch (Preferences::GetType(name.get())) {
             case nsIPrefBranch::PREF_BOOL:
-                type = java::PrefsHelper::PREF_BOOL;
+                type = widget::PrefsHelper::PREF_BOOL;
                 boolVal = Preferences::GetBool(name.get());
                 break;
             case nsIPrefBranch::PREF_INT:
-                type = java::PrefsHelper::PREF_INT;
+                type = widget::PrefsHelper::PREF_INT;
                 intVal = Preferences::GetInt(name.get());
                 break;
             case nsIPrefBranch::PREF_STRING:
-                type = java::PrefsHelper::PREF_STRING;
+                type = widget::PrefsHelper::PREF_STRING;
                 strVal = Preferences::GetLocalizedString(name.get());
                 if (!strVal) {
                     strVal = Preferences::GetString(name.get());
                 }
                 break;
             default:
                 NS_WARNING(nsPrintfCString("Invalid pref %s",
                                            name.get()).get());
                 return;
         }
 
         Maybe<jni::StringParam> jstrVal;
         jstrVal.emplace(nullptr);
-        if (type == java::PrefsHelper::PREF_STRING) {
+        if (type == widget::PrefsHelper::PREF_STRING) {
             jstrVal.reset();
             jstrVal.emplace(strVal);
         }
 
-        java::PrefsHelper::OnPrefChange(
-                name, type, boolVal, intVal, jstrVal.ref());
+        widget::PrefsHelper::OnPrefChange(name, type, boolVal, intVal, jstrVal.ref());
     }
 };
 
 } // namespace
 
 #endif // PrefsHelper_h
--- a/widget/android/ThumbnailHelper.h
+++ b/widget/android/ThumbnailHelper.h
@@ -22,17 +22,17 @@
 #include "nsPIDOMWindow.h"
 #include "nsPresContext.h"
 
 #include "mozilla/Preferences.h"
 
 namespace mozilla {
 
 class ThumbnailHelper final
-    : public java::ThumbnailHelper::Natives<ThumbnailHelper>
+    : public widget::ThumbnailHelper::Natives<ThumbnailHelper>
     , public jni::UsesNativeCallProxy
 {
     ThumbnailHelper() = delete;
 
     // Decides if we should store thumbnails for a given docshell based on the
     // presence of a Cache-Control: no-store header and the
     // "browser.cache.disk_cache_ssl" pref.
     static bool
@@ -229,25 +229,25 @@ public:
 
         nsCOMPtr<mozIDOMWindowProxy> window;
         nsCOMPtr<nsIBrowserTab> tab;
 
         if (NS_FAILED(browserApp->GetBrowserTab(aTabId, getter_AddRefs(tab))) ||
                 !tab ||
                 NS_FAILED(tab->GetWindow(getter_AddRefs(window))) ||
                 !window) {
-            java::ThumbnailHelper::SendThumbnail(
+            widget::ThumbnailHelper::SendThumbnail(
                     aData, aTabId, /* success */ false, /* store */ false);
             return;
         }
 
         nsCOMPtr<nsIDocShell> docShell = GetThumbnailAndDocShell(
                 window, aData, aWidth, aHeight);
         const bool success = !!docShell;
         const bool store = success ? ShouldStoreThumbnail(docShell) : false;
 
-        java::ThumbnailHelper::SendThumbnail(aData, aTabId, success, store);
+        widget::ThumbnailHelper::SendThumbnail(aData, aTabId, success, store);
     }
 };
 
 } // namespace mozilla
 
 #endif // ThumbnailHelper_h
--- a/widget/android/jni/Utils.cpp
+++ b/widget/android/jni/Utils.cpp
@@ -147,17 +147,17 @@ bool HandleUncaughtException(JNIEnv* aEn
     aEnv->ExceptionDescribe();
 #endif
 
     Throwable::LocalRef e =
             Throwable::LocalRef::Adopt(aEnv->ExceptionOccurred());
     MOZ_ASSERT(e);
 
     aEnv->ExceptionClear();
-    String::LocalRef stack = java::GeckoAppShell::HandleUncaughtException(e);
+    String::LocalRef stack = widget::GeckoAppShell::HandleUncaughtException(e);
 
 #ifdef MOZ_CRASHREPORTER
     if (stack) {
         // GeckoAppShell wants us to annotate and trigger the crash reporter.
         CrashReporter::AnnotateCrashReport(
                 NS_LITERAL_CSTRING("AuxiliaryJavaStack"), stack->ToCString());
     }
 #endif // MOZ_CRASHREPORTER
--- a/widget/android/nsAndroidProtocolHandler.cpp
+++ b/widget/android/nsAndroidProtocolHandler.cpp
@@ -16,17 +16,17 @@
 #include "GeneratedJNIWrappers.h"
 
 using namespace mozilla;
 
 class AndroidInputStream : public nsIInputStream
 {
 public:
     AndroidInputStream(jni::Object::Param connection) {
-        mBridgeInputStream = java::GeckoAppShell::CreateInputStream(connection);
+        mBridgeInputStream = widget::GeckoAppShell::CreateInputStream(connection);
         mBridgeChannel = AndroidBridge::ChannelCreate(mBridgeInputStream);
     }
 
 private:
     virtual ~AndroidInputStream() {
     }
 
 public:
@@ -66,28 +66,28 @@ NS_IMETHODIMP AndroidInputStream::IsNonB
 
 class AndroidChannel : public nsBaseChannel
 {
 private:
     AndroidChannel(nsIURI *aURI, jni::Object::Param aConnection) {
         mConnection = aConnection;
         SetURI(aURI);
 
-        auto type = java::GeckoAppShell::ConnectionGetMimeType(mConnection);
+        auto type = widget::GeckoAppShell::ConnectionGetMimeType(mConnection);
         if (type) {
             SetContentType(type->ToCString());
         }
     }
 
 public:
     static AndroidChannel* CreateChannel(nsIURI *aURI)  {
         nsCString spec;
         aURI->GetSpec(spec);
 
-        auto connection = java::GeckoAppShell::GetConnection(spec);
+        auto connection = widget::GeckoAppShell::GetConnection(spec);
         return connection ? new AndroidChannel(aURI, connection) : nullptr;
     }
 
     virtual ~AndroidChannel() {
     }
 
     virtual nsresult OpenContentStream(bool async, nsIInputStream **result,
                                        nsIChannel** channel) {
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -120,28 +120,28 @@ private:
 class WakeLockListener final : public nsIDOMMozWakeLockListener {
 private:
   ~WakeLockListener() {}
 
 public:
   NS_DECL_ISUPPORTS;
 
   nsresult Callback(const nsAString& topic, const nsAString& state) override {
-    java::GeckoAppShell::NotifyWakeLockChanged(topic, state);
+    widget::GeckoAppShell::NotifyWakeLockChanged(topic, state);
     return NS_OK;
   }
 };
 
 NS_IMPL_ISUPPORTS(WakeLockListener, nsIDOMMozWakeLockListener)
 nsCOMPtr<nsIPowerManagerService> sPowerManagerService = nullptr;
 StaticRefPtr<WakeLockListener> sWakeLockListener;
 
 
 class GeckoThreadSupport final
-    : public java::GeckoThread::Natives<GeckoThreadSupport>
+    : public widget::GeckoThread::Natives<GeckoThreadSupport>
     , public UsesGeckoThreadProxy
 {
     static uint32_t sPauseCount;
 
 public:
     template<typename Functor>
     static void OnNativeCall(Functor&& aCall)
     {
@@ -251,17 +251,17 @@ public:
                 aData ? aData->ToString().get() : nullptr);
     }
 };
 
 uint32_t GeckoThreadSupport::sPauseCount;
 
 
 class GeckoAppShellSupport final
-    : public java::GeckoAppShell::Natives<GeckoAppShellSupport>
+    : public widget::GeckoAppShell::Natives<GeckoAppShellSupport>
     , public UsesGeckoThreadProxy
 {
 public:
     template<typename Functor>
     static void OnNativeCall(Functor&& aCall)
     {
         if (aCall.IsTarget(&SyncNotifyObservers)) {
             aCall();
@@ -387,17 +387,17 @@ nsAppShell::nsAppShell()
         GeckoThreadSupport::Init();
         mozilla::ANRReporter::Init();
         mozilla::GeckoNetworkManager::Init();
         mozilla::GeckoScreenOrientation::Init();
         mozilla::PrefsHelper::Init();
         mozilla::ThumbnailHelper::Init();
         nsWindow::InitNatives();
 
-        java::GeckoThread::SetState(java::GeckoThread::State::JNI_READY());
+        widget::GeckoThread::SetState(widget::GeckoThread::State::JNI_READY());
     }
 
     sPowerManagerService = do_GetService(POWERMANAGERSERVICE_CONTRACTID);
 
     if (sPowerManagerService) {
         sWakeLockListener = new WakeLockListener();
     } else {
         NS_WARNING("Failed to retrieve PowerManagerService, wakelocks will be broken!");
@@ -489,21 +489,21 @@ nsAppShell::Observe(nsISupports* aSubjec
     } else if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
         NS_CreateServicesFromCategory("browser-delayed-startup-finished", nullptr,
                                       "browser-delayed-startup-finished");
 
     } else if (!strcmp(aTopic, "profile-after-change")) {
         if (jni::IsAvailable()) {
             // See if we want to force 16-bit color before doing anything
             if (Preferences::GetBool("gfx.android.rgb16.force", false)) {
-                java::GeckoAppShell::SetScreenDepthOverride(16);
+                widget::GeckoAppShell::SetScreenDepthOverride(16);
             }
 
-            java::GeckoThread::SetState(
-                    java::GeckoThread::State::PROFILE_READY());
+            widget::GeckoThread::SetState(
+                    widget::GeckoThread::State::PROFILE_READY());
 
             // Gecko on Android follows the Android app model where it never
             // stops until it is killed by the system or told explicitly to
             // quit. Therefore, we should *not* exit Gecko when there is no
             // window or the last window is closed. nsIAppStartup::Quit will
             // still force Gecko to exit.
             nsCOMPtr<nsIAppStartup> appStartup =
                 do_GetService(NS_APPSTARTUP_CONTRACTID);
@@ -511,26 +511,26 @@ nsAppShell::Observe(nsISupports* aSubjec
                 appStartup->EnterLastWindowClosingSurvivalArea();
             }
         }
         removeObserver = true;
 
     } else if (!strcmp(aTopic, "chrome-document-loaded")) {
         if (jni::IsAvailable()) {
             // Our first window has loaded, assume any JS initialization has run.
-            java::GeckoThread::CheckAndSetState(
-                    java::GeckoThread::State::PROFILE_READY(),
-                    java::GeckoThread::State::RUNNING());
+            widget::GeckoThread::CheckAndSetState(
+                    widget::GeckoThread::State::PROFILE_READY(),
+                    widget::GeckoThread::State::RUNNING());
         }
         removeObserver = true;
 
     } else if (!strcmp(aTopic, "quit-application-granted")) {
         if (jni::IsAvailable()) {
-            java::GeckoThread::SetState(
-                    java::GeckoThread::State::EXITING());
+            widget::GeckoThread::SetState(
+                    widget::GeckoThread::State::EXITING());
 
             // We are told explicitly to quit, perhaps due to
             // nsIAppStartup::Quit being called. We should release our hold on
             // nsIAppStartup and let it continue to quit.
             nsCOMPtr<nsIAppStartup> appStartup =
                 do_GetService(NS_APPSTARTUP_CONTRACTID);
             if (appStartup) {
                 appStartup->ExitLastWindowClosingSurvivalArea();
@@ -860,17 +860,18 @@ nsAppShell::LegacyGeckoEvent::Run()
             if (!service) {
               break;
             }
             if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_ADDED) {
               int svc_id = service->AddGamepad("android",
                                                dom::GamepadMappingType::Standard,
                                                dom::kStandardGamepadButtons,
                                                dom::kStandardGamepadAxes);
-              java::GeckoAppShell::GamepadAdded(curEvent->ID(), svc_id);
+              widget::GeckoAppShell::GamepadAdded(curEvent->ID(),
+                                                  svc_id);
             } else if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_REMOVED) {
               service->RemoveGamepad(curEvent->ID());
             }
 #endif
         break;
     }
 
     case AndroidGeckoEvent::GAMEPAD_DATA: {
--- a/widget/android/nsClipboard.cpp
+++ b/widget/android/nsClipboard.cpp
@@ -38,17 +38,17 @@ nsClipboard::SetData(nsITransferable *aT
                                                 &len);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsISupportsString> supportsString = do_QueryInterface(tmp);
   // No support for non-text data
   NS_ENSURE_TRUE(supportsString, NS_ERROR_NOT_IMPLEMENTED);
   nsAutoString buffer;
   supportsString->GetData(buffer);
 
-  java::Clipboard::SetClipboardText(buffer);
+  widget::Clipboard::SetClipboardText(buffer);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
 {
   if (aWhichClipboard != kGlobalClipboard)
     return NS_ERROR_NOT_IMPLEMENTED;
@@ -79,33 +79,33 @@ nsClipboard::GetData(nsITransferable *aT
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
 {
   if (aWhichClipboard != kGlobalClipboard)
     return NS_ERROR_NOT_IMPLEMENTED;
-  java::Clipboard::ClearText();
+  widget::Clipboard::ClearText();
   
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::HasDataMatchingFlavors(const char **aFlavorList,
                                     uint32_t aLength, int32_t aWhichClipboard,
                                     bool *aHasText)
 {
   *aHasText = false;
   if (aWhichClipboard != kGlobalClipboard)
     return NS_ERROR_NOT_IMPLEMENTED;
 
   for (uint32_t k = 0; k < aLength; k++) {
     if (strcmp(aFlavorList[k], kUnicodeMime) == 0) {
-      *aHasText = java::Clipboard::HasText();
+      *aHasText = widget::Clipboard::HasText();
       break;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/widget/android/nsLookAndFeel.cpp
+++ b/widget/android/nsLookAndFeel.cpp
@@ -470,17 +470,17 @@ nsLookAndFeel::GetFontImpl(FontID aID, n
 }
 
 /*virtual*/
 bool
 nsLookAndFeel::GetEchoPasswordImpl()
 {
     if (!mInitializedShowPassword) {
         if (XRE_IsParentProcess()) {
-            mShowPassword = java::GeckoAppShell::GetShowPasswordSetting();
+            mShowPassword = widget::GeckoAppShell::GetShowPasswordSetting();
         } else {
             ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
         }
         mInitializedShowPassword = true;
     }
     return mShowPassword;
 }
 
--- a/widget/android/nsScreenManagerAndroid.cpp
+++ b/widget/android/nsScreenManagerAndroid.cpp
@@ -2,16 +2,17 @@
 /* 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/. */
 
 #define MOZ_FATAL_ASSERTIONS_FOR_THREAD_SAFETY
 
 #include "nsScreenManagerAndroid.h"
 #include "nsWindow.h"
+#include "AndroidBridge.h"
 #include "GeneratedJNIWrappers.h"
 #include "AndroidRect.h"
 #include <mozilla/jni/Refs.h>
 
 using namespace mozilla;
 
 nsScreenAndroid::nsScreenAndroid(void *nativeScreen)
 {
@@ -32,17 +33,17 @@ NS_IMETHODIMP
 nsScreenAndroid::GetRect(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
 {
     if (!mozilla::jni::IsAvailable()) {
       // xpcshell most likely
       *outLeft = *outTop = *outWidth = *outHeight = 0;
       return NS_ERROR_FAILURE;
     }
 
-    java::sdk::Rect::LocalRef rect = java::GeckoAppShell::GetScreenSize();
+    widget::sdk::Rect::LocalRef rect = widget::GeckoAppShell::GetScreenSize();
     rect->Left(outLeft);
     rect->Top(outTop);
     rect->Width(outWidth);
     rect->Height(outHeight);
 
     return NS_OK;
 }
 
@@ -59,32 +60,32 @@ NS_IMETHODIMP
 nsScreenAndroid::GetPixelDepth(int32_t *aPixelDepth)
 {
     if (!mozilla::jni::IsAvailable()) {
       // xpcshell most likely
       *aPixelDepth = 16;
       return NS_ERROR_FAILURE;
     }
 
-    *aPixelDepth = java::GeckoAppShell::GetScreenDepthWrapper();
+    *aPixelDepth = widget::GeckoAppShell::GetScreenDepthWrapper();
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsScreenAndroid::GetColorDepth(int32_t *aColorDepth)
 {
     return GetPixelDepth(aColorDepth);
 }
 
 void
 nsScreenAndroid::ApplyMinimumBrightness(uint32_t aBrightness)
 {
     if (mozilla::jni::IsAvailable()) {
-      java::GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
+      widget::GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
     }
 }
 
 NS_IMPL_ISUPPORTS(nsScreenManagerAndroid, nsIScreenManager)
 
 nsScreenManagerAndroid::nsScreenManagerAndroid()
 {
     mOneScreen = new nsScreenAndroid(nullptr);
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -80,19 +80,18 @@ using mozilla::Unused;
 
 #include "nsString.h"
 #include "GeckoProfiler.h" // For PROFILER_LABEL
 #include "nsIXULRuntime.h"
 #include "nsPrintfCString.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
+using namespace mozilla::widget;
 using namespace mozilla::layers;
-using namespace mozilla::java;
-using namespace mozilla::widget;
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
 
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/CompositorSession.h"
 #include "mozilla/layers/LayerTransactionParent.h"
 #include "mozilla/Mutex.h"
@@ -273,29 +272,30 @@ private:
         IMETextChange() :
             mStart(-1), mOldEnd(-1), mNewEnd(-1) {}
 
         IMETextChange(const IMENotification& aIMENotification)
             : mStart(aIMENotification.mTextChangeData.mStartOffset)
             , mOldEnd(aIMENotification.mTextChangeData.mRemovedEndOffset)
             , mNewEnd(aIMENotification.mTextChangeData.mAddedEndOffset)
         {
-            MOZ_ASSERT(aIMENotification.mMessage == NOTIFY_IME_OF_TEXT_CHANGE,
+            MOZ_ASSERT(aIMENotification.mMessage ==
+                           mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE,
                        "IMETextChange initialized with wrong notification");
             MOZ_ASSERT(aIMENotification.mTextChangeData.IsValid(),
                        "The text change notification isn't initialized");
             MOZ_ASSERT(aIMENotification.mTextChangeData.IsInInt32Range(),
                        "The text change notification is out of range");
         }
 
         bool IsEmpty() const { return mStart < 0; }
     };
 
     // GeckoEditable instance used by this nsWindow;
-    java::GeckoEditable::GlobalRef mEditable;
+    mozilla::widget::GeckoEditable::GlobalRef mEditable;
     AutoTArray<mozilla::UniquePtr<mozilla::WidgetEvent>, 8> mIMEKeyEvents;
     AutoTArray<IMETextChange, 4> mIMETextChanges;
     InputContext mInputContext;
     RefPtr<mozilla::TextRangeArray> mIMERanges;
     int32_t mIMEMaskEventsCount; // Mask events when > 0
     bool mIMEUpdatingContext;
     bool mIMESelectionChanged;
     bool mIMETextChangedDuringFlush;
@@ -563,48 +563,48 @@ public:
         return true;
     }
 
     static MouseInput::ButtonType GetButtonType(int button)
     {
         MouseInput::ButtonType result = MouseInput::NONE;
 
         switch (button) {
-            case java::sdk::MotionEvent::BUTTON_PRIMARY:
+            case widget::sdk::MotionEvent::BUTTON_PRIMARY:
                 result = MouseInput::LEFT_BUTTON;
                 break;
-            case java::sdk::MotionEvent::BUTTON_SECONDARY:
+            case widget::sdk::MotionEvent::BUTTON_SECONDARY:
                 result = MouseInput::RIGHT_BUTTON;
                 break;
-            case java::sdk::MotionEvent::BUTTON_TERTIARY:
+            case widget::sdk::MotionEvent::BUTTON_TERTIARY:
                 result = MouseInput::MIDDLE_BUTTON;
                 break;
             default:
                 break;
         }
 
         return result;
     }
 
     static int16_t ConvertButtons(int buttons) {
         int16_t result = 0;
 
-        if (buttons & java::sdk::MotionEvent::BUTTON_PRIMARY) {
+        if (buttons & widget::sdk::MotionEvent::BUTTON_PRIMARY) {
             result |= WidgetMouseEventBase::eLeftButtonFlag;
         }
-        if (buttons & java::sdk::MotionEvent::BUTTON_SECONDARY) {
+        if (buttons & widget::sdk::MotionEvent::BUTTON_SECONDARY) {
             result |= WidgetMouseEventBase::eRightButtonFlag;
         }
-        if (buttons & java::sdk::MotionEvent::BUTTON_TERTIARY) {
+        if (buttons & widget::sdk::MotionEvent::BUTTON_TERTIARY) {
             result |= WidgetMouseEventBase::eMiddleButtonFlag;
         }
-        if (buttons & java::sdk::MotionEvent::BUTTON_BACK) {
+        if (buttons & widget::sdk::MotionEvent::BUTTON_BACK) {
             result |= WidgetMouseEventBase::e4thButtonFlag;
         }
-        if (buttons & java::sdk::MotionEvent::BUTTON_FORWARD) {
+        if (buttons & widget::sdk::MotionEvent::BUTTON_FORWARD) {
             result |= WidgetMouseEventBase::e5thButtonFlag;
         }
 
         return result;
     }
 
     bool HandleMouseEvent(int32_t aAction, int64_t aTime, int32_t aMetaState,
                           float aX, float aY, int buttons)
@@ -2461,31 +2461,31 @@ ConvertAndroidScanCodeToCodeNameIndex(in
         default:
           return CODE_NAME_INDEX_UNKNOWN;
     }
 }
 
 static bool
 IsModifierKey(int32_t keyCode)
 {
-    using mozilla::java::sdk::KeyEvent;
+    using mozilla::widget::sdk::KeyEvent;
     return keyCode == KeyEvent::KEYCODE_ALT_LEFT ||
            keyCode == KeyEvent::KEYCODE_ALT_RIGHT ||
            keyCode == KeyEvent::KEYCODE_SHIFT_LEFT ||
            keyCode == KeyEvent::KEYCODE_SHIFT_RIGHT ||
            keyCode == KeyEvent::KEYCODE_CTRL_LEFT ||
            keyCode == KeyEvent::KEYCODE_CTRL_RIGHT ||
            keyCode == KeyEvent::KEYCODE_META_LEFT ||
            keyCode == KeyEvent::KEYCODE_META_RIGHT;
 }
 
 static Modifiers
 GetModifiers(int32_t metaState)
 {
-    using mozilla::java::sdk::KeyEvent;
+    using mozilla::widget::sdk::KeyEvent;
     return (metaState & KeyEvent::META_ALT_MASK ? MODIFIER_ALT : 0)
         | (metaState & KeyEvent::META_SHIFT_MASK ? MODIFIER_SHIFT : 0)
         | (metaState & KeyEvent::META_CTRL_MASK ? MODIFIER_CONTROL : 0)
         | (metaState & KeyEvent::META_META_MASK ? MODIFIER_META : 0)
         | (metaState & KeyEvent::META_FUNCTION_ON ? MODIFIER_FN : 0)
         | (metaState & KeyEvent::META_CAPS_LOCK_ON ? MODIFIER_CAPSLOCK : 0)
         | (metaState & KeyEvent::META_NUM_LOCK_ON ? MODIFIER_NUMLOCK : 0)
         | (metaState & KeyEvent::META_SCROLL_LOCK_ON ? MODIFIER_SCROLLLOCK : 0);
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -244,12 +244,12 @@ protected:
     static void DumpWindows();
     static void DumpWindows(const nsTArray<nsWindow*>& wins, int indent = 0);
     static void LogWindow(nsWindow *win, int index, int indent);
 
 private:
     void CreateLayerManager(int aCompositorWidth, int aCompositorHeight);
     void RedrawAll();
 
-    mozilla::java::LayerRenderer::Frame::GlobalRef mLayerRendererFrame;
+    mozilla::widget::LayerRenderer::Frame::GlobalRef mLayerRendererFrame;
 };
 
 #endif /* NSWINDOW_H_ */
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -862,17 +862,17 @@ nsSystemInfo::GetAndroidSystemInfo(Andro
     aInfo->hardware() = str;
   }
   int32_t sdk_version;
   if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField(
       "android/os/Build$VERSION", "SDK_INT", &sdk_version)) {
     sdk_version = 0;
   }
   aInfo->sdk_version() = sdk_version;
-  aInfo->isTablet() = java::GeckoAppShell::IsTablet();
+  aInfo->isTablet() = mozilla::widget::GeckoAppShell::IsTablet();
 }
 
 void
 nsSystemInfo::SetupAndroidInfo(const AndroidSystemInfo& aInfo)
 {
   if (!aInfo.device().IsEmpty()) {
     SetPropertyAsAString(NS_LITERAL_STRING("device"), aInfo.device());
   }
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -580,17 +580,17 @@ ParseManifest(NSLocationType aType, File
                             gtk_major_version,
                             gtk_minor_version);
 #elif defined(MOZ_WIDGET_ANDROID)
   bool isTablet = false;
   if (mozilla::AndroidBridge::Bridge()) {
     mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
                                                            "RELEASE",
                                                            osVersion);
-    isTablet = java::GeckoAppShell::IsTablet();
+    isTablet = mozilla::widget::GeckoAppShell::IsTablet();
   }
 #endif
 
   if (XRE_IsContentProcess()) {
     process = kContent;
   } else {
     process = kMain;
   }
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -56,17 +56,17 @@
 #include "CocoaFileUtils.h"
 #include "prmem.h"
 #include "plbase64.h"
 
 static nsresult MacErrorMapper(OSErr inErr);
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
+#include "AndroidBridge.h"
 #include "nsIMIMEService.h"
 #include <linux/magic.h>
 #endif
 
 #ifdef MOZ_ENABLE_CONTENTACTION
 #include <contentaction/contentaction.h>
 #endif
 
@@ -2018,17 +2018,17 @@ nsLocalFile::Launch()
   nsresult rv;
   nsAutoCString type;
   nsCOMPtr<nsIMIMEService> mimeService(do_GetService("@mozilla.org/mime;1", &rv));
   if (NS_SUCCEEDED(rv)) {
     rv = mimeService->GetTypeFromFile(this, type);
   }
 
   nsAutoCString fileUri = NS_LITERAL_CSTRING("file://") + mPath;
-  return java::GeckoAppShell::OpenUriExternal(
+  return widget::GeckoAppShell::OpenUriExternal(
     NS_ConvertUTF8toUTF16(fileUri),
     NS_ConvertUTF8toUTF16(type),
     EmptyString(),
     EmptyString(),
     EmptyString(),
     EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
 #elif defined(MOZ_WIDGET_COCOA)
   CFURLRef url;