Bug 1287946 - Update existing code to use mozilla::java; r=me
authorJim Chen <nchen@mozilla.com>
Thu, 21 Jul 2016 13:49:04 -0400
changeset 306211 a4baceb961e6c6dda640d93ab99ab167e363dbc7
parent 306210 438384ed5ecffad4d6bc6280e0346b3673f8118f
child 306212 44454776e07f7e8d47ea82d8d73171f4380520f8
push id30480
push usercbook@mozilla.com
push dateFri, 22 Jul 2016 09:58:20 +0000
treeherdermozilla-central@e0bc88708ffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1287946
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287946 - Update existing code to use mozilla::java; r=me
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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.h"
 
 namespace mozilla {
 namespace dom {
 
 void StartGamepadMonitoring()
 {
-  widget::GeckoAppShell::StartMonitoringGamepad();
+  java::GeckoAppShell::StartMonitoringGamepad();
 }
 
 void StopGamepadMonitoring()
 {
-  widget::GeckoAppShell::StopMonitoringGamepad();
+  java::GeckoAppShell::StopMonitoringGamepad();
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2833,17 +2833,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 = mozilla::widget::GeckoAppShell::GetShowPasswordSetting();
+  *showPassword = java::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,17 +17,16 @@
 #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,20 +27,16 @@
 #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::widget::sdk;
+using namespace mozilla::java::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::Object::LocalRef::Adopt(
-          env, env->NewDirectByteBuffer(aConfig.mCodecSpecificConfig->Elements(),
-          aConfig.mCodecSpecificConfig->Length()));
+      buffer = jni::ByteBuffer::New(
+          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 widget::HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(
+  return java::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,
-                        widget::sdk::MediaFormat::Param aFormat,
+                        java::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(widget::sdk::Surface::Param aSurface);
+  virtual nsresult InitDecoder(java::sdk::Surface::Param aSurface);
 
-  virtual nsresult Output(widget::sdk::BufferInfo::Param aInfo, void* aBuffer,
-      widget::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
+  virtual nsresult Output(java::sdk::BufferInfo::Param aInfo, void* aBuffer,
+      java::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
   {
     return NS_OK;
   }
 
-  virtual nsresult PostOutput(widget::sdk::BufferInfo::Param aInfo,
-      widget::sdk::MediaFormat::Param aFormat, const media::TimeUnit& aDuration)
+  virtual nsresult PostOutput(java::sdk::BufferInfo::Param aInfo,
+      java::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(widget::sdk::BufferInfo::Param aInfo,
-                         widget::sdk::MediaFormat::Param aFormat,
+  nsresult ProcessOutput(java::sdk::BufferInfo::Param aInfo,
+                         java::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;
-  widget::sdk::MediaFormat::GlobalRef mFormat;
+  java::sdk::MediaFormat::GlobalRef mFormat;
 
   MediaDataDecoderCallback* mCallback;
 
-  widget::sdk::MediaCodec::GlobalRef mDecoder;
+  java::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,17 +14,16 @@
 #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 widget::GeckoSmsManager::Natives<SmsManager>
+class SmsManager : public java::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,17 +3,16 @@
  * 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,16 +1,15 @@
 /* -*- 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,22 +1,23 @@
 /* -*- 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 "ANPBase.h"
+#include "GeneratedJNIWrappers.h"
+#include "PluginPRLibrary.h"
 #include "assert.h"
-#include "ANPBase.h"
-#include <android/log.h>
 #include "nsNPAPIPluginInstance.h"
-#include "AndroidBridge.h"
 #include "nsNPAPIPlugin.h"
-#include "PluginPRLibrary.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;
@@ -55,17 +56,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::widget::GeckoAppShell::LoadPluginClass(className, libName).Forget();
+  return mozilla::java::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,14 +1,13 @@
 /* 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,17 +2,16 @@
 /* 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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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 = widget::GeckoAppShell::GetContext();
+      auto ret = java::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) {
-    widget::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
+    java::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) {
-      widget::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
+      java::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation);
     } else if (oldOrientation != dom::eScreenOrientation_None) {
       // We applied an orientation when we entered fullscreen, but
       // we don't want it anymore
-      widget::GeckoAppShell::UnlockScreenOrientation();
+      java::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;
 
-  widget::GeckoAppShell::RemovePluginView(
+  java::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()
 {
-    widget::GeckoAppShell::EnableLocation(true);
+    java::GeckoAppShell::EnableLocation(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 AndroidLocationProvider::Watch(nsIGeolocationUpdate* aCallback)
 {
     NS_IF_RELEASE(gLocationCallback);
     gLocationCallback = aCallback;
     NS_IF_ADDREF(gLocationCallback);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 AndroidLocationProvider::Shutdown()
 {
-    widget::GeckoAppShell::EnableLocation(false);
+    java::GeckoAppShell::EnableLocation(false);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 AndroidLocationProvider::SetHighAccuracy(bool enable)
 {
-    widget::GeckoAppShell::EnableLocationHighAccuracy(enable);
+    java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.h"
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsHapticFeedback, nsIHapticFeedback)
 
 NS_IMETHODIMP
 nsHapticFeedback::PerformSimpleAction(int32_t aType)
 {
-    widget::GeckoAppShell::PerformHapticFeedback(aType == LongPress);
+    java::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::widget;
-using namespace mozilla::widget::sdk;
+using namespace mozilla::java;
+using namespace mozilla::java::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 widget::sdk::Surface::Ref& JavaSurface() const { return mSurface; }
+  const java::sdk::Surface::Ref& JavaSurface() const { return mSurface; }
 
 private:
   AndroidSurfaceTexture();
   ~AndroidSurfaceTexture();
 
   bool Init(GLContext* aContext, GLuint aTexture);
 
   GLuint mTexture;
-  widget::sdk::SurfaceTexture::GlobalRef mSurfaceTexture;
-  widget::sdk::Surface::GlobalRef mSurface;
+  java::sdk::SurfaceTexture::GlobalRef mSurfaceTexture;
+  java::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,29 +16,32 @@
 // #define ANDROID_APZ_LOG(...) printf_stderr("ANDROID_APZ: " __VA_ARGS__)
 
 static float sMaxFlingSpeed = 0.0f;
 
 namespace mozilla {
 namespace layers {
 
 AndroidSpecificState::AndroidSpecificState() {
-  widget::sdk::ViewConfiguration::LocalRef config;
-  if (widget::sdk::ViewConfiguration::Get(widget::GeckoAppShell::GetApplicationContext(), &config) == NS_OK) {
+  using namespace mozilla::java;
+
+  sdk::ViewConfiguration::LocalRef config;
+  if (sdk::ViewConfiguration::Get(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);
   }
-  widget::StackScroller::LocalRef scroller;
-  if (widget::StackScroller::New(widget::GeckoAppShell::GetApplicationContext(), &scroller) != NS_OK) {
+
+  StackScroller::LocalRef scroller;
+  if (StackScroller::New(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;
   }
 
-  widget::StackScroller::GlobalRef mOverScroller;
+  java::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;
-  widget::StackScroller::GlobalRef mOverScroller;
+  java::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,20 +84,16 @@
 # 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,20 +20,16 @@
 #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 widget::AlarmReceiver::Natives<AlarmReceiver>
+class AlarmReceiver : public java::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()
 {
-    widget::GeckoAppShell::DisableAlarm();
+    java::GeckoAppShell::DisableAlarm();
 }
 
 bool
 SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
 {
-    return widget::GeckoAppShell::SetAlarm(aSeconds, aNanoseconds);
+    return java::GeckoAppShell::SetAlarm(aSeconds, aNanoseconds);
 }
 
 } // hal_impl
 } // mozilla
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -10,16 +10,18 @@
 #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
@@ -49,65 +51,65 @@ Vibrate(const nsTArray<uint32_t> &patter
   b->Vibrate(pattern);
 }
 
 void
 CancelVibrate(const WindowIdentifier &)
 {
   // Ignore WindowIdentifier parameter.
 
-  mozilla::widget::GeckoAppShell::CancelVibrate();
+  java::GeckoAppShell::CancelVibrate();
 }
 
 void
 EnableBatteryNotifications()
 {
-  mozilla::widget::GeckoAppShell::EnableBatteryNotifications();
+  java::GeckoAppShell::EnableBatteryNotifications();
 }
 
 void
 DisableBatteryNotifications()
 {
-  mozilla::widget::GeckoAppShell::DisableBatteryNotifications();
+  java::GeckoAppShell::DisableBatteryNotifications();
 }
 
 void
 GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
 {
   AndroidBridge::Bridge()->GetCurrentBatteryInformation(aBatteryInfo);
 }
 
 void
 EnableNetworkNotifications()
 {
-  mozilla::widget::GeckoAppShell::EnableNetworkNotifications();
+  java::GeckoAppShell::EnableNetworkNotifications();
 }
 
 void
 DisableNetworkNotifications()
 {
-  mozilla::widget::GeckoAppShell::DisableNetworkNotifications();
+  java::GeckoAppShell::DisableNetworkNotifications();
 }
 
 void
 GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo)
 {
   AndroidBridge::Bridge()->GetCurrentNetworkInformation(aNetworkInfo);
 }
 
 void
 EnableScreenConfigurationNotifications()
 {
-  mozilla::widget::GeckoAppShell::EnableScreenOrientationNotifications();
+  java::GeckoAppShell::EnableScreenOrientationNotifications();
 }
 
 void
 DisableScreenConfigurationNotifications()
 {
-  mozilla::widget::GeckoAppShell::DisableScreenOrientationNotifications();
+  java::GeckoAppShell::DisableScreenOrientationNotifications();
 }
 
 void
 GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
 {
   AndroidBridge* bridge = AndroidBridge::Bridge();
   if (!bridge) {
     return;
@@ -150,24 +152,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:
-      mozilla::widget::GeckoAppShell::LockScreenOrientation(orientation);
+      java::GeckoAppShell::LockScreenOrientation(orientation);
       return true;
     default:
       return false;
   }
 }
 
 void
 UnlockScreenOrientation()
 {
-  mozilla::widget::GeckoAppShell::UnlockScreenOrientation();
+  java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.h"
 
 using namespace mozilla::hal;
 
 namespace mozilla {
 namespace hal_impl {
 
 void
 EnableSensorNotifications(SensorType aSensor) {
-  widget::GeckoAppShell::EnableSensor(aSensor);
+  java::GeckoAppShell::EnableSensor(aSensor);
 }
 
 void
 DisableSensorNotifications(SensorType aSensor) {
-  widget::GeckoAppShell::DisableSensor(aSensor);
+  java::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::widget::sdk;
+using namespace mozilla::java::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()) {
-    widget::GeckoAppShell::CheckURIVisited(uriString);
+    java::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);
-    widget::GeckoAppShell::MarkURIVisited(NS_ConvertUTF8toUTF16(spec));
+    java::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);
-    widget::GeckoAppShell::SetURITitle(uriString, aTitle);
+    java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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;
 
-  widget::GeckoAppShell::CreateShortcut(aTitle, aURI);
+  java::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()) {
-      widget::GeckoAppShell::EnableNetworkNotifications();
+      java::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,17 +1,16 @@
 /* -*- 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() {
-    mozilla::widget::GeckoAppShell::CloseCamera();
+    java::GeckoAppShell::CloseCamera();
     mCallback = nullptr;
 }
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/system/android/nsAndroidNetworkLinkService.cpp
+++ b/netwerk/system/android/nsAndroidNetworkLinkService.cpp
@@ -5,16 +5,18 @@
  * 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()
@@ -26,36 +28,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 = mozilla::widget::GeckoAppShell::IsNetworkLinkUp();
+  *aIsUp = java::GeckoAppShell::IsNetworkLinkUp();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAndroidNetworkLinkService::GetLinkStatusKnown(bool *aIsKnown)
 {
   NS_ENSURE_TRUE(mozilla::AndroidBridge::Bridge(), NS_ERROR_NOT_IMPLEMENTED);
 
-  *aIsKnown = mozilla::widget::GeckoAppShell::IsNetworkLinkKnown();
+  *aIsKnown = java::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 = mozilla::widget::GeckoAppShell::NetworkLinkType();
+  *aLinkType = java::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
-  widget::GeckoAppShell::CloseNotification(aAlertName);
+  java::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,29 +349,28 @@ NS_IMETHODIMP nsAlertsService::SetManual
 }
 
 NS_IMETHODIMP nsAlertsService::OnProgress(const nsAString & aAlertName,
                                           int64_t aProgress,
                                           int64_t aProgressMax,
                                           const nsAString & aAlertText)
 {
 #ifdef MOZ_WIDGET_ANDROID
-  widget::GeckoAppShell::AlertsProgressListener_OnProgress(aAlertName,
-                                                           aProgress, aProgressMax,
-                                                           aAlertText);
+  java::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
-  widget::GeckoAppShell::CloseNotification(aAlertName);
+  java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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);
 
-            mozilla::widget::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
+            java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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) {
-        mozilla::widget::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
+        java::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,25 +1,27 @@
 /* -*- 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 = mozilla::widget::Restrictions::IsUserRestricted();
+    mEnabled = java::Restrictions::IsUserRestricted();
   }
 }
 
 nsParentalControlsService::~nsParentalControlsService()
 {
 }
 
 NS_IMETHODIMP
@@ -87,15 +89,15 @@ nsParentalControlsService::IsAllowed(int
 
   if (mozilla::jni::IsAvailable()) {
     nsAutoCString url;
     if (aUri) {
       rv = aUri->GetSpec(url);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
-    *_retval = mozilla::widget::Restrictions::IsAllowed(aAction,
+    *_retval = java::Restrictions::IsAllowed(aAction,
                                                     NS_ConvertUTF8toUTF16(url));
     return rv;
   }
 
   return NS_ERROR_NOT_AVAILABLE;
 }
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -195,17 +195,17 @@
 #include "base/command_line.h"
 #include "GTestRunner.h"
 
 #ifdef MOZ_B2G_LOADER
 #include "ProcessUtils.h"
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
+#include "GeneratedJNIWrappers.h"
 #endif
 
 #if defined(MOZ_SANDBOX)
 #if defined(XP_LINUX) && !defined(ANDROID)
 #include "mozilla/SandboxInfo.h"
 #elif defined(XP_WIN)
 #include "SandboxBroker.h"
 #endif
@@ -1716,17 +1716,17 @@ static nsresult LaunchChild(nsINativeApp
   if (aBlankCommandLine) {
     gRestartArgc = 1;
     gRestartArgv[gRestartArgc] = nullptr;
   }
 
   SaveToEnv("MOZ_LAUNCHED_CHILD=1");
 
 #if defined(MOZ_WIDGET_ANDROID)
-  mozilla::widget::GeckoAppShell::ScheduleRestart();
+  java::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;
@@ -1854,17 +1854,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
-      mozilla::widget::GeckoAppShell::KillAnyZombies();
+      java::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);
 
@@ -1883,17 +1883,17 @@ ProfileLockedDialog(nsIFile* aProfileDir
 
         SaveFileToEnv("XRE_PROFILE_PATH", aProfileDir);
         SaveFileToEnv("XRE_PROFILE_LOCAL_PATH", aProfileLocalDir);
 
         return LaunchChild(aNative);
       }
     } else {
 #ifdef MOZ_WIDGET_ANDROID
-      if (mozilla::widget::GeckoAppShell::UnlockProfile()) {
+      if (java::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 =
-            mozilla::widget::GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId);
+              java::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()) {
-        mozilla::widget::GeckoJavaSampler::PauseJavaProfiling();
+        java::GeckoJavaSampler::PauseJavaProfiling();
 
         aWriter.Start();
         {
           BuildJavaThreadJSObject(aWriter);
         }
         aWriter.End();
 
-        mozilla::widget::GeckoJavaSampler::UnpauseJavaProfiling();
+        java::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 "AndroidBridge.h"
+  #include "GeneratedJNIWrappers.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 widget::GeckoJavaSampler::Natives<GeckoJavaSampler>
+class GeckoJavaSampler : public java::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;
     }
-    mozilla::widget::GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000);
+    java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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 widget::GeckoAppShell::OpenUriExternal(
+  return java::GeckoAppShell::OpenUriExternal(
           uriSpec, mMimeType, mPackageName, mClassName,
           mAction, EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title)
 {
-  return widget::GeckoAppShell::OpenUriExternal(
+  return java::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 widget::GeckoAppShell::OpenUriExternal(data,
+  return java::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 (widget::GeckoAppShell::OpenUriExternal(
+  if (java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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 = widget::DownloadsIntegration::GetTemporaryDownloadDirectory();
+  auto downloadDir = java::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 widget::ANRReporter::Natives<ANRReporter>
+class ANRReporter : public java::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::widget;
+using namespace mozilla::java;
 
 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, widget::GeckoThread::ClsLoader());
+    mClassLoader = Object::GlobalRef(jEnv, java::GeckoThread::ClsLoader());
     mClassLoaderLoadClass = GetMethodID(
             jEnv, jEnv->GetObjectClass(mClassLoader.Get()),
             "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;");
 
-    mMessageQueue = widget::GeckoThread::MsgQueue();
+    mMessageQueue = java::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;");
@@ -920,17 +920,17 @@ AndroidBridge::GetCurrentBatteryInformat
     env->ReleaseDoubleArrayElements(arr.Get(), info, 0);
 }
 
 void
 AndroidBridge::HandleGeckoMessage(JSContext* cx, JS::HandleObject object)
 {
     ALOG_BRIDGE("%s", __PRETTY_FUNCTION__);
 
-    auto message = mozilla::widget::CreateNativeJSContainer(cx, object);
+    auto message = 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
@@ -150,18 +150,18 @@ public:
     nsresult CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, jni::ByteBuffer::Param buffer, float zoomFactor);
     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(widget::GeckoLayerClient::Param jobj);
-    const widget::GeckoLayerClient::Ref& GetLayerClient() { return mLayerClient; }
+    void SetLayerClient(java::GeckoLayerClient::Param jobj);
+    const java::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,
@@ -336,17 +336,17 @@ public:
 protected:
     static nsDataHashtable<nsStringHashKey, nsString> sStoragePaths;
 
     static pthread_t sJavaUiThread;
     static AndroidBridge* sBridge;
     nsTArray<nsCOMPtr<nsIMobileMessageCallback>> mSmsRequests;
     nsTArray<nsCOMPtr<nsIMobileMessageCursorCallback>> mSmsCursorRequests;
 
-    widget::GeckoLayerClient::GlobalRef mLayerClient;
+    java::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 widget::GeckoNetworkManager::Natives<GeckoNetworkManager>
+    : public java::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 widget::GeckoScreenOrientation::Natives<GeckoScreenOrientation>
+    : public java::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 widget {
+namespace java {
 
 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 widget {
+namespace java {
 
 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 widget {
+namespace java {
 
 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 {
 
-NativeJSContainer::LocalRef CreateNativeJSContainer(
-        JSContext* cx, JS::HandleObject object);
+java::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 widget::PrefsHelper::Natives<PrefsHelper>
+    : public java::PrefsHelper::Natives<PrefsHelper>
     , public UsesGeckoThreadProxy
 {
     PrefsHelper() = delete;
 
     static bool GetVariantPref(nsIObserverService* aObsServ,
                                nsIWritableVariant* aVariant,
                                jni::Object::Param aPrefHandler,
                                const jni::String::LocalRef& aPrefName)
@@ -35,56 +35,57 @@ class PrefsHelper
             return false;
         }
 
         uint16_t varType = nsIDataType::VTYPE_EMPTY;
         if (NS_FAILED(aVariant->GetDataType(&varType))) {
             return false;
         }
 
-        int32_t type = widget::PrefsHelper::PREF_INVALID;
+        int32_t type = java::PrefsHelper::PREF_INVALID;
         bool boolVal = false;
         int32_t intVal = 0;
         nsAutoString strVal;
 
         switch (varType) {
             case nsIDataType::VTYPE_BOOL:
-                type = widget::PrefsHelper::PREF_BOOL;
+                type = java::PrefsHelper::PREF_BOOL;
                 if (NS_FAILED(aVariant->GetAsBool(&boolVal))) {
                     return false;
                 }
                 break;
             case nsIDataType::VTYPE_INT32:
-                type = widget::PrefsHelper::PREF_INT;
+                type = java::PrefsHelper::PREF_INT;
                 if (NS_FAILED(aVariant->GetAsInt32(&intVal))) {
                     return false;
                 }
                 break;
             case nsIDataType::VTYPE_ASTRING:
-                type = widget::PrefsHelper::PREF_STRING;
+                type = java::PrefsHelper::PREF_STRING;
                 if (NS_FAILED(aVariant->GetAsAString(strVal))) {
                     return false;
                 }
                 break;
             default:
                 return false;
         }
 
         Maybe<jni::StringParam> jstrVal;
         jstrVal.emplace(nullptr);
-        if (type == widget::PrefsHelper::PREF_STRING) {
+        if (type == java::PrefsHelper::PREF_STRING) {
             jstrVal.reset();
             jstrVal.emplace(strVal, aPrefName.Env());
         }
 
         if (aPrefHandler) {
-            widget::PrefsHelper::CallPrefHandler(
-                    aPrefHandler, type, aPrefName, boolVal, intVal, jstrVal.ref());
+            java::PrefsHelper::CallPrefHandler(
+                    aPrefHandler, type, aPrefName,
+                    boolVal, intVal, jstrVal.ref());
         } else {
-            widget::PrefsHelper::OnPrefChange(
+            java::PrefsHelper::OnPrefChange(
                     aPrefName, type, boolVal, intVal, jstrVal.ref());
         }
         return true;
     }
 
     static bool SetVariantPref(nsIObserverService* aObsServ,
                                nsIWritableVariant* aVariant,
                                jni::String::Param aPrefName,
@@ -92,23 +93,23 @@ class PrefsHelper
                                int32_t aType,
                                bool aBoolVal,
                                int32_t aIntVal,
                                jni::String::Param aStrVal)
     {
         nsresult rv = NS_ERROR_FAILURE;
 
         switch (aType) {
-            case widget::PrefsHelper::PREF_BOOL:
+            case java::PrefsHelper::PREF_BOOL:
                 rv = aVariant->SetAsBool(aBoolVal);
                 break;
-            case widget::PrefsHelper::PREF_INT:
+            case java::PrefsHelper::PREF_INT:
                 rv = aVariant->SetAsInt32(aIntVal);
                 break;
-            case widget::PrefsHelper::PREF_STRING:
+            case java::PrefsHelper::PREF_STRING:
                 rv = aVariant->SetAsAString(aStrVal->ToString());
                 break;
         }
 
         if (NS_SUCCEEDED(rv)) {
             rv = aObsServ->NotifyObservers(aVariant, "android-set-pref",
                                            aPrefName->ToString().get());
         }
@@ -144,33 +145,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 = widget::PrefsHelper::PREF_INVALID;
+            int32_t type = java::PrefsHelper::PREF_INVALID;
             bool boolVal = false;
             int32_t intVal = 0;
 
             switch (Preferences::GetType(name.get())) {
                 case nsIPrefBranch::PREF_BOOL:
-                    type = widget::PrefsHelper::PREF_BOOL;
+                    type = java::PrefsHelper::PREF_BOOL;
                     boolVal = Preferences::GetBool(name.get());
                     break;
 
                 case nsIPrefBranch::PREF_INT:
-                    type = widget::PrefsHelper::PREF_INT;
+                    type = java::PrefsHelper::PREF_INT;
                     intVal = Preferences::GetInt(name.get());
                     break;
 
                 case nsIPrefBranch::PREF_STRING:
-                    type = widget::PrefsHelper::PREF_STRING;
+                    type = java::PrefsHelper::PREF_STRING;
                     strVal = Preferences::GetLocalizedString(name.get());
                     if (!strVal) {
                         strVal = Preferences::GetString(name.get());
                     }
                     break;
 
                 default:
                     // Pref not found; try to find it.
@@ -190,27 +191,28 @@ public:
                         NS_WARNING(nsPrintfCString("Failed to get pref %s",
                                                    name.get()).get());
                     }
                     continue;
             }
 
             Maybe<jni::StringParam> jstrVal;
             jstrVal.emplace(nullptr);
-            if (type == widget::PrefsHelper::PREF_STRING) {
+            if (type == java::PrefsHelper::PREF_STRING) {
                 jstrVal.reset();
                 jstrVal.emplace(strVal, aCls.Env());
             }
 
-            widget::PrefsHelper::CallPrefHandler(
-                    aPrefHandler, type, nameStr, boolVal, intVal, jstrVal.ref());
+            java::PrefsHelper::CallPrefHandler(
+                    aPrefHandler, type, nameStr,
+                    boolVal, intVal, jstrVal.ref());
         }
 
-        widget::PrefsHelper::CallPrefHandler(
-                aPrefHandler, widget::PrefsHelper::PREF_FINISH,
+        java::PrefsHelper::CallPrefHandler(
+                aPrefHandler, java::PrefsHelper::PREF_FINISH,
                 nullptr, false, 0, nullptr);
     }
 
     static void SetPref(jni::String::Param aPrefName,
                         bool aFlush,
                         int32_t aType,
                         bool aBoolVal,
                         int32_t aIntVal,
@@ -228,23 +230,23 @@ public:
                 // The "pref" has changed; send a notification.
                 GetVariantPref(obsServ, value, nullptr,
                                jni::String::LocalRef(aPrefName));
                 return;
             }
         }
 
         switch (aType) {
-            case widget::PrefsHelper::PREF_BOOL:
+            case java::PrefsHelper::PREF_BOOL:
                 Preferences::SetBool(name.get(), aBoolVal);
                 break;
-            case widget::PrefsHelper::PREF_INT:
+            case java::PrefsHelper::PREF_INT:
                 Preferences::SetInt(name.get(), aIntVal);
                 break;
-            case widget::PrefsHelper::PREF_STRING:
+            case java::PrefsHelper::PREF_STRING:
                 Preferences::SetString(name.get(), aStrVal->ToString());
                 break;
             default:
                 MOZ_ASSERT(false, "Invalid pref type");
         }
 
         if (aFlush) {
             Preferences::GetService()->SavePrefFile(nullptr);
@@ -296,42 +298,43 @@ public:
 
         int32_t type = -1;
         bool boolVal = false;
         int32_t intVal = false;
         nsAdoptingString strVal;
 
         switch (Preferences::GetType(name.get())) {
             case nsIPrefBranch::PREF_BOOL:
-                type = widget::PrefsHelper::PREF_BOOL;
+                type = java::PrefsHelper::PREF_BOOL;
                 boolVal = Preferences::GetBool(name.get());
                 break;
             case nsIPrefBranch::PREF_INT:
-                type = widget::PrefsHelper::PREF_INT;
+                type = java::PrefsHelper::PREF_INT;
                 intVal = Preferences::GetInt(name.get());
                 break;
             case nsIPrefBranch::PREF_STRING:
-                type = widget::PrefsHelper::PREF_STRING;
+                type = java::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 == widget::PrefsHelper::PREF_STRING) {
+        if (type == java::PrefsHelper::PREF_STRING) {
             jstrVal.reset();
             jstrVal.emplace(strVal);
         }
 
-        widget::PrefsHelper::OnPrefChange(name, type, boolVal, intVal, jstrVal.ref());
+        java::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 widget::ThumbnailHelper::Natives<ThumbnailHelper>
+    : public java::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) {
-            widget::ThumbnailHelper::SendThumbnail(
+            java::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;
 
-        widget::ThumbnailHelper::SendThumbnail(aData, aTabId, success, store);
+        java::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 = widget::GeckoAppShell::HandleUncaughtException(e);
+    String::LocalRef stack = java::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 = widget::GeckoAppShell::CreateInputStream(connection);
+        mBridgeInputStream = java::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 = widget::GeckoAppShell::ConnectionGetMimeType(mConnection);
+        auto type = java::GeckoAppShell::ConnectionGetMimeType(mConnection);
         if (type) {
             SetContentType(type->ToCString());
         }
     }
 
 public:
     static AndroidChannel* CreateChannel(nsIURI *aURI)  {
         nsCString spec;
         aURI->GetSpec(spec);
 
-        auto connection = widget::GeckoAppShell::GetConnection(spec);
+        auto connection = java::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
@@ -84,28 +84,28 @@ NS_IMPL_ISUPPORTS_INHERITED(nsAppShell, 
 class WakeLockListener final : public nsIDOMMozWakeLockListener {
 private:
   ~WakeLockListener() {}
 
 public:
   NS_DECL_ISUPPORTS;
 
   nsresult Callback(const nsAString& topic, const nsAString& state) override {
-    widget::GeckoAppShell::NotifyWakeLockChanged(topic, state);
+    java::GeckoAppShell::NotifyWakeLockChanged(topic, state);
     return NS_OK;
   }
 };
 
 NS_IMPL_ISUPPORTS(WakeLockListener, nsIDOMMozWakeLockListener)
 nsCOMPtr<nsIPowerManagerService> sPowerManagerService = nullptr;
 StaticRefPtr<WakeLockListener> sWakeLockListener;
 
 
 class GeckoThreadSupport final
-    : public widget::GeckoThread::Natives<GeckoThreadSupport>
+    : public java::GeckoThread::Natives<GeckoThreadSupport>
     , public UsesGeckoThreadProxy
 {
     static uint32_t sPauseCount;
 
 public:
     template<typename Functor>
     static void OnNativeCall(Functor&& aCall)
     {
@@ -215,17 +215,17 @@ public:
                 aData ? aData->ToString().get() : nullptr);
     }
 };
 
 uint32_t GeckoThreadSupport::sPauseCount;
 
 
 class GeckoAppShellSupport final
-    : public widget::GeckoAppShell::Natives<GeckoAppShellSupport>
+    : public java::GeckoAppShell::Natives<GeckoAppShellSupport>
     , public UsesGeckoThreadProxy
 {
 public:
     template<typename Functor>
     static void OnNativeCall(Functor&& aCall)
     {
         if (aCall.IsTarget(&SyncNotifyObservers)) {
             aCall();
@@ -351,17 +351,17 @@ nsAppShell::nsAppShell()
         GeckoThreadSupport::Init();
         mozilla::ANRReporter::Init();
         mozilla::GeckoNetworkManager::Init();
         mozilla::GeckoScreenOrientation::Init();
         mozilla::PrefsHelper::Init();
         mozilla::ThumbnailHelper::Init();
         nsWindow::InitNatives();
 
-        widget::GeckoThread::SetState(widget::GeckoThread::State::JNI_READY());
+        java::GeckoThread::SetState(java::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!");
@@ -453,21 +453,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)) {
-                widget::GeckoAppShell::SetScreenDepthOverride(16);
+                java::GeckoAppShell::SetScreenDepthOverride(16);
             }
 
-            widget::GeckoThread::SetState(
-                    widget::GeckoThread::State::PROFILE_READY());
+            java::GeckoThread::SetState(
+                    java::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);
@@ -475,26 +475,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.
-            widget::GeckoThread::CheckAndSetState(
-                    widget::GeckoThread::State::PROFILE_READY(),
-                    widget::GeckoThread::State::RUNNING());
+            java::GeckoThread::CheckAndSetState(
+                    java::GeckoThread::State::PROFILE_READY(),
+                    java::GeckoThread::State::RUNNING());
         }
         removeObserver = true;
 
     } else if (!strcmp(aTopic, "quit-application-granted")) {
         if (jni::IsAvailable()) {
-            widget::GeckoThread::SetState(
-                    widget::GeckoThread::State::EXITING());
+            java::GeckoThread::SetState(
+                    java::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();
@@ -810,18 +810,17 @@ 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);
-              widget::GeckoAppShell::GamepadAdded(curEvent->ID(),
-                                                  svc_id);
+              java::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);
 
-  widget::Clipboard::SetClipboardText(buffer);
+  java::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;
-  widget::Clipboard::ClearText();
+  java::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 = widget::Clipboard::HasText();
+      *aHasText = java::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 = widget::GeckoAppShell::GetShowPasswordSetting();
+            mShowPassword = java::GeckoAppShell::GetShowPasswordSetting();
         } else {
             ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
         }
         mInitializedShowPassword = true;
     }
     return mShowPassword;
 }
 
--- a/widget/android/nsScreenManagerAndroid.cpp
+++ b/widget/android/nsScreenManagerAndroid.cpp
@@ -2,17 +2,16 @@
 /* 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)
 {
@@ -33,17 +32,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;
     }
 
-    widget::sdk::Rect::LocalRef rect = widget::GeckoAppShell::GetScreenSize();
+    java::sdk::Rect::LocalRef rect = java::GeckoAppShell::GetScreenSize();
     rect->Left(outLeft);
     rect->Top(outTop);
     rect->Width(outWidth);
     rect->Height(outHeight);
 
     return NS_OK;
 }
 
@@ -60,32 +59,32 @@ NS_IMETHODIMP
 nsScreenAndroid::GetPixelDepth(int32_t *aPixelDepth)
 {
     if (!mozilla::jni::IsAvailable()) {
       // xpcshell most likely
       *aPixelDepth = 16;
       return NS_ERROR_FAILURE;
     }
 
-    *aPixelDepth = widget::GeckoAppShell::GetScreenDepthWrapper();
+    *aPixelDepth = java::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()) {
-      widget::GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL);
+      java::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,18 +80,19 @@ 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::layers;
+using namespace mozilla::java;
 using namespace mozilla::widget;
-using namespace mozilla::layers;
 
 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"
@@ -272,30 +273,29 @@ 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 ==
-                           mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE,
+            MOZ_ASSERT(aIMENotification.mMessage == 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;
-    mozilla::widget::GeckoEditable::GlobalRef mEditable;
+    java::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;
@@ -566,48 +566,48 @@ public:
         return true;
     }
 
     static MouseInput::ButtonType GetButtonType(int button)
     {
         MouseInput::ButtonType result = MouseInput::NONE;
 
         switch (button) {
-            case widget::sdk::MotionEvent::BUTTON_PRIMARY:
+            case java::sdk::MotionEvent::BUTTON_PRIMARY:
                 result = MouseInput::LEFT_BUTTON;
                 break;
-            case widget::sdk::MotionEvent::BUTTON_SECONDARY:
+            case java::sdk::MotionEvent::BUTTON_SECONDARY:
                 result = MouseInput::RIGHT_BUTTON;
                 break;
-            case widget::sdk::MotionEvent::BUTTON_TERTIARY:
+            case java::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 & widget::sdk::MotionEvent::BUTTON_PRIMARY) {
+        if (buttons & java::sdk::MotionEvent::BUTTON_PRIMARY) {
             result |= WidgetMouseEventBase::eLeftButtonFlag;
         }
-        if (buttons & widget::sdk::MotionEvent::BUTTON_SECONDARY) {
+        if (buttons & java::sdk::MotionEvent::BUTTON_SECONDARY) {
             result |= WidgetMouseEventBase::eRightButtonFlag;
         }
-        if (buttons & widget::sdk::MotionEvent::BUTTON_TERTIARY) {
+        if (buttons & java::sdk::MotionEvent::BUTTON_TERTIARY) {
             result |= WidgetMouseEventBase::eMiddleButtonFlag;
         }
-        if (buttons & widget::sdk::MotionEvent::BUTTON_BACK) {
+        if (buttons & java::sdk::MotionEvent::BUTTON_BACK) {
             result |= WidgetMouseEventBase::e4thButtonFlag;
         }
-        if (buttons & widget::sdk::MotionEvent::BUTTON_FORWARD) {
+        if (buttons & java::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)
@@ -2464,31 +2464,31 @@ ConvertAndroidScanCodeToCodeNameIndex(in
         default:
           return CODE_NAME_INDEX_UNKNOWN;
     }
 }
 
 static bool
 IsModifierKey(int32_t keyCode)
 {
-    using mozilla::widget::sdk::KeyEvent;
+    using mozilla::java::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::widget::sdk::KeyEvent;
+    using mozilla::java::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::widget::LayerRenderer::Frame::GlobalRef mLayerRendererFrame;
+    mozilla::java::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() = mozilla::widget::GeckoAppShell::IsTablet();
+  aInfo->isTablet() = java::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 = mozilla::widget::GeckoAppShell::IsTablet();
+    isTablet = java::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 "AndroidBridge.h"
+#include "GeneratedJNIWrappers.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 widget::GeckoAppShell::OpenUriExternal(
+  return java::GeckoAppShell::OpenUriExternal(
     NS_ConvertUTF8toUTF16(fileUri),
     NS_ConvertUTF8toUTF16(type),
     EmptyString(),
     EmptyString(),
     EmptyString(),
     EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
 #elif defined(MOZ_WIDGET_COCOA)
   CFURLRef url;