Backed out 11 changesets (bug 1512274) for TL bustages. CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Fri, 15 Mar 2019 21:11:47 +0200
changeset 522314 1f911d12fd0737a2107c8b0cc98cf3d62165d7db
parent 522097 e925aaf5ac9a8a9f4e9dcf493bd2e04f46bb757f
child 522315 d57f48d6e42bc87ccc20f3350f49bf925d2d8bc2
push id10871
push usercbrindusan@mozilla.com
push dateMon, 18 Mar 2019 15:49:32 +0000
treeherdermozilla-beta@018abdd16060 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1512274
milestone67.0a1
backs out9f34d0075a7300366203a37ac0155aa2198fdf7a
6ca9fc4956d03fea17ac48547b7d412aaf31e804
9a9d3c9c124a32d039969ef8c0c0624f3a80705f
670e07131f14753061bf8e85f49d5de461f1fdc0
161731389a46e2a1ff82736dea560118e6bc8f6f
c34445b1db88d8ec628dbbcbd4b2b62b17f67fe9
60897ab005748ea3b73825e6502518b6ab3684d7
5d02f27fe1747a473a400e8473dc3acf0a365ea1
380cdbe5557c86bed91f985824cee75321ee282c
58642fa9c95b0aad2f6adae8b8005f17e41541fc
3812d67603799766ab89a8ee5d4fdfd1c376d0ce
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
Backed out 11 changesets (bug 1512274) for TL bustages. CLOSED TREE Backed out changeset 9f34d0075a73 (bug 1512274) Backed out changeset 6ca9fc4956d0 (bug 1512274) Backed out changeset 9a9d3c9c124a (bug 1512274) Backed out changeset 670e07131f14 (bug 1512274) Backed out changeset 161731389a46 (bug 1512274) Backed out changeset c34445b1db88 (bug 1512274) Backed out changeset 60897ab00574 (bug 1512274) Backed out changeset 5d02f27fe174 (bug 1512274) Backed out changeset 380cdbe5557c (bug 1512274) Backed out changeset 58642fa9c95b (bug 1512274) Backed out changeset 3812d6760379 (bug 1512274)
mobile/android/geckoview/build.gradle
mobile/android/geckoview/checkstyle.xml
mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/Clipboard.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoBatteryManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableChild.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoHalDefines.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoNetworkManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfileDirectories.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSharedPrefs.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSystemStateListener.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/HapticFeedbackDelegate.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/NSSBridge.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/NativeQueue.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/NotificationListener.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/PrefsHelper.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/SysInfo.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/TelemetryContract.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/TelemetryUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocator.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocatorService.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceTextureListener.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SyncConfig.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/VsyncSource.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/AsyncCodecFactory.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/BaseHlsPlayer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/CodecProxy.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/FormatParam.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoAudioInfo.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSDemuxerWrapper.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSResourceWrapper.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSSample.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsAudioRenderer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsRendererBase.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsVideoRenderer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV21.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV23.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoPlayerFactory.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoVideoInfo.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteMediaDrmBridge.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteMediaDrmBridgeStub.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Sample.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/SamplePool.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/SessionKeyInfo.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/SharedMemBuffer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Utils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/ByteBufferInputStream.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/DirectBufferAllocator.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/JNIObject.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/NativeReference.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/NativeZip.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/SafeIntent.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/SharedMemory.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/permissions/PermissionBlock.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/permissions/Permissions.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/permissions/PermissionsHelper.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoProcessManager.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoServiceChildProcess.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/sqlite/ByteBufferInputStream.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/sqlite/MatrixBlobCursor.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/sqlite/SQLiteBridge.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/sqlite/SQLiteBridgeException.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityResultHandlerMap.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/BitmapUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContentUriUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FileUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FloatUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GamepadUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GeckoBackgroundThread.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GeckoBundle.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GeckoJarReader.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/INIParser.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/INISection.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IOUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/InputDeviceUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/InputOptionsUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IntentUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/JSONUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/MenuUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/NetworkUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/NonEvictingLruCache.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/PrefUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySelector.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/RawResource.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/StrictModeContext.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/StringUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ThreadUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/UIAsyncTask.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/BasicSelectionActionDelegate.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/CompositorController.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/CrashReporter.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/DynamicToolbarAnimator.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoFontScaleListener.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoInputConnection.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoInputStream.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoResult.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionHandler.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSessionSettings.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoVRManager.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoWebExecutor.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/MediaElement.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/OverscrollEdgeEffect.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/PanZoomController.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ParcelableUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/RuntimeSettings.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/RuntimeTelemetry.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionFinder.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebMessage.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebRequest.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebRequestError.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebResponse.java
mobile/android/gradle.configure
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -1,12 +1,11 @@
 buildDir "${topobjdir}/gradle/build/mobile/android/geckoview"
 
 apply plugin: 'com.android.library'
-apply plugin: 'checkstyle'
 apply plugin: 'kotlin-android'
 
 apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
 
 // The SDK binding generation tasks depend on the JAR creation task of the
 // :annotations project.
 evaluationDependsOn(':annotations')
 
@@ -293,24 +292,16 @@ android.libraryVariants.all { variant ->
     }
 
     def sourcesJar = task("sourcesJar${name.capitalize()}", type: Jar) {
         classifier 'sources'
         description = "Generate Javadoc for build variant $name"
         destinationDir = new File(destinationDir, variant.baseName)
         from files(variant.javaCompile.source)
     }
-
-    task("checkstyle${name.capitalize()}", type: Checkstyle) {
-        classpath = variant.javaCompile.classpath
-        configFile file("checkstyle.xml")
-        // TODO: cleanup and include all sources
-        source = ['src/main/java/']
-        include '**/*.java'
-    }
 }
 
 android.libraryVariants.all { variant ->
     configureLibraryVariantWithJNIWrappers(variant, "Generated")
 }
 
 apply plugin: 'maven-publish'
 
deleted file mode 100644
--- a/mobile/android/geckoview/checkstyle.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<!DOCTYPE module PUBLIC
-    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
-    <property name="charset" value="UTF-8"/>
-
-    <!-- Disallow tabs -->
-    <module name="FileTabCharacter">
-        <property name="eachLine" value="true"/>
-    </module>
-
-    <!-- Disallow trailing whitespace -->
-    <module name="RegexpSingleline">
-        <property name="format" value="\s+$"/>
-        <property name="message" value="Trailing whitespace"/>
-    </module>
-
-    <module name="TreeWalker">
-        <module name="FinalParameters"/>
-        <module name="ParameterName"/>
-        <module name="StaticVariableName"/>
-        <module name="LeftCurly"/>
-        <module name="RightCurly"/>
-        <module name="Indentation"/>
-        <module name="OneStatementPerLine"/>
-        <module name="AvoidStarImport"/>
-        <module name="UnusedImports"/>
-
-        <module name="MemberName">
-            <!-- Private members must use mHungarianNotation -->
-            <property name="format" value="m[A-Z][A-Za-z]*$"/>
-            <property name="applyToPrivate" value="true" />
-            <property name="applyToPublic" value="false" />
-            <property name="applyToPackage" value="false" />
-            <property name="applyToProtected" value="false" />
-        </module>
-
-        <module name="ClassTypeParameterName">
-            <property name="format" value="^[A-Z][A-Za-z]*$"/>
-        </module>
-        <module name="InterfaceTypeParameterName">
-            <property name="format" value="^[A-Z][A-Za-z]*$"/>
-        </module>
-        <module name="LocalVariableName"/>
-
-        <module name="GenericWhitespace"/>
-        <module name="NoLineWrap">
-            <property name="tokens" value="IMPORT,PACKAGE_DEF"/>
-        </module>
-        <module name="OuterTypeFilename"/>
-        <module name="WhitespaceAfter">
-            <property name="tokens" value="COMMA, SEMI"/>
-        </module>
-        <module name="WhitespaceAround">
-            <property name="allowEmptyConstructors" value="true"/>
-            <property name="allowEmptyMethods" value="true"/>
-            <property name="allowEmptyTypes" value="true"/>
-        </module>
-        <module name="OneTopLevelClass"/>
-    </module>
-
-</module>
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java
@@ -31,46 +31,46 @@ public class AndroidGamepadManager {
     private static enum Axis {
         X(MotionEvent.AXIS_X),
         Y(MotionEvent.AXIS_Y),
         Z(MotionEvent.AXIS_Z),
         RZ(MotionEvent.AXIS_RZ);
 
         public final int axis;
 
-        private Axis(final int axis) {
+        private Axis(int axis) {
             this.axis = axis;
         }
     }
 
     // A list of gamepad button mappings. Axes are determined at
     // runtime, as they vary by Android version.
     private static enum Trigger {
         Left(6),
         Right(7);
 
         public final int button;
 
-        private Trigger(final int button) {
+        private Trigger(int button) {
             this.button = button;
         }
     }
 
     private static final int FIRST_DPAD_BUTTON = 12;
     // A list of axis number, gamepad button mappings for negative, positive.
     // Button mappings are added to FIRST_DPAD_BUTTON.
     private static enum DpadAxis {
         UpDown(MotionEvent.AXIS_HAT_Y, 0, 1),
         LeftRight(MotionEvent.AXIS_HAT_X, 2, 3);
 
         public final int axis;
         public final int negativeButton;
         public final int positiveButton;
 
-        private DpadAxis(final int axis, final int negativeButton, final int positiveButton) {
+        private DpadAxis(int axis, int negativeButton, int positiveButton) {
             this.axis = axis;
             this.negativeButton = negativeButton;
             this.positiveButton = positiveButton;
         }
     }
 
     private static enum Button {
         A(KeyEvent.KEYCODE_BUTTON_A),
@@ -87,31 +87,31 @@ public class AndroidGamepadManager {
         THUMBR(KeyEvent.KEYCODE_BUTTON_THUMBR),
         DPAD_UP(KeyEvent.KEYCODE_DPAD_UP),
         DPAD_DOWN(KeyEvent.KEYCODE_DPAD_DOWN),
         DPAD_LEFT(KeyEvent.KEYCODE_DPAD_LEFT),
         DPAD_RIGHT(KeyEvent.KEYCODE_DPAD_RIGHT);
 
         public final int button;
 
-        private Button(final int button) {
+        private Button(int button) {
             this.button = button;
         }
     }
 
     private static class Gamepad {
         // ID from GamepadService
         public int id;
         // Retain axis state so we can determine changes.
         public float axes[];
         public boolean dpad[];
         public int triggerAxes[];
         public float triggers[];
 
-        public Gamepad(final int serviceId, final int deviceId) {
+        public Gamepad(int serviceId, int deviceId) {
             id = serviceId;
             axes = new float[Axis.values().length];
             dpad = new boolean[4];
             triggers = new float[2];
 
             InputDevice device = InputDevice.getDevice(deviceId);
             if (device != null) {
                 // LTRIGGER/RTRIGGER don't seem to be exposed on older
@@ -180,26 +180,26 @@ public class AndroidGamepadManager {
             removeDeviceListener(context);
             sPendingGamepads.clear();
             sGamepads.clear();
             sStarted = false;
         }
     }
 
     @WrapForJNI
-    private static void onGamepadAdded(final int deviceId, final int serviceId) {
+    private static void onGamepadAdded(final int device_id, final int service_id) {
         ThreadUtils.postToUiThread(new Runnable() {
             @Override
             public void run() {
-                handleGamepadAdded(deviceId, serviceId);
+                handleGamepadAdded(device_id, service_id);
             }
         });
     }
 
-    /* package */ static void handleGamepadAdded(final int deviceId, final int serviceId) {
+    /* package */ static void handleGamepadAdded(int deviceId, int serviceId) {
         ThreadUtils.assertOnUiThread();
         if (!sStarted) {
             return;
         }
 
         final List<KeyEvent> pending = sPendingGamepads.get(deviceId);
         if (pending == null) {
             removeGamepad(deviceId);
@@ -209,34 +209,34 @@ public class AndroidGamepadManager {
         sPendingGamepads.remove(deviceId);
         sGamepads.put(deviceId, new Gamepad(serviceId, deviceId));
         // Handle queued KeyEvents
         for (KeyEvent ev : pending) {
             handleKeyEvent(ev);
         }
     }
 
-    private static float deadZone(final MotionEvent ev, final int axis) {
+    private static float deadZone(MotionEvent ev, int axis) {
         if (GamepadUtils.isValueInDeadZone(ev, axis)) {
             return 0.0f;
         }
         return ev.getAxisValue(axis);
     }
 
-    private static void mapDpadAxis(final Gamepad gamepad,
-                                    final boolean pressed,
-                                    final float value,
-                                    final int which) {
+    private static void mapDpadAxis(Gamepad gamepad,
+                                    boolean pressed,
+                                    float value,
+                                    int which) {
         if (pressed != gamepad.dpad[which]) {
             gamepad.dpad[which] = pressed;
             onButtonChange(gamepad.id, FIRST_DPAD_BUTTON + which, pressed, Math.abs(value));
         }
     }
 
-    public static boolean handleMotionEvent(final MotionEvent ev) {
+    public static boolean handleMotionEvent(MotionEvent ev) {
         ThreadUtils.assertOnUiThread();
         if (!sStarted) {
             return false;
         }
 
         final Gamepad gamepad = sGamepads.get(ev.getDeviceId());
         if (gamepad == null) {
             // Not a device we care about.
@@ -279,17 +279,17 @@ public class AndroidGamepadManager {
         for (DpadAxis dpadaxis : DpadAxis.values()) {
             float value = deadZone(ev, dpadaxis.axis);
             mapDpadAxis(gamepad, value < 0.0f, value, dpadaxis.negativeButton);
             mapDpadAxis(gamepad, value > 0.0f, value, dpadaxis.positiveButton);
         }
         return true;
     }
 
-    public static boolean handleKeyEvent(final KeyEvent ev) {
+    public static boolean handleKeyEvent(KeyEvent ev) {
         ThreadUtils.assertOnUiThread();
         if (!sStarted) {
             return false;
         }
 
         int deviceId = ev.getDeviceId();
         final List<KeyEvent> pendingGamepad = sPendingGamepads.get(deviceId);
         if (pendingGamepad != null) {
@@ -346,22 +346,22 @@ public class AndroidGamepadManager {
             }
             if ((device.getSources() & InputDevice.SOURCE_GAMEPAD) != InputDevice.SOURCE_GAMEPAD) {
                 continue;
             }
             addGamepad(device);
         }
     }
 
-    private static void addGamepad(final InputDevice device) {
+    private static void addGamepad(InputDevice device) {
         sPendingGamepads.put(device.getId(), new ArrayList<KeyEvent>());
         onGamepadChange(device.getId(), true);
     }
 
-    private static void removeGamepad(final int deviceId) {
+    private static void removeGamepad(int deviceId) {
         Gamepad gamepad = sGamepads.get(deviceId);
         onGamepadChange(gamepad.id, false);
         sGamepads.remove(deviceId);
     }
 
     private static void addDeviceListener(final Context context) {
         if (Build.VERSION.SDK_INT < 16) {
             // Poll known gamepads to see if they've disappeared.
@@ -375,41 +375,41 @@ public class AndroidGamepadManager {
                                 removeGamepad(deviceId);
                             }
                         }
                     }
                 }, POLL_TIMER_PERIOD, POLL_TIMER_PERIOD);
         } else {
             sListener = new InputManager.InputDeviceListener() {
                 @Override
-                public void onInputDeviceAdded(final int deviceId) {
+                public void onInputDeviceAdded(int deviceId) {
                     InputDevice device = InputDevice.getDevice(deviceId);
                     if (device == null) {
                         return;
                     }
                     if ((device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
                         addGamepad(device);
                     }
                 }
 
                 @Override
-                public void onInputDeviceRemoved(final int deviceId) {
+                public void onInputDeviceRemoved(int deviceId) {
                     if (sPendingGamepads.get(deviceId) != null) {
                         // Got removed before Gecko's ack reached us.
                         // gamepadAdded will deal with it.
                         sPendingGamepads.remove(deviceId);
                         return;
                     }
                     if (sGamepads.get(deviceId) != null) {
                         removeGamepad(deviceId);
                     }
                 }
 
                 @Override
-                public void onInputDeviceChanged(final int deviceId) {
+                public void onInputDeviceChanged(int deviceId) {
                 }
             };
             final InputManager im = (InputManager)
                     context.getSystemService(Context.INPUT_SERVICE);
             im.registerInputDeviceListener(sListener, ThreadUtils.getUiHandler());
         }
     }
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/Clipboard.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/Clipboard.java
@@ -1,15 +1,18 @@
 /* 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/. */
 
 package org.mozilla.gecko;
 
+import java.util.concurrent.SynchronousQueue;
+
 import org.mozilla.gecko.annotation.WrapForJNI;
+import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.ClipboardManager;
 import android.content.ClipData;
 import android.content.Context;
 import android.text.TextUtils;
 
 public final class Clipboard {
     private final static String LOGTAG = "GeckoClipboard";
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
@@ -1,24 +1,26 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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/. */
 
 package org.mozilla.gecko;
 
 import android.app.Service;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Process;
+import android.support.v4.app.JobIntentService;
 import android.util.Log;
 
 import org.mozilla.geckoview.BuildConfig;
 import org.mozilla.geckoview.GeckoRuntime;
 
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -49,22 +51,21 @@ public class CrashHandler implements Thr
     protected final Class<? extends Service> handlerService;
 
     /**
      * Get the root exception from the 'cause' chain of an exception.
      *
      * @param exc An exception
      * @return The root exception
      */
-    public static Throwable getRootException(final Throwable exc) {
-        Throwable cause;
-        for (cause = exc; cause != null; cause = cause.getCause()) {
+    public static Throwable getRootException(Throwable exc) {
+        for (Throwable cause = exc; cause != null; cause = cause.getCause()) {
+            exc = cause;
         }
-
-        return cause;
+        return exc;
     }
 
     /**
      * Get the standard stack trace string of an exception.
      *
      * @param exc An exception
      * @return The exception stack trace.
      */
@@ -441,46 +442,44 @@ public class CrashHandler implements Thr
 
     /**
      * Implements the default behavior for handling uncaught exceptions.
      *
      * @param thread The exception thread
      * @param exc An uncaught exception
      */
     @Override
-    public void uncaughtException(final Thread thread, final Throwable exc) {
+    public void uncaughtException(Thread thread, Throwable exc) {
         if (this.crashing) {
             // Prevent possible infinite recusions.
             return;
         }
 
-        Thread resolvedThread = thread;
-        if (resolvedThread == null) {
+        if (thread == null) {
             // Gecko may pass in null for thread to denote the current thread.
-            resolvedThread = Thread.currentThread();
+            thread = Thread.currentThread();
         }
 
         try {
-            Throwable rootException = exc;
             if (!this.unregistered) {
                 // Only process crash ourselves if we have not been unregistered.
 
                 this.crashing = true;
-                rootException = getRootException(exc);
-                logException(resolvedThread, rootException);
+                exc = getRootException(exc);
+                logException(thread, exc);
 
-                if (reportException(resolvedThread, rootException)) {
+                if (reportException(thread, exc)) {
                     // Reporting succeeded; we can terminate our process now.
                     return;
                 }
             }
 
             if (systemUncaughtHandler != null) {
                 // Follow the chain of uncaught handlers.
-                systemUncaughtHandler.uncaughtException(resolvedThread, rootException);
+                systemUncaughtHandler.uncaughtException(thread, exc);
             }
         } finally {
             terminateProcess();
         }
     }
 
     public static CrashHandler createDefaultCrashHandler(final Context context) {
         return new CrashHandler(context, null) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
@@ -11,25 +11,30 @@ import org.mozilla.gecko.annotation.Robo
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.ThreadUtils;
 import org.mozilla.geckoview.BuildConfig;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.os.Bundle;
 import android.os.Handler;
 import android.support.annotation.AnyThread;
 import android.util.Log;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 @RobocopTarget
 public final class EventDispatcher extends JNIObject {
     private static final String LOGTAG = "GeckoEventDispatcher";
 
     private static final EventDispatcher INSTANCE = new EventDispatcher();
 
@@ -82,17 +87,17 @@ public final class EventDispatcher exten
     @WrapForJNI(calledFrom = "gecko")
     private synchronized void setAttachedToGecko(final int state) {
         if (mAttachedToGecko && state == DETACHED) {
             dispose(false);
         }
         mAttachedToGecko = (state == ATTACHED);
     }
 
-    private void dispose(final boolean force) {
+    private void dispose(boolean force) {
         final Handler geckoHandler = ThreadUtils.sGeckoHandler;
         if (geckoHandler == null) {
             return;
         }
 
         geckoHandler.post(new Runnable() {
             @Override
             public void run() {
@@ -395,32 +400,32 @@ public final class EventDispatcher exten
         @WrapForJNI(dispatchTo = "proxy") @Override // EventCallback
         public native void sendError(Object response);
 
         @WrapForJNI(dispatchTo = "gecko") @Override // Object
         protected native void finalize();
     }
 
     private static class JavaCallbackDelegate implements EventCallback {
-        private final Thread mOriginalThread = Thread.currentThread();
-        private final EventCallback mCallback;
+        private final Thread originalThread = Thread.currentThread();
+        private final EventCallback callback;
 
         public static EventCallback wrap(final EventCallback callback) {
             if (callback == null) {
                 return null;
             }
             if (callback instanceof NativeCallbackDelegate) {
                 // NativeCallbackDelegate always posts to Gecko thread if needed.
                 return callback;
             }
             return new JavaCallbackDelegate(callback);
         }
 
         JavaCallbackDelegate(final EventCallback callback) {
-            mCallback = callback;
+            this.callback = callback;
         }
 
         private void makeCallback(final boolean callSuccess, final Object rawResponse) {
             final Object response;
             if (rawResponse instanceof Number) {
                 // There is ambiguity because a number can be converted to either int or
                 // double, so e.g. the user can be expecting a double when we give it an
                 // int. To avoid these pitfalls, we disallow all numbers. The workaround
@@ -435,48 +440,48 @@ public final class EventDispatcher exten
             } else if (rawResponse instanceof Character) {
                 response = rawResponse.toString();
             } else {
                 response = rawResponse;
             }
 
             // Call back synchronously if we happen to be on the same thread as the thread
             // making the original request.
-            if (ThreadUtils.isOnThread(mOriginalThread)) {
+            if (ThreadUtils.isOnThread(originalThread)) {
                 if (callSuccess) {
-                    mCallback.sendSuccess(response);
+                    callback.sendSuccess(response);
                 } else {
-                    mCallback.sendError(response);
+                    callback.sendError(response);
                 }
                 return;
             }
 
             // Make callback on the thread of the original request, if the original thread
             // is the UI or Gecko thread. Otherwise default to the background thread.
             final Handler handler =
-                    mOriginalThread == ThreadUtils.getUiThread() ? ThreadUtils.getUiHandler() :
-                    mOriginalThread == ThreadUtils.sGeckoThread ? ThreadUtils.sGeckoHandler :
+                    originalThread == ThreadUtils.getUiThread() ? ThreadUtils.getUiHandler() :
+                    originalThread == ThreadUtils.sGeckoThread ? ThreadUtils.sGeckoHandler :
                                                                  ThreadUtils.getBackgroundHandler();
-            final EventCallback callback = mCallback;
+            final EventCallback callback = this.callback;
 
             handler.post(new Runnable() {
                 @Override
                 public void run() {
                     if (callSuccess) {
                         callback.sendSuccess(response);
                     } else {
                         callback.sendError(response);
                     }
                 }
             });
         }
 
         @Override // EventCallback
-        public void sendSuccess(final Object response) {
+        public void sendSuccess(Object response) {
             makeCallback(/* success */ true, response);
         }
 
         @Override // EventCallback
-        public void sendError(final Object response) {
+        public void sendError(Object response) {
             makeCallback(/* success */ false, response);
         }
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -8,16 +8,17 @@ package org.mozilla.gecko;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
+import java.lang.IllegalStateException;
 import java.net.MalformedURLException;
 import java.net.Proxy;
 import java.net.URLConnection;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
@@ -61,16 +62,17 @@ import android.hardware.SensorEventListe
 import android.hardware.SensorManager;
 import android.location.Criteria;
 import android.location.Location;
 import android.location.LocationListener;
 import android.location.LocationManager;
 import android.media.AudioManager;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
+import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.LocaleList;
 import android.os.Looper;
 import android.os.PowerManager;
 import android.os.Vibrator;
 import android.provider.Settings;
 import android.support.annotation.Nullable;
@@ -80,17 +82,18 @@ import android.text.TextUtils;
 import android.util.Log;
 import android.view.ContextThemeWrapper;
 import android.view.Display;
 import android.view.HapticFeedbackConstants;
 import android.view.InputDevice;
 import android.view.WindowManager;
 import android.webkit.MimeTypeMap;
 
-public class GeckoAppShell {
+public class GeckoAppShell
+{
     private static final String LOGTAG = "GeckoAppShell";
 
     // We have static members only.
     private GeckoAppShell() { }
 
     private static class GeckoCrashHandler extends CrashHandler {
 
         public GeckoCrashHandler(final Class<? extends Service> handlerService) {
@@ -274,35 +277,35 @@ public class GeckoAppShell {
         }
     }
 
     /*
      *  The Gecko-side API: API methods that Gecko calls
      */
 
     @WrapForJNI(exceptionMode = "ignore")
-    private static String getExceptionStackTrace(final Throwable e) {
+    private static String getExceptionStackTrace(Throwable e) {
         return CrashHandler.getExceptionStackTrace(CrashHandler.getRootException(e));
     }
 
     @WrapForJNI(exceptionMode = "ignore")
-    private static synchronized void handleUncaughtException(final Throwable e) {
+    private static synchronized void handleUncaughtException(Throwable e) {
         if (sCrashHandler != null) {
             sCrashHandler.uncaughtException(null, e);
         }
     }
 
-    private static float getLocationAccuracy(final Location location) {
+    private static float getLocationAccuracy(Location location) {
         float radius = location.getAccuracy();
         return (location.hasAccuracy() && radius > 0) ? radius : 1001;
     }
 
     // Permissions are explicitly checked when requesting content permission.
     @SuppressLint("MissingPermission")
-    private static Location getLastKnownLocation(final LocationManager lm) {
+    private static Location getLastKnownLocation(LocationManager lm) {
         Location lastKnownLocation = null;
         List<String> providers = lm.getAllProviders();
 
         for (String provider : providers) {
             Location location = lm.getLastKnownLocation(provider);
             if (location == null) {
                 continue;
             }
@@ -366,17 +369,17 @@ public class GeckoAppShell {
             return false;
         }
 
         final Looper l = Looper.getMainLooper();
         lm.requestLocationUpdates(provider, 100, 0.5f, getLocationListener(), l);
         return true;
     }
 
-    private static LocationManager getLocationManager(final Context context) {
+    private static LocationManager getLocationManager(Context context) {
         try {
             return (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
         } catch (NoSuchFieldError e) {
             // Some Tegras throw exceptions about missing the CONTROL_LOCATION_UPDATES permission,
             // which allows enabling/disabling location update notifications from the cell radio.
             // CONTROL_LOCATION_UPDATES is not for use by normal applications, but we might be
             // hitting this problem if the Tegras are confused about missing cell radios.
             Log.e(LOGTAG, "LOCATION_SERVICE not found?!", e);
@@ -385,99 +388,99 @@ public class GeckoAppShell {
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static void enableLocationHighAccuracy(final boolean enable) {
         locationHighAccuracyEnabled = enable;
     }
 
     @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
-    /* package */ static native void onSensorChanged(int halType, float x, float y, float z,
+    /* package */ static native void onSensorChanged(int hal_type, float x, float y, float z,
                                                      float w, long time);
 
     @WrapForJNI(calledFrom = "any", dispatchTo = "gecko")
     /* package */ static native void onLocationChanged(double latitude, double longitude,
                                                        double altitude, float accuracy,
                                                        float altitudeAccuracy,
                                                        float heading, float speed, long time);
 
     private static class DefaultListeners implements SensorEventListener,
                                                      LocationListener,
                                                      NotificationListener,
                                                      ScreenOrientationDelegate,
                                                      WakeLockDelegate,
                                                      HapticFeedbackDelegate {
         @Override
-        public void onAccuracyChanged(final Sensor sensor, final int accuracy) {
+        public void onAccuracyChanged(Sensor sensor, int accuracy) {
         }
 
         @Override
-        public void onSensorChanged(final SensorEvent s) {
-            int sensorType = s.sensor.getType();
-            int halType = 0;
+        public void onSensorChanged(SensorEvent s) {
+            int sensor_type = s.sensor.getType();
+            int hal_type = 0;
             float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
             // SensorEvent timestamp is in nanoseconds, Gecko expects microseconds.
             final long time = s.timestamp / 1000;
 
-            switch (sensorType) {
-                case Sensor.TYPE_ACCELEROMETER:
-                case Sensor.TYPE_LINEAR_ACCELERATION:
-                case Sensor.TYPE_ORIENTATION:
-                    if (sensorType == Sensor.TYPE_ACCELEROMETER) {
-                        halType = GeckoHalDefines.SENSOR_ACCELERATION;
-                    } else if (sensorType == Sensor.TYPE_LINEAR_ACCELERATION) {
-                        halType = GeckoHalDefines.SENSOR_LINEAR_ACCELERATION;
-                    } else {
-                        halType = GeckoHalDefines.SENSOR_ORIENTATION;
-                    }
-                    x = s.values[0];
-                    y = s.values[1];
-                    z = s.values[2];
-                    break;
+            switch (sensor_type) {
+            case Sensor.TYPE_ACCELEROMETER:
+            case Sensor.TYPE_LINEAR_ACCELERATION:
+            case Sensor.TYPE_ORIENTATION:
+                if (sensor_type == Sensor.TYPE_ACCELEROMETER) {
+                    hal_type = GeckoHalDefines.SENSOR_ACCELERATION;
+                } else if (sensor_type == Sensor.TYPE_LINEAR_ACCELERATION) {
+                    hal_type = GeckoHalDefines.SENSOR_LINEAR_ACCELERATION;
+                } else {
+                    hal_type = GeckoHalDefines.SENSOR_ORIENTATION;
+                }
+                x = s.values[0];
+                y = s.values[1];
+                z = s.values[2];
+                break;
 
-                case Sensor.TYPE_GYROSCOPE:
-                    halType = GeckoHalDefines.SENSOR_GYROSCOPE;
-                    x = (float) Math.toDegrees(s.values[0]);
-                    y = (float) Math.toDegrees(s.values[1]);
-                    z = (float) Math.toDegrees(s.values[2]);
-                    break;
+            case Sensor.TYPE_GYROSCOPE:
+                hal_type = GeckoHalDefines.SENSOR_GYROSCOPE;
+                x = (float) Math.toDegrees(s.values[0]);
+                y = (float) Math.toDegrees(s.values[1]);
+                z = (float) Math.toDegrees(s.values[2]);
+                break;
 
-                case Sensor.TYPE_PROXIMITY:
-                    halType = GeckoHalDefines.SENSOR_PROXIMITY;
-                    x = s.values[0];
-                    z = s.sensor.getMaximumRange();
-                    break;
+            case Sensor.TYPE_PROXIMITY:
+                hal_type = GeckoHalDefines.SENSOR_PROXIMITY;
+                x = s.values[0];
+                z = s.sensor.getMaximumRange();
+                break;
 
-                case Sensor.TYPE_LIGHT:
-                    halType = GeckoHalDefines.SENSOR_LIGHT;
-                    x = s.values[0];
-                    break;
+            case Sensor.TYPE_LIGHT:
+                hal_type = GeckoHalDefines.SENSOR_LIGHT;
+                x = s.values[0];
+                break;
 
-                case Sensor.TYPE_ROTATION_VECTOR:
-                case Sensor.TYPE_GAME_ROTATION_VECTOR: // API >= 18
-                    halType = (sensorType == Sensor.TYPE_ROTATION_VECTOR ?
-                            GeckoHalDefines.SENSOR_ROTATION_VECTOR :
-                            GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR);
-                    x = s.values[0];
-                    y = s.values[1];
-                    z = s.values[2];
-                    if (s.values.length >= 4) {
-                        w = s.values[3];
-                    } else {
-                        // s.values[3] was optional in API <= 18, so we need to compute it
-                        // The values form a unit quaternion, so we can compute the angle of
-                        // rotation purely based on the given 3 values.
-                        w = 1.0f - s.values[0] * s.values[0] -
-                                s.values[1] * s.values[1] - s.values[2] * s.values[2];
-                        w = (w > 0.0f) ? (float) Math.sqrt(w) : 0.0f;
-                    }
-                    break;
+            case Sensor.TYPE_ROTATION_VECTOR:
+            case Sensor.TYPE_GAME_ROTATION_VECTOR: // API >= 18
+                hal_type = (sensor_type == Sensor.TYPE_ROTATION_VECTOR ?
+                        GeckoHalDefines.SENSOR_ROTATION_VECTOR :
+                        GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR);
+                x = s.values[0];
+                y = s.values[1];
+                z = s.values[2];
+                if (s.values.length >= 4) {
+                    w = s.values[3];
+                } else {
+                    // s.values[3] was optional in API <= 18, so we need to compute it
+                    // The values form a unit quaternion, so we can compute the angle of
+                    // rotation purely based on the given 3 values.
+                    w = 1.0f - s.values[0] * s.values[0] -
+                            s.values[1] * s.values[1] - s.values[2] * s.values[2];
+                    w = (w > 0.0f) ? (float) Math.sqrt(w) : 0.0f;
+                }
+                break;
             }
 
-            GeckoAppShell.onSensorChanged(halType, x, y, z, w, time);
+            GeckoAppShell.onSensorChanged(hal_type, x, y, z, w, time);
         }
 
         // Geolocation.
         @Override
         public void onLocationChanged(final Location location) {
             // No logging here: user-identifying information.
 
             double altitude = location.hasAltitude()
@@ -505,48 +508,52 @@ public class GeckoAppShell {
             // properties of the JavaScript Coordinates object.
             GeckoAppShell.onLocationChanged(
                 location.getLatitude(), location.getLongitude(),
                 altitude, accuracy, altitudeAccuracy,
                 heading, speed, location.getTime());
         }
 
         @Override
-        public void onProviderDisabled(final String provider) {}
-
-        @Override
-        public void onProviderEnabled(final String provider) {}
+        public void onProviderDisabled(String provider)
+        {
+        }
 
         @Override
-        public void onStatusChanged(final String provider, final int status, final Bundle extras) {}
+        public void onProviderEnabled(String provider)
+        {
+        }
+
+        @Override
+        public void onStatusChanged(String provider, int status, Bundle extras)
+        {
+        }
 
         @Override // NotificationListener
-        public void showNotification(final String name, final String cookie, final String host,
-                                     final String title, final String text, final String imageUrl) {
+        public void showNotification(String name, String cookie, String host,
+                                     String title, String text, String imageUrl) {
             // Default is to not show the notification, and immediate send close message.
             GeckoAppShell.onNotificationClose(name, cookie);
         }
 
         @Override // NotificationListener
-        public void showPersistentNotification(final String name, final String cookie,
-                                               final String host, final String title,
-                                               final String text, final String imageUrl,
-                                               final String data) {
+        public void showPersistentNotification(String name, String cookie, String host,
+                                               String title, String text, String imageUrl,
+                                               String data) {
             // Default is to not show the notification, and immediate send close message.
             GeckoAppShell.onNotificationClose(name, cookie);
         }
 
         @Override // NotificationListener
-        public void closeNotification(final String name) {
+        public void closeNotification(String name) {
             // Do nothing.
         }
 
         @Override // ScreenOrientationDelegate
-        public boolean setRequestedOrientationForCurrentActivity(
-                final int requestedActivityInfoOrientation) {
+        public boolean setRequestedOrientationForCurrentActivity(int requestedActivityInfoOrientation) {
             // Do nothing, and report that the orientation was not set.
             return false;
         }
 
         private SimpleArrayMap<String, PowerManager.WakeLock> mWakeLocks;
 
         @Override // WakeLockDelegate
         @SuppressLint("Wakelock") // We keep the wake lock independent from the function
@@ -565,23 +572,23 @@ public class GeckoAppShell {
             }
 
             if (state == WakeLockDelegate.STATE_LOCKED_FOREGROUND && wl == null) {
                 final PowerManager pm = (PowerManager)
                         getApplicationContext().getSystemService(Context.POWER_SERVICE);
 
                 if (WakeLockDelegate.LOCK_CPU.equals(lock) ||
                     WakeLockDelegate.LOCK_AUDIO_PLAYING.equals(lock)) {
-                    wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, lock);
+                  wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, lock);
                 } else if (WakeLockDelegate.LOCK_SCREEN.equals(lock) ||
                            WakeLockDelegate.LOCK_VIDEO_PLAYING.equals(lock)) {
                   // ON_AFTER_RELEASE is set, the user activity timer will be reset when the
                   // WakeLock is released, causing the illumination to remain on a bit longer.
-                    wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK |
-                                        PowerManager.ON_AFTER_RELEASE, lock);
+                  wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK |
+                                      PowerManager.ON_AFTER_RELEASE, lock);
                 } else {
                     Log.w(LOGTAG, "Unsupported wake-lock: " + lock);
                     return;
                 }
 
                 wl.acquire();
                 mWakeLocks.put(lock, wl);
             } else if (state != WakeLockDelegate.STATE_LOCKED_FOREGROUND && wl != null) {
@@ -642,18 +649,17 @@ public class GeckoAppShell {
     public static void setNotificationListener(final NotificationListener listener) {
         sNotificationListener = (listener != null) ? listener : DEFAULT_LISTENERS;
     }
 
     public static ScreenOrientationDelegate getScreenOrientationDelegate() {
         return sScreenOrientationDelegate;
     }
 
-    public static void setScreenOrientationDelegate(
-            final @Nullable ScreenOrientationDelegate screenOrientationDelegate) {
+    public static void setScreenOrientationDelegate(@Nullable ScreenOrientationDelegate screenOrientationDelegate) {
         sScreenOrientationDelegate = (screenOrientationDelegate != null) ? screenOrientationDelegate : DEFAULT_LISTENERS;
     }
 
     public static WakeLockDelegate getWakeLockDelegate() {
         return sWakeLockDelegate;
     }
 
     public void setWakeLockDelegate(final WakeLockDelegate delegate) {
@@ -665,249 +671,249 @@ public class GeckoAppShell {
     }
 
     public static void setHapticFeedbackDelegate(final HapticFeedbackDelegate delegate) {
         sHapticFeedbackDelegate = (delegate != null) ? delegate : DEFAULT_LISTENERS;
     }
 
     @SuppressWarnings("fallthrough")
     @WrapForJNI(calledFrom = "gecko")
-    private static void enableSensor(final int aSensortype) {
+    private static void enableSensor(int aSensortype) {
         final SensorManager sm = (SensorManager)
             getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
 
         switch (aSensortype) {
-            case GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR:
-                if (gGameRotationVectorSensor == null) {
-                    gGameRotationVectorSensor = sm.getDefaultSensor(
-                            Sensor.TYPE_GAME_ROTATION_VECTOR);
-                }
-                if (gGameRotationVectorSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gGameRotationVectorSensor,
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-                }
-                if (gGameRotationVectorSensor != null) {
-                    break;
-                }
-                // Fallthrough
+        case GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR:
+            if (gGameRotationVectorSensor == null) {
+                gGameRotationVectorSensor = sm.getDefaultSensor(
+                        Sensor.TYPE_GAME_ROTATION_VECTOR);
+            }
+            if (gGameRotationVectorSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gGameRotationVectorSensor,
+                                    SensorManager.SENSOR_DELAY_FASTEST);
+            }
+            if (gGameRotationVectorSensor != null) {
+              break;
+            }
+            // Fallthrough
 
-            case GeckoHalDefines.SENSOR_ROTATION_VECTOR:
-                if (gRotationVectorSensor == null) {
-                    gRotationVectorSensor = sm.getDefaultSensor(
-                        Sensor.TYPE_ROTATION_VECTOR);
-                }
-                if (gRotationVectorSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gRotationVectorSensor,
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-                }
-                if (gRotationVectorSensor != null) {
-                    break;
-                }
-                // Fallthrough
+        case GeckoHalDefines.SENSOR_ROTATION_VECTOR:
+            if (gRotationVectorSensor == null) {
+                gRotationVectorSensor = sm.getDefaultSensor(
+                    Sensor.TYPE_ROTATION_VECTOR);
+            }
+            if (gRotationVectorSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gRotationVectorSensor,
+                                    SensorManager.SENSOR_DELAY_FASTEST);
+            }
+            if (gRotationVectorSensor != null) {
+              break;
+            }
+            // Fallthrough
 
-            case GeckoHalDefines.SENSOR_ORIENTATION:
-                if (gOrientationSensor == null) {
-                    gOrientationSensor = sm.getDefaultSensor(
-                        Sensor.TYPE_ORIENTATION);
-                }
-                if (gOrientationSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gOrientationSensor,
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_ORIENTATION:
+            if (gOrientationSensor == null) {
+                gOrientationSensor = sm.getDefaultSensor(
+                    Sensor.TYPE_ORIENTATION);
+            }
+            if (gOrientationSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gOrientationSensor,
+                                    SensorManager.SENSOR_DELAY_FASTEST);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_ACCELERATION:
-                if (gAccelerometerSensor == null) {
-                    gAccelerometerSensor = sm.getDefaultSensor(
-                        Sensor.TYPE_ACCELEROMETER);
-                }
-                if (gAccelerometerSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gAccelerometerSensor,
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_ACCELERATION:
+            if (gAccelerometerSensor == null) {
+                gAccelerometerSensor = sm.getDefaultSensor(
+                    Sensor.TYPE_ACCELEROMETER);
+            }
+            if (gAccelerometerSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gAccelerometerSensor,
+                                    SensorManager.SENSOR_DELAY_FASTEST);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_PROXIMITY:
-                if (gProximitySensor == null) {
-                    gProximitySensor = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
-                }
-                if (gProximitySensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gProximitySensor,
-                                        SensorManager.SENSOR_DELAY_NORMAL);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_PROXIMITY:
+            if (gProximitySensor == null) {
+                gProximitySensor = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
+            }
+            if (gProximitySensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gProximitySensor,
+                                    SensorManager.SENSOR_DELAY_NORMAL);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_LIGHT:
-                if (gLightSensor == null) {
-                    gLightSensor = sm.getDefaultSensor(Sensor.TYPE_LIGHT);
-                }
-                if (gLightSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gLightSensor,
-                                        SensorManager.SENSOR_DELAY_NORMAL);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_LIGHT:
+            if (gLightSensor == null) {
+                gLightSensor = sm.getDefaultSensor(Sensor.TYPE_LIGHT);
+            }
+            if (gLightSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gLightSensor,
+                                    SensorManager.SENSOR_DELAY_NORMAL);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_LINEAR_ACCELERATION:
-                if (gLinearAccelerometerSensor == null) {
-                    gLinearAccelerometerSensor = sm.getDefaultSensor(
-                        Sensor.TYPE_LINEAR_ACCELERATION);
-                }
-                if (gLinearAccelerometerSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gLinearAccelerometerSensor,
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_LINEAR_ACCELERATION:
+            if (gLinearAccelerometerSensor == null) {
+                gLinearAccelerometerSensor = sm.getDefaultSensor(
+                    Sensor.TYPE_LINEAR_ACCELERATION);
+            }
+            if (gLinearAccelerometerSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gLinearAccelerometerSensor,
+                                    SensorManager.SENSOR_DELAY_FASTEST);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_GYROSCOPE:
-                if (gGyroscopeSensor == null) {
-                    gGyroscopeSensor = sm.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
-                }
-                if (gGyroscopeSensor != null) {
-                    sm.registerListener(getSensorListener(),
-                                        gGyroscopeSensor,
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_GYROSCOPE:
+            if (gGyroscopeSensor == null) {
+                gGyroscopeSensor = sm.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
+            }
+            if (gGyroscopeSensor != null) {
+                sm.registerListener(getSensorListener(),
+                                    gGyroscopeSensor,
+                                    SensorManager.SENSOR_DELAY_FASTEST);
+            }
+            break;
 
-            default:
-                Log.w(LOGTAG, "Error! Can't enable unknown SENSOR type " +
-                      aSensortype);
+        default:
+            Log.w(LOGTAG, "Error! Can't enable unknown SENSOR type " +
+                  aSensortype);
         }
     }
 
     @SuppressWarnings("fallthrough")
     @WrapForJNI(calledFrom = "gecko")
-    private static void disableSensor(final int aSensortype) {
+    private static void disableSensor(int aSensortype) {
         final SensorManager sm = (SensorManager)
             getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
 
         switch (aSensortype) {
-            case GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR:
-                if (gGameRotationVectorSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gGameRotationVectorSensor);
-                    break;
-                }
-                // Fallthrough
+        case GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR:
+            if (gGameRotationVectorSensor != null) {
+                sm.unregisterListener(getSensorListener(), gGameRotationVectorSensor);
+              break;
+            }
+            // Fallthrough
 
-            case GeckoHalDefines.SENSOR_ROTATION_VECTOR:
-                if (gRotationVectorSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gRotationVectorSensor);
-                    break;
-                }
-                // Fallthrough
+        case GeckoHalDefines.SENSOR_ROTATION_VECTOR:
+            if (gRotationVectorSensor != null) {
+                sm.unregisterListener(getSensorListener(), gRotationVectorSensor);
+              break;
+            }
+            // Fallthrough
 
-            case GeckoHalDefines.SENSOR_ORIENTATION:
-                if (gOrientationSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gOrientationSensor);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_ORIENTATION:
+            if (gOrientationSensor != null) {
+                sm.unregisterListener(getSensorListener(), gOrientationSensor);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_ACCELERATION:
-                if (gAccelerometerSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gAccelerometerSensor);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_ACCELERATION:
+            if (gAccelerometerSensor != null) {
+                sm.unregisterListener(getSensorListener(), gAccelerometerSensor);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_PROXIMITY:
-                if (gProximitySensor != null) {
-                    sm.unregisterListener(getSensorListener(), gProximitySensor);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_PROXIMITY:
+            if (gProximitySensor != null) {
+                sm.unregisterListener(getSensorListener(), gProximitySensor);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_LIGHT:
-                if (gLightSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gLightSensor);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_LIGHT:
+            if (gLightSensor != null) {
+                sm.unregisterListener(getSensorListener(), gLightSensor);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_LINEAR_ACCELERATION:
-                if (gLinearAccelerometerSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gLinearAccelerometerSensor);
-                }
-                break;
+        case GeckoHalDefines.SENSOR_LINEAR_ACCELERATION:
+            if (gLinearAccelerometerSensor != null) {
+                sm.unregisterListener(getSensorListener(), gLinearAccelerometerSensor);
+            }
+            break;
 
-            case GeckoHalDefines.SENSOR_GYROSCOPE:
-                if (gGyroscopeSensor != null) {
-                    sm.unregisterListener(getSensorListener(), gGyroscopeSensor);
-                }
-                break;
-            default:
-                Log.w(LOGTAG, "Error! Can't disable unknown SENSOR type " + aSensortype);
+        case GeckoHalDefines.SENSOR_GYROSCOPE:
+            if (gGyroscopeSensor != null) {
+                sm.unregisterListener(getSensorListener(), gGyroscopeSensor);
+            }
+            break;
+        default:
+            Log.w(LOGTAG, "Error! Can't disable unknown SENSOR type " + aSensortype);
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static void moveTaskToBack() {
         // This is a vestige, to be removed as full-screen support for GeckoView is implemented.
     }
 
     @JNITarget
     static public int getPreferredIconSize() {
         ActivityManager am = (ActivityManager)
             getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
         return am.getLauncherLargeIconSize();
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static String[] getHandlersForMimeType(final String aMimeType, final String aAction) {
+    private static String[] getHandlersForMimeType(String aMimeType, String aAction) {
         final GeckoInterface geckoInterface = getGeckoInterface();
         if (geckoInterface == null) {
             return new String[] {};
         }
         return geckoInterface.getHandlersForMimeType(aMimeType, aAction);
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static String[] getHandlersForURL(final String aURL, final String aAction) {
+    private static String[] getHandlersForURL(String aURL, String aAction) {
         final GeckoInterface geckoInterface = getGeckoInterface();
         if (geckoInterface == null) {
             return new String[] {};
         }
         return geckoInterface.getHandlersForURL(aURL, aAction);
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static boolean getHWEncoderCapability() {
-        return HardwareCodecCapabilityUtils.getHWEncoderCapability();
+      return HardwareCodecCapabilityUtils.getHWEncoderCapability();
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static boolean getHWDecoderCapability() {
-        return HardwareCodecCapabilityUtils.getHWDecoderCapability();
+      return HardwareCodecCapabilityUtils.getHWDecoderCapability();
     }
 
-    static List<ResolveInfo> queryIntentActivities(final Intent intent) {
+    static List<ResolveInfo> queryIntentActivities(Intent intent) {
         final PackageManager pm = getApplicationContext().getPackageManager();
 
         // Exclude any non-exported activities: we can't open them even if we want to!
         // Bug 1031569 has some details.
         final ArrayList<ResolveInfo> list = new ArrayList<>();
         for (ResolveInfo ri: pm.queryIntentActivities(intent, 0)) {
             if (ri.activityInfo.exported) {
                 list.add(ri);
             }
         }
 
         return list;
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    public static String getExtensionFromMimeType(final String aMimeType) {
+    public static String getExtensionFromMimeType(String aMimeType) {
         return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType);
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    public static String getMimeTypeFromExtensions(final String aFileExt) {
+    public static String getMimeTypeFromExtensions(String aFileExt) {
         StringTokenizer st = new StringTokenizer(aFileExt, ".,; ");
         String type = null;
         String subType = null;
         while (st.hasMoreElements()) {
             String ext = st.nextToken();
             String mt = getMimeTypeFromExtension(ext);
             if (mt == null)
                 continue;
@@ -923,22 +929,22 @@ public class GeckoAppShell {
             type = "*";
         if (subType == null)
             subType = "*";
         return type + "/" + subType;
     }
 
     @SuppressWarnings("try")
     @WrapForJNI(calledFrom = "gecko")
-    private static boolean openUriExternal(final String targetURI,
-                                           final String mimeType,
-                                           final String packageName,
-                                           final String className,
-                                           final String action,
-                                           final String title) {
+    private static boolean openUriExternal(String targetURI,
+                                           String mimeType,
+                                           String packageName,
+                                           String className,
+                                           String action,
+                                           String title) {
         final GeckoInterface geckoInterface = getGeckoInterface();
         if (geckoInterface == null) {
             return false;
         }
         // Bug 1450449 - Downloaded files already are already in a public directory and aren't
         // really owned exclusively by Firefox, so there's no real benefit to using
         // content:// URIs here.
         try (StrictModeContext unused = StrictModeContext.allowAllVmPolicies()) {
@@ -975,30 +981,30 @@ public class GeckoAppShell {
      */
     public static void onNotificationClick(final String name, final String cookie) {
         if (GeckoThread.isRunning()) {
             notifyAlertListener(name, "alertclickcallback", cookie);
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static void showNotification(final String name, final String cookie, final String title,
-                                         final String text, final String host,
-                                         final String imageUrl, final String persistentData) {
+    private static void showNotification(String name, String cookie, String title,
+                                         String text, String host, String imageUrl,
+                                         String persistentData) {
         if (persistentData == null) {
             getNotificationListener().showNotification(name, cookie, title, text, host, imageUrl);
             return;
         }
 
         getNotificationListener().showPersistentNotification(
                 name, cookie, title, text, host, imageUrl, persistentData);
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static void closeNotification(final String name) {
+    private static void closeNotification(String name) {
         getNotificationListener().closeNotification(name);
     }
 
     public static synchronized void setDisplayDpiOverride(@Nullable final Integer dpi) {
         if (dpi == null) {
             return;
         }
         if (sDensityDpi != 0) {
@@ -1060,74 +1066,74 @@ public class GeckoAppShell {
                 sScreenDepth = sUseMaxScreenDepth ? info.bitsPerPixel : 24;
             }
         }
 
         return sScreenDepth;
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static void performHapticFeedback(final boolean aIsLongPress) {
+    private static void performHapticFeedback(boolean aIsLongPress) {
         // Don't perform haptic feedback if a vibration is currently playing,
         // because the haptic feedback will nuke the vibration.
         if (!sVibrationMaybePlaying || System.nanoTime() >= sVibrationEndTime) {
             getHapticFeedbackDelegate().performHapticFeedback(
                     aIsLongPress ? HapticFeedbackConstants.LONG_PRESS
                                  : HapticFeedbackConstants.VIRTUAL_KEY);
             sVibrationMaybePlaying = false;
             sVibrationEndTime = 0;
         }
     }
 
     private static Vibrator vibrator() {
         return (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
     }
 
     // Helper method to convert integer array to long array.
-    private static long[] convertIntToLongArray(final int[] input) {
+    private static long[] convertIntToLongArray(int[] input) {
         long[] output = new long[input.length];
         for (int i = 0; i < input.length; i++) {
             output[i] = input[i];
         }
         return output;
     }
 
     // Vibrate only if haptic feedback is enabled.
-    private static void vibrateOnHapticFeedbackEnabled(final int[] milliseconds) {
+    private static void vibrateOnHapticFeedbackEnabled(int[] milliseconds) {
         if (Settings.System.getInt(getApplicationContext().getContentResolver(),
                                    Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) > 0) {
             if (milliseconds.length == 1) {
                 vibrate(milliseconds[0]);
             } else {
                 vibrate(convertIntToLongArray(milliseconds), -1);
             }
         }
     }
 
     @SuppressLint("MissingPermission")
     @WrapForJNI(calledFrom = "gecko")
-    private static void vibrate(final long milliseconds) {
+    private static void vibrate(long milliseconds) {
         sVibrationEndTime = System.nanoTime() + milliseconds * 1000000;
         sVibrationMaybePlaying = true;
         try {
             vibrator().vibrate(milliseconds);
         } catch (final SecurityException ignore) {
             Log.w(LOGTAG, "No VIBRATE permission");
         }
     }
 
     @SuppressLint("MissingPermission")
     @WrapForJNI(calledFrom = "gecko")
-    private static void vibrate(final long[] pattern, final int repeat) {
+    private static void vibrate(long[] pattern, int repeat) {
         // If pattern.length is odd, the last element in the pattern is a
         // meaningless delay, so don't include it in vibrationDuration.
         long vibrationDuration = 0;
         int iterLen = pattern.length & ~1;
         for (int i = 0; i < iterLen; i++) {
-            vibrationDuration += pattern[i];
+          vibrationDuration += pattern[i];
         }
 
         sVibrationEndTime = System.nanoTime() + vibrationDuration * 1000000;
         sVibrationMaybePlaying = true;
         try {
             vibrator().vibrate(pattern, repeat);
         } catch (final SecurityException ignore) {
             Log.w(LOGTAG, "No VIBRATE permission");
@@ -1144,17 +1150,17 @@ public class GeckoAppShell {
         } catch (final SecurityException ignore) {
             Log.w(LOGTAG, "No VIBRATE permission");
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static boolean isNetworkLinkUp() {
         ConnectivityManager cm = (ConnectivityManager)
-                getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+           getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
         try {
             NetworkInfo info = cm.getActiveNetworkInfo();
             if (info == null || !info.isConnected())
                 return false;
         } catch (SecurityException se) {
             return false;
         }
         return true;
@@ -1268,31 +1274,31 @@ public class GeckoAppShell {
 
         return result;
     }
 
     @WrapForJNI(calledFrom = "gecko")
     public static void killAnyZombies() {
         GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() {
             @Override
-            public boolean callback(final int pid) {
+            public boolean callback(int pid) {
                 if (pid != android.os.Process.myPid())
                     android.os.Process.killProcess(pid);
                 return true;
             }
         };
 
         EnumerateGeckoProcesses(visitor);
     }
 
     interface GeckoProcessesVisitor {
         boolean callback(int pid);
     }
 
-    private static void EnumerateGeckoProcesses(final GeckoProcessesVisitor visiter) {
+    private static void EnumerateGeckoProcesses(GeckoProcessesVisitor visiter) {
         int pidColumn = -1;
         int userColumn = -1;
 
         Process ps = null;
         InputStreamReader inputStreamReader = null;
         BufferedReader in = null;
         try {
             // run ps and parse its output
@@ -1336,17 +1342,17 @@ public class GeckoAppShell {
             IOUtils.safeStreamClose(in);
             IOUtils.safeStreamClose(inputStreamReader);
             if (ps != null) {
                 ps.destroy();
             }
         }
     }
 
-    public static String getAppNameByPID(final int pid) {
+    public static String getAppNameByPID(int pid) {
         BufferedReader cmdlineReader = null;
         String path = "/proc/" + pid + "/cmdline";
         try {
             File cmdlineFile = new File(path);
             if (!cmdlineFile.exists())
                 return "";
             cmdlineReader = new BufferedReader(new FileReader(cmdlineFile));
             return cmdlineReader.readLine().trim();
@@ -1408,55 +1414,52 @@ public class GeckoAppShell {
             IOUtils.safeStreamClose(inputStreamReader);
             if (process != null) {
                 process.destroy();
             }
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static byte[] getIconForExtension(final String aExt, final int iconSize) {
+    private static byte[] getIconForExtension(String aExt, int iconSize) {
         try {
-            int resolvedIconSize = iconSize;
-            if (iconSize <= 0) {
-                resolvedIconSize = 16;
-            }
+            if (iconSize <= 0)
+                iconSize = 16;
 
-            String resolvedExt = aExt;
-            if (aExt != null && aExt.length() > 1 && aExt.charAt(0) == '.') {
-                resolvedExt = aExt.substring(1);
-            }
+            if (aExt != null && aExt.length() > 1 && aExt.charAt(0) == '.')
+                aExt = aExt.substring(1);
 
             PackageManager pm = getApplicationContext().getPackageManager();
-            Drawable icon = getDrawableForExtension(pm, resolvedExt);
+            Drawable icon = getDrawableForExtension(pm, aExt);
             if (icon == null) {
                 // Use a generic icon
                 icon = pm.getDefaultActivityIcon();
             }
 
             Bitmap bitmap = ((BitmapDrawable)icon).getBitmap();
-            if (bitmap.getWidth() != resolvedIconSize || bitmap.getHeight() != resolvedIconSize)
-                bitmap = Bitmap.createScaledBitmap(bitmap, resolvedIconSize, resolvedIconSize, true);
+            if (bitmap.getWidth() != iconSize || bitmap.getHeight() != iconSize)
+                bitmap = Bitmap.createScaledBitmap(bitmap, iconSize, iconSize, true);
 
-            ByteBuffer buf = ByteBuffer.allocate(resolvedIconSize * resolvedIconSize * 4);
+            ByteBuffer buf = ByteBuffer.allocate(iconSize * iconSize * 4);
             bitmap.copyPixelsToBuffer(buf);
 
             return buf.array();
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             Log.w(LOGTAG, "getIconForExtension failed.",  e);
             return null;
         }
     }
 
-    public static String getMimeTypeFromExtension(final String ext) {
+    public static String getMimeTypeFromExtension(String ext) {
         final MimeTypeMap mtm = MimeTypeMap.getSingleton();
         return mtm.getMimeTypeFromExtension(ext);
     }
 
-    private static Drawable getDrawableForExtension(final PackageManager pm, final String aExt) {
+    private static Drawable getDrawableForExtension(PackageManager pm, String aExt) {
         Intent intent = new Intent(Intent.ACTION_VIEW);
         final String mimeType = getMimeTypeFromExtension(aExt);
         if (mimeType != null && mimeType.length() > 0)
             intent.setType(mimeType);
         else
             return null;
 
         List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
@@ -1475,17 +1478,18 @@ public class GeckoAppShell {
 
     @WrapForJNI(calledFrom = "gecko")
     private static boolean getShowPasswordSetting() {
         try {
             int showPassword =
                 Settings.System.getInt(getApplicationContext().getContentResolver(),
                                        Settings.System.TEXT_SHOW_PASSWORD, 1);
             return (showPassword > 0);
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             return true;
         }
     }
 
     private static Context sApplicationContext;
 
     @WrapForJNI
     public static Context getApplicationContext() {
@@ -1504,48 +1508,47 @@ public class GeckoAppShell {
     };
 
     private static GeckoInterface sGeckoInterface;
 
     public static GeckoInterface getGeckoInterface() {
         return sGeckoInterface;
     }
 
-    public static void setGeckoInterface(final GeckoInterface aGeckoInterface) {
+    public static void setGeckoInterface(GeckoInterface aGeckoInterface) {
         sGeckoInterface = aGeckoInterface;
     }
 
     /* package */ static Camera sCamera;
 
     private static final int kPreferredFPS = 25;
     private static byte[] sCameraBuffer;
 
     private static class CameraCallback implements Camera.PreviewCallback {
         @WrapForJNI(calledFrom = "gecko")
         private static native void onFrameData(int camera, byte[] data);
 
         private final int mCamera;
 
-        public CameraCallback(final int camera) {
+        public CameraCallback(int camera) {
             mCamera = camera;
         }
 
         @Override
-        public void onPreviewFrame(final byte[] data, final Camera camera) {
+        public void onPreviewFrame(byte[] data, Camera camera) {
             onFrameData(mCamera, data);
 
             if (sCamera != null) {
                 sCamera.addCallbackBuffer(sCameraBuffer);
             }
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static int[] initCamera(final String aContentType, final int aCamera, final int aWidth,
-                                    final int aHeight) {
+    private static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
         // [0] = 0|1 (failure/success)
         // [1] = width
         // [2] = height
         // [3] = fps
         int[] result = new int[4];
         result[0] = 0;
 
         if (Camera.getNumberOfCameras() == 0) {
@@ -1684,17 +1687,17 @@ public class GeckoAppShell {
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static void disableScreenOrientationNotifications() {
         GeckoScreenOrientation.getInstance().disableNotifications();
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static void lockScreenOrientation(final int aOrientation) {
+    private static void lockScreenOrientation(int aOrientation) {
         // TODO: don't vector through GeckoAppShell.
         GeckoScreenOrientation.getInstance().lock(aOrientation);
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static void unlockScreenOrientation() {
         // TODO: don't vector through GeckoAppShell.
         GeckoScreenOrientation.getInstance().unlock();
@@ -1725,18 +1728,17 @@ public class GeckoAppShell {
         if (profile != null) {
             File lock = profile.getFile(".parentlock");
             return lock != null && lock.exists() && lock.delete();
         }
         return false;
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static String getProxyForURI(final String spec, final String scheme, final String host,
-                                         final int port) {
+    private static String getProxyForURI(String spec, String scheme, String host, int port) {
         final ProxySelector ps = new ProxySelector();
 
         Proxy proxy = ps.select(scheme, host);
         if (Proxy.NO_PROXY.equals(proxy)) {
             return "DIRECT";
         }
 
         switch (proxy.type()) {
@@ -1745,27 +1747,26 @@ public class GeckoAppShell {
             case SOCKS:
                 return "SOCKS " + proxy.address().toString();
         }
 
         return "DIRECT";
     }
 
     @WrapForJNI
-    private static InputStream createInputStream(final URLConnection connection)
-            throws IOException {
+    private static InputStream createInputStream(URLConnection connection) throws IOException {
         return connection.getInputStream();
     }
 
     private static class BitmapConnection extends URLConnection {
-        private Bitmap mBitmap;
+        private Bitmap bitmap;
 
-        BitmapConnection(final Bitmap b) throws MalformedURLException, IOException {
+        BitmapConnection(Bitmap b) throws MalformedURLException, IOException {
             super(null);
-            mBitmap = b;
+            bitmap = b;
         }
 
         @Override
         public void connect() {}
 
         @Override
         public InputStream getInputStream() throws IOException {
             return new BitmapInputStream();
@@ -1775,44 +1776,44 @@ public class GeckoAppShell {
         public String getContentType() {
             return "image/png";
         }
 
         private final class BitmapInputStream extends PipedInputStream {
             private boolean mHaveConnected = false;
 
             @Override
-            public synchronized int read(final byte[] buffer, final int byteOffset,
-                                         final int byteCount) throws IOException {
+            public synchronized int read(byte[] buffer, int byteOffset, int byteCount)
+                                    throws IOException {
                 if (mHaveConnected) {
                     return super.read(buffer, byteOffset, byteCount);
                 }
 
                 final PipedOutputStream output = new PipedOutputStream();
                 connect(output);
 
                 ThreadUtils.postToBackgroundThread(
                     new Runnable() {
                         @Override
                         public void run() {
                             try {
-                                mBitmap.compress(Bitmap.CompressFormat.PNG, 100, output);
+                                bitmap.compress(Bitmap.CompressFormat.PNG, 100, output);
                             } finally {
                                 IOUtils.safeStreamClose(output);
                             }
                         }
                     });
                 mHaveConnected = true;
                 return super.read(buffer, byteOffset, byteCount);
             }
         }
     }
 
     @WrapForJNI
-    private static URLConnection getConnection(final String url) {
+    private static URLConnection getConnection(String url) {
         try {
             String spec;
             if (url.startsWith("android://")) {
                 spec = url.substring(10);
             } else {
                 spec = url.substring(8);
             }
 
@@ -1840,17 +1841,17 @@ public class GeckoAppShell {
             }
         } catch (Exception ex) {
             return null;
         }
         return null;
     }
 
     @WrapForJNI
-    private static String connectionGetMimeType(final URLConnection connection) {
+    private static String connectionGetMimeType(URLConnection connection) {
         return connection.getContentType();
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static int getMaxTouchPoints() {
         PackageManager pm = getApplicationContext().getPackageManager();
         if (pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) {
             // at least, 5+ fingers.
@@ -1870,17 +1871,17 @@ public class GeckoAppShell {
 
     /*
      * Keep in sync with PointerCapabilities in ServoTypes.h
     */
     static private final int NO_POINTER            = 0x00000000;
     static private final int COARSE_POINTER        = 0x00000001;
     static private final int FINE_POINTER          = 0x00000002;
     static private final int HOVER_CAPABLE_POINTER = 0x00000004;
-    private static int getPointerCapabilities(final InputDevice inputDevice) {
+    private static int getPointerCapabilities(InputDevice inputDevice) {
         int result = NO_POINTER;
         int sources = inputDevice.getSources();
 
         if (hasInputDeviceSource(sources, InputDevice.SOURCE_TOUCHSCREEN) ||
             hasInputDeviceSource(sources, InputDevice.SOURCE_JOYSTICK)) {
             result |= COARSE_POINTER;
         } else if (hasInputDeviceSource(sources, InputDevice.SOURCE_MOUSE) ||
                    hasInputDeviceSource(sources, InputDevice.SOURCE_STYLUS) ||
@@ -1934,17 +1935,17 @@ public class GeckoAppShell {
             // We need information only for the primary pointer.
             // (Assumes that the primary pointer appears first in the list)
             break;
         }
 
         return result;
     }
 
-    private static boolean hasInputDeviceSource(final int sources, final int inputDeviceSource) {
+    private static boolean hasInputDeviceSource(int sources, int inputDeviceSource) {
         return (sources & inputDeviceSource) == inputDeviceSource;
     }
 
     public static synchronized void setScreenSizeOverride(final Rect size) {
         sScreenSizeOverride = size;
     }
 
     @WrapForJNI(calledFrom = "gecko")
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoBatteryManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoBatteryManager.java
@@ -73,17 +73,17 @@ public class GeckoBatteryManager extends
         mIsEnabled = false;
     }
 
     @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
     private static native void onBatteryChange(double level, boolean charging,
                                                double remainingTime);
 
     @Override
-    public void onReceive(final Context context, final Intent intent) {
+    public void onReceive(Context context, Intent intent) {
         if (!intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED)) {
             Log.e(LOGTAG, "Got an unexpected intent!");
             return;
         }
 
         boolean previousCharging = isCharging();
         double previousLevel = getLevel();
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableChild.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditableChild.java
@@ -31,53 +31,52 @@ public final class GeckoEditableChild ex
 
     private final class RemoteChild extends IGeckoEditableChild.Stub {
         @Override // IGeckoEditableChild
         public void transferParent(final IGeckoEditableParent editableParent) {
             GeckoEditableChild.this.transferParent(editableParent);
         }
 
         @Override // IGeckoEditableChild
-        public void onKeyEvent(final int action, final int keyCode, final int scanCode,
-                               final int metaState, final int keyPressMetaState, final long time,
-                               final int domPrintableKeyValue, final int repeatCount,
-                               final int flags, final boolean isSynthesizedImeKey,
-                               final KeyEvent event) {
+        public void onKeyEvent(int action, int keyCode, int scanCode, int metaState,
+                               int keyPressMetaState, long time, int domPrintableKeyValue,
+                               int repeatCount, int flags, boolean isSynthesizedImeKey,
+                               KeyEvent event) {
             GeckoEditableChild.this.onKeyEvent(
                     action, keyCode, scanCode, metaState, keyPressMetaState, time,
                     domPrintableKeyValue, repeatCount, flags, isSynthesizedImeKey, event);
         }
 
         @Override // IGeckoEditableChild
         public void onImeSynchronize() {
             GeckoEditableChild.this.onImeSynchronize();
         }
 
         @Override // IGeckoEditableChild
-        public void onImeReplaceText(final int start, final int end, final String text) {
+        public void onImeReplaceText(int start, int end, String text) {
             GeckoEditableChild.this.onImeReplaceText(start, end, text);
         }
 
         @Override // IGeckoEditableChild
-        public void onImeAddCompositionRange(final int start, final int end, final int rangeType,
-                                             final int rangeStyles, final int rangeLineStyle,
-                                             final boolean rangeBoldLine, final int rangeForeColor,
-                                             final int rangeBackColor, final int rangeLineColor) {
+        public void onImeAddCompositionRange(int start, int end, int rangeType,
+                                             int rangeStyles, int rangeLineStyle,
+                                             boolean rangeBoldLine, int rangeForeColor,
+                                             int rangeBackColor, int rangeLineColor) {
             GeckoEditableChild.this.onImeAddCompositionRange(
                     start, end, rangeType, rangeStyles, rangeLineStyle, rangeBoldLine,
                     rangeForeColor, rangeBackColor, rangeLineColor);
         }
 
         @Override // IGeckoEditableChild
-        public void onImeUpdateComposition(final int start, final int end, final int flags) {
+        public void onImeUpdateComposition(int start, int end, int flags) {
             GeckoEditableChild.this.onImeUpdateComposition(start, end, flags);
         }
 
         @Override // IGeckoEditableChild
-        public void onImeRequestCursorUpdates(final int requestMode) {
+        public void onImeRequestCursorUpdates(int requestMode) {
             GeckoEditableChild.this.onImeRequestCursorUpdates(requestMode);
         }
     }
 
     private final IGeckoEditableChild mEditableChild;
     private final boolean mIsDefault;
 
     private IGeckoEditableParent mEditableParent;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoHalDefines.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoHalDefines.java
@@ -1,16 +1,17 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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/. */
 
 package org.mozilla.gecko;
 
-public class GeckoHalDefines {
+public class GeckoHalDefines
+{
     /*
      * Keep these values consistent with |SensorType| in HalSensor.h
      */
     public static final int SENSOR_ORIENTATION = 0;
     public static final int SENSOR_ACCELERATION = 1;
     public static final int SENSOR_PROXIMITY = 2;
     public static final int SENSOR_LINEAR_ACCELERATION = 3;
     public static final int SENSOR_GYROSCOPE = 4;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoNetworkManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoNetworkManager.java
@@ -50,17 +50,17 @@ public class GeckoNetworkManager extends
     // If we received a "check out new network state!" intent from the OS but nothing in it looks
     // different, we ignore it. See Bug 1330836 for some relevant details.
     private static final String LINK_DATA_CHANGED = "changed";
 
     private static GeckoNetworkManager instance;
 
     // We hackishly (yet harmlessly, in this case) keep a Context reference passed in via the start method.
     // See context handling notes in handleManagerEvent, and Bug 1277333.
-    private Context mContext;
+    private Context context;
 
     public static void destroy() {
         if (instance != null) {
             instance.onDestroy();
             instance = null;
         }
     }
 
@@ -74,23 +74,23 @@ public class GeckoNetworkManager extends
     public enum ManagerEvent {
         start,
         stop,
         enableNotifications,
         disableNotifications,
         receivedUpdate
     }
 
-    private ManagerState mCurrentState = ManagerState.OffNoListeners;
-    private ConnectionType mCurrentConnectionType = ConnectionType.NONE;
-    private ConnectionType mPreviousConnectionType = ConnectionType.NONE;
-    private ConnectionSubType mCurrentConnectionSubtype = ConnectionSubType.UNKNOWN;
-    private ConnectionSubType mPreviousConnectionSubtype = ConnectionSubType.UNKNOWN;
-    private NetworkStatus mCurrentNetworkStatus = NetworkStatus.UNKNOWN;
-    private NetworkStatus mPreviousNetworkStatus = NetworkStatus.UNKNOWN;
+    private ManagerState currentState = ManagerState.OffNoListeners;
+    private ConnectionType currentConnectionType = ConnectionType.NONE;
+    private ConnectionType previousConnectionType = ConnectionType.NONE;
+    private ConnectionSubType currentConnectionSubtype = ConnectionSubType.UNKNOWN;
+    private ConnectionSubType previousConnectionSubtype = ConnectionSubType.UNKNOWN;
+    private NetworkStatus currentNetworkStatus = NetworkStatus.UNKNOWN;
+    private NetworkStatus previousNetworkStatus = NetworkStatus.UNKNOWN;
 
     private enum InfoType {
         MCC,
         MNC
     }
 
     private GeckoNetworkManager() {
         EventDispatcher.getInstance().registerUiThreadListener(this,
@@ -110,31 +110,31 @@ public class GeckoNetworkManager extends
             instance = new GeckoNetworkManager();
         }
 
         return instance;
     }
 
     public double[] getCurrentInformation() {
         final Context applicationContext = GeckoAppShell.getApplicationContext();
-        final ConnectionType connectionType = mCurrentConnectionType;
+        final ConnectionType connectionType = currentConnectionType;
         return new double[] {
-            connectionType.value,
-            connectionType == ConnectionType.WIFI ? 1.0 : 0.0,
-            connectionType == ConnectionType.WIFI ? wifiDhcpGatewayAddress(applicationContext) : 0.0
+                connectionType.value,
+                connectionType == ConnectionType.WIFI ? 1.0 : 0.0,
+                connectionType == ConnectionType.WIFI ? wifiDhcpGatewayAddress(applicationContext) : 0.0
         };
     }
 
     @Override
-    public void onReceive(final Context aContext, final Intent aIntent) {
+    public void onReceive(Context aContext, Intent aIntent) {
         handleManagerEvent(ManagerEvent.receivedUpdate);
     }
 
     public void start(final Context context) {
-        mContext = context;
+        this.context = context;
         handleManagerEvent(ManagerEvent.start);
     }
 
     public void stop() {
         handleManagerEvent(ManagerEvent.stop);
     }
 
     public void enableNotifications() {
@@ -147,60 +147,59 @@ public class GeckoNetworkManager extends
 
     /**
      * For a given event, figure out the next state, run any transition by-product actions, and switch
      * current state to the next state. If event is invalid for the current state, this is a no-op.
      *
      * @param event Incoming event
      * @return Boolean indicating if transition was performed.
      */
-    private synchronized boolean handleManagerEvent(final ManagerEvent event) {
-        final ManagerState nextState = getNextState(mCurrentState, event);
+    private synchronized boolean handleManagerEvent(ManagerEvent event) {
+        final ManagerState nextState = getNextState(currentState, event);
 
-        Log.d(LOGTAG, "Incoming event " + event + " for state " + mCurrentState + " -> " + nextState);
+        Log.d(LOGTAG, "Incoming event " + event + " for state " + currentState + " -> " + nextState);
         if (nextState == null) {
-            Log.w(LOGTAG, "Invalid event " + event + " for state " + mCurrentState);
+            Log.w(LOGTAG, "Invalid event " + event + " for state " + currentState);
             return false;
         }
 
         // We're being deliberately careful about handling context here; it's possible that in some
         // rare cases and possibly related to timing of when this is called (seems to be early in the startup phase),
         // GeckoAppShell.getApplicationContext() will be null, and .start() wasn't called yet,
         // so we don't have a local Context reference either. If both of these are true, we have to drop the event.
         // NB: this is hacky (and these checks attempt to isolate the hackiness), and root cause
         // seems to be how this class fits into the larger ecosystem and general flow of events.
         // See Bug 1277333.
         final Context contextForAction;
-        if (mContext != null) {
-            contextForAction = mContext;
+        if (context != null) {
+            contextForAction = context;
         } else {
             contextForAction = GeckoAppShell.getApplicationContext();
         }
 
         if (contextForAction == null) {
-            Log.w(LOGTAG, "Context is not available while processing event " + event + " for state " + mCurrentState);
+            Log.w(LOGTAG, "Context is not available while processing event " + event + " for state " + currentState);
             return false;
         }
 
-        performActionsForStateEvent(contextForAction, mCurrentState, event);
-        mCurrentState = nextState;
+        performActionsForStateEvent(contextForAction, currentState, event);
+        currentState = nextState;
 
         return true;
     }
 
     /**
      * Defines a transition matrix for our state machine. For a given state/event pair, returns nextState.
      *
      * @param currentState Current state against which we have an incoming event
      * @param event Incoming event for which we'd like to figure out the next state
      * @return State into which we should transition as result of given event
      */
     @Nullable
-    public static ManagerState getNextState(final @NonNull ManagerState currentState,
-                                            final @NonNull ManagerEvent event) {
+    public static ManagerState getNextState(@NonNull ManagerState currentState, @NonNull ManagerEvent event) {
         switch (currentState) {
             case OffNoListeners:
                 switch (event) {
                     case start:
                         return ManagerState.OnNoListeners;
                     case enableNotifications:
                         return ManagerState.OffWithListeners;
                     default:
@@ -304,67 +303,67 @@ public class GeckoNetworkManager extends
      */
     private void updateNetworkStateAndConnectionType(final Context context) {
         final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(
                 Context.CONNECTIVITY_SERVICE);
         // Type/status getters below all have a defined behaviour for when connectivityManager == null
         if (connectivityManager == null) {
             Log.e(LOGTAG, "ConnectivityManager does not exist.");
         }
-        mCurrentConnectionType = NetworkUtils.getConnectionType(connectivityManager);
-        mCurrentNetworkStatus = NetworkUtils.getNetworkStatus(connectivityManager);
-        mCurrentConnectionSubtype = NetworkUtils.getConnectionSubType(connectivityManager);
-        Log.d(LOGTAG, "New network state: " + mCurrentNetworkStatus + ", " + mCurrentConnectionType + ", " + mCurrentConnectionSubtype);
+        currentConnectionType = NetworkUtils.getConnectionType(connectivityManager);
+        currentNetworkStatus = NetworkUtils.getNetworkStatus(connectivityManager);
+        currentConnectionSubtype = NetworkUtils.getConnectionSubType(connectivityManager);
+        Log.d(LOGTAG, "New network state: " + currentNetworkStatus + ", " + currentConnectionType + ", " + currentConnectionSubtype);
     }
 
     @WrapForJNI(dispatchTo = "gecko")
     private static native void onConnectionChanged(int type, String subType,
-                                                   boolean isWifi, int dhcpGateway);
+                                                   boolean isWifi, int DHCPGateway);
 
     @WrapForJNI(dispatchTo = "gecko")
     private static native void onStatusChanged(String status);
 
     /**
      * Send current network state and connection type to whomever is listening.
      */
     private void sendNetworkStateToListeners(final Context context) {
-        final boolean connectionTypeOrSubtypeChanged = mCurrentConnectionType != mPreviousConnectionType ||
-                mCurrentConnectionSubtype != mPreviousConnectionSubtype;
+        final boolean connectionTypeOrSubtypeChanged = currentConnectionType != previousConnectionType ||
+                currentConnectionSubtype != previousConnectionSubtype;
         if (connectionTypeOrSubtypeChanged) {
-            mPreviousConnectionType = mCurrentConnectionType;
-            mPreviousConnectionSubtype = mCurrentConnectionSubtype;
+            previousConnectionType = currentConnectionType;
+            previousConnectionSubtype = currentConnectionSubtype;
 
-            final boolean isWifi = mCurrentConnectionType == ConnectionType.WIFI;
+            final boolean isWifi = currentConnectionType == ConnectionType.WIFI;
             final int gateway = !isWifi ? 0 :
                     wifiDhcpGatewayAddress(context);
 
             if (GeckoThread.isRunning()) {
-                onConnectionChanged(mCurrentConnectionType.value,
-                                    mCurrentConnectionSubtype.value, isWifi, gateway);
+                onConnectionChanged(currentConnectionType.value,
+                                    currentConnectionSubtype.value, isWifi, gateway);
             } else {
                 GeckoThread.queueNativeCall(GeckoNetworkManager.class, "onConnectionChanged",
-                                            mCurrentConnectionType.value,
-                                            String.class, mCurrentConnectionSubtype.value,
+                                            currentConnectionType.value,
+                                            String.class, currentConnectionSubtype.value,
                                             isWifi, gateway);
             }
         }
 
         // If neither network status nor network configuration changed, do nothing.
-        if (mCurrentNetworkStatus == mPreviousNetworkStatus && !connectionTypeOrSubtypeChanged) {
+        if (currentNetworkStatus == previousNetworkStatus && !connectionTypeOrSubtypeChanged) {
             return;
         }
 
         // If network status remains the same, send "changed". Otherwise, send new network status.
         // See Bug 1330836 for relevant details.
         final String status;
-        if (mCurrentNetworkStatus == mPreviousNetworkStatus) {
+        if (currentNetworkStatus == previousNetworkStatus) {
             status = LINK_DATA_CHANGED;
         } else {
-            mPreviousNetworkStatus = mCurrentNetworkStatus;
-            status = mCurrentNetworkStatus.value;
+            previousNetworkStatus = currentNetworkStatus;
+            status = currentNetworkStatus.value;
         }
 
         if (GeckoThread.isRunning()) {
             onStatusChanged(status);
         } else {
             GeckoThread.queueNativeCall(GeckoNetworkManager.class, "onStatusChanged",
                     String.class, status);
         }
@@ -462,17 +461,17 @@ public class GeckoNetworkManager extends
         int ip = info.getIpAddress();
         if (ip == 0) {
             callback.sendError("Cannot get IPv4 address");
             return;
         }
         callback.sendSuccess(Formatter.formatIpAddress(ip));
     }
 
-    private static int getNetworkOperator(final InfoType type, final Context context) {
+    private static int getNetworkOperator(InfoType type, Context context) {
         if (null == context) {
             return -1;
         }
 
         TelephonyManager tel = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
         if (tel == null) {
             Log.e(LOGTAG, "Telephony service does not exist");
             return -1;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java
@@ -158,105 +158,102 @@ public final class GeckoProfile {
             informIfCustomProfileIsUnavailable(profileName, false);
             // Get the default profile for the Activity.
             return getDefaultProfile(context);
         }
 
         return GeckoProfile.get(context, profileName, profilePath);
     }
 
-    private static GeckoProfile getDefaultProfile(final Context context) {
+    private static GeckoProfile getDefaultProfile(Context context) {
         try {
             return get(context, getDefaultProfileName(context));
 
         } catch (final NoMozillaDirectoryException e) {
             // If this failed, we're screwed.
             Log.wtf(LOGTAG, "Unable to get default profile name.", e);
             throw new RuntimeException(e);
         }
     }
 
-    public static GeckoProfile get(final Context context) {
+    public static GeckoProfile get(Context context) {
         return get(context, null, (File) null);
     }
 
-    public static GeckoProfile get(final Context context, final String profileName) {
+    public static GeckoProfile get(Context context, String profileName) {
         if (profileName != null) {
             GeckoProfile profile = sProfileCache.get(profileName);
             if (profile != null)
                 return profile;
         }
         return get(context, profileName, (File)null);
     }
 
     @RobocopTarget
-    public static GeckoProfile get(final Context context, final String profileName,
-                                   final String profilePath) {
+    public static GeckoProfile get(Context context, String profileName, String profilePath) {
         File dir = null;
         if (!TextUtils.isEmpty(profilePath)) {
             dir = new File(profilePath);
             if (!dir.exists() || !dir.isDirectory()) {
                 Log.w(LOGTAG, "requested profile directory missing: " + profilePath);
             }
         }
         return get(context, profileName, dir);
     }
 
     // Note that the profile cache respects only the profile name!
     // If the directory changes, the returned GeckoProfile instance will be mutated.
     @RobocopTarget
-    public static GeckoProfile get(final Context context, final String profileName,
-                                   final File profileDir) {
+    public static GeckoProfile get(Context context, String profileName, File profileDir) {
         if (context == null) {
             throw new IllegalArgumentException("context must be non-null");
         }
 
         // Null name? | Null dir? | Returned profile
         // ------------------------------------------
         //     Yes    |    Yes    | Active profile or default profile.
         //     No     |    Yes    | Profile with specified name at default dir.
         //     Yes    |    No     | Custom (anonymous) profile with specified dir.
         //     No     |    No     | Profile with specified name at specified dir.
         //
         // Empty name?| Null dir? | Returned profile
         // ------------------------------------------
         //     Yes    |    Yes    | Active profile or default profile
 
-        String resolvedProfileName = profileName;
         if (TextUtils.isEmpty(profileName) && profileDir == null) {
             // If no profile info was passed in, look for the active profile or a default profile.
             final GeckoProfile profile = GeckoThread.getActiveProfile();
             if (profile != null) {
                 informIfCustomProfileIsUnavailable(profileName, true);
                 return profile;
             }
 
             informIfCustomProfileIsUnavailable(profileName, false);
             return GeckoProfile.initFromArgs(context, sIntentArgs);
         } else if (profileName == null) {
             // If only profile dir was passed in, use custom (anonymous) profile.
-            resolvedProfileName = CUSTOM_PROFILE;
+            profileName = CUSTOM_PROFILE;
         }
 
         // We require the profile dir to exist if specified, so create it here if needed.
         final boolean init = profileDir != null && profileDir.mkdirs();
 
         // Actually try to look up the profile.
-        GeckoProfile profile = sProfileCache.get(resolvedProfileName);
+        GeckoProfile profile = sProfileCache.get(profileName);
         GeckoProfile newProfile = null;
 
         if (profile == null) {
             try {
-                newProfile = new GeckoProfile(context, resolvedProfileName, profileDir);
+                newProfile = new GeckoProfile(context, profileName, profileDir);
             } catch (NoMozillaDirectoryException e) {
                 // We're unable to do anything sane here.
                 throw new RuntimeException(e);
             }
 
-            profile = sProfileCache.putIfAbsent(resolvedProfileName, newProfile);
+            profile = sProfileCache.putIfAbsent(profileName, newProfile);
         }
 
         if (profile == null) {
             profile = newProfile;
 
         } else if (profileDir != null) {
             // We have an existing profile but was given an alternate directory.
             boolean consistent = false;
@@ -337,18 +334,17 @@ public final class GeckoProfile {
 
         try {
             return profileDir.getCanonicalPath().equals(getGuestDir(context).getCanonicalPath());
         } catch (final IOException e) {
             return false;
         }
     }
 
-    private GeckoProfile(final Context context, final String profileName, final File profileDir)
-            throws NoMozillaDirectoryException {
+    private GeckoProfile(Context context, String profileName, File profileDir) throws NoMozillaDirectoryException {
         if (profileName == null) {
             throw new IllegalArgumentException("Unable to create GeckoProfile for empty profile name.");
         }
 
         mName = profileName;
         mMozillaDir = GeckoProfileDirectories.getMozillaDirectory(context);
 
         mProfileDir = profileDir;
@@ -404,17 +400,17 @@ public final class GeckoProfile {
      * #getLock()}.
      *
      * @param data Custom data object
      */
     public void setData(final Object data) {
         mData = data;
     }
 
-    private void setDir(final File dir) {
+    private void setDir(File dir) {
         if (dir != null && dir.exists() && dir.isDirectory()) {
             synchronized (this) {
                 mProfileDir = dir;
                 mInGuestMode = null;
             }
         }
     }
 
@@ -472,17 +468,17 @@ public final class GeckoProfile {
                 // If it doesn't exist, create it.
                 mProfileDir = createProfileDir();
             }
         } catch (IOException ioe) {
             Log.e(LOGTAG, "Error getting profile dir", ioe);
         }
     }
 
-    public File getFile(final String aFile) {
+    public File getFile(String aFile) {
         File f = getDir();
         if (f == null)
             return null;
 
         return new File(f, aFile);
     }
 
     /**
@@ -661,17 +657,17 @@ public final class GeckoProfile {
      * hold the previous session (where it is used to read the "tabs from last time").
      * If we're not restoring tabs automatically, sessionstore.js needs to be moved to
      * sessionstore.old, so we can display the correct "tabs from last time".
      * If we *are* restoring tabs, we need to delete outdated copies of sessionstore.old,
      * so we don't continue showing stale "tabs from last time" indefinitely.
      *
      * @param shouldRestore Pass true if we are automatically restoring last session's tabs.
      */
-    public void updateSessionFile(final boolean shouldRestore) {
+    public void updateSessionFile(boolean shouldRestore) {
         File sessionFilePrevious = getFile(SESSION_FILE_PREVIOUS);
         if (!shouldRestore) {
             File sessionFile = getFile(SESSION_FILE);
             if (sessionFile != null && sessionFile.exists()) {
                 sessionFile.renameTo(sessionFilePrevious);
             }
         } else {
             if (sessionFilePrevious != null && sessionFilePrevious.exists() &&
@@ -704,33 +700,33 @@ public final class GeckoProfile {
      * In general, sessionstore.js holds the current session, and
      * sessionstore.bak holds a backup copy in case of interrupted writes.
      *
      * @param readBackup if true, the session is read from sessionstore.bak;
      *                   otherwise, the session is read from sessionstore.js
      *
      * @return the session string
      */
-    public String readSessionFile(final boolean readBackup) {
+    public String readSessionFile(boolean readBackup) {
         return readSessionFile(readBackup ? SESSION_FILE_BACKUP : SESSION_FILE);
     }
 
     /**
      * Get the string from last session's session file.
      *
      * If we are not restoring tabs automatically, sessionstore.old will contain
      * the previous session.
      *
      * @return the session string
      */
     public String readPreviousSessionFile() {
         return readSessionFile(SESSION_FILE_PREVIOUS);
     }
 
-    private String readSessionFile(final String fileName) {
+    private String readSessionFile(String fileName) {
         File sessionFile = getFile(fileName);
 
         try {
             if (sessionFile != null && sessionFile.exists()) {
                 return readFile(sessionFile);
             }
         } catch (IOException ioe) {
             Log.e(LOGTAG, "Unable to read session file", ioe);
@@ -810,42 +806,42 @@ public final class GeckoProfile {
         try {
             jsonArray = new JSONArray(fileContent);
         } catch (JSONException e) {
             jsonArray = new JSONArray();
         }
         return jsonArray;
     }
 
-    public String readFile(final String filename) throws IOException {
+    public String readFile(String filename) throws IOException {
         File dir = getDir();
         if (dir == null) {
             throw new IOException("No profile directory found");
         }
         File target = new File(dir, filename);
         return readFile(target);
     }
 
-    private String readFile(final File target) throws IOException {
+    private String readFile(File target) throws IOException {
         FileReader fr = new FileReader(target);
         try {
             StringBuilder sb = new StringBuilder();
             char[] buf = new char[8192];
             int read = fr.read(buf);
             while (read >= 0) {
                 sb.append(buf, 0, read);
                 read = fr.read(buf);
             }
             return sb.toString();
         } finally {
             fr.close();
         }
     }
 
-    public boolean deleteFileFromProfileDir(final String fileName) throws IllegalArgumentException {
+    public boolean deleteFileFromProfileDir(String fileName) throws IllegalArgumentException {
         if (TextUtils.isEmpty(fileName)) {
             throw new IllegalArgumentException("Filename cannot be empty.");
         }
         File file = new File(getDir(), fileName);
         return file.delete();
     }
 
     private boolean remove() {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfileDirectories.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfileDirectories.java
@@ -20,69 +20,69 @@ import android.content.Context;
  * names to salted profile directory paths, as well as the default profile name.
  *
  * This class will eventually come to encapsulate the remaining logic embedded
  * in profiles.ini; for now it's a read-only wrapper.
  */
 public class GeckoProfileDirectories {
     @SuppressWarnings("serial")
     public static class NoMozillaDirectoryException extends Exception {
-        public NoMozillaDirectoryException(final Throwable cause) {
+        public NoMozillaDirectoryException(Throwable cause) {
             super(cause);
         }
 
-        public NoMozillaDirectoryException(final String reason) {
+        public NoMozillaDirectoryException(String reason) {
             super(reason);
         }
 
-        public NoMozillaDirectoryException(final String reason, final Throwable cause) {
+        public NoMozillaDirectoryException(String reason, Throwable cause) {
             super(reason, cause);
         }
     }
 
     @SuppressWarnings("serial")
     public static class NoSuchProfileException extends Exception {
-        public NoSuchProfileException(final String detailMessage, final Throwable cause) {
+        public NoSuchProfileException(String detailMessage, Throwable cause) {
             super(detailMessage, cause);
         }
 
-        public NoSuchProfileException(final String detailMessage) {
+        public NoSuchProfileException(String detailMessage) {
             super(detailMessage);
         }
     }
 
     private interface INISectionPredicate {
         public boolean matches(INISection section);
     }
 
     private static final String MOZILLA_DIR_NAME = "mozilla";
 
     /**
      * Returns true if the supplied profile entry represents the default profile.
      */
     private static final INISectionPredicate sectionIsDefault = new INISectionPredicate() {
         @Override
-        public boolean matches(final INISection section) {
+        public boolean matches(INISection section) {
             return section.getIntProperty("Default") == 1;
         }
     };
 
     /**
      * Returns true if the supplied profile entry has a 'Name' field.
      */
     private static final INISectionPredicate sectionHasName = new INISectionPredicate() {
         @Override
-        public boolean matches(final INISection section) {
+        public boolean matches(INISection section) {
             final String name = section.getStringProperty("Name");
             return name != null;
         }
     };
 
     @RobocopTarget
-    public static INIParser getProfilesINI(final File mozillaDir) {
+    public static INIParser getProfilesINI(File mozillaDir) {
         return new INIParser(new File(mozillaDir, "profiles.ini"));
     }
 
     /**
      * Utility method to compute a salted profile name: eight random alphanumeric
      * characters, followed by a period, followed by the profile name.
      */
     public static String saltProfileName(final String name) {
@@ -110,18 +110,17 @@ public class GeckoProfileDirectories {
      * This method is package-scoped so that new {@link GeckoProfile} instances can
      * contextualize themselves.
      *
      * @return a new File object for the Mozilla directory.
      * @throws NoMozillaDirectoryException
      *             if the directory did not exist and could not be created.
      */
     @RobocopTarget
-    public static File getMozillaDirectory(final Context context)
-            throws NoMozillaDirectoryException {
+    public static File getMozillaDirectory(Context context) throws NoMozillaDirectoryException {
         final File mozillaDir = new File(context.getFilesDir(), MOZILLA_DIR_NAME);
         if (mozillaDir.mkdirs() || mozillaDir.isDirectory()) {
             return mozillaDir;
         }
 
         // Although this leaks a path to the system log, the path is
         // predictable (unlike a profile directory), so this is fine.
         throw new NoMozillaDirectoryException("Unable to create mozilla directory at " + mozillaDir.getAbsolutePath());
@@ -133,26 +132,26 @@ public class GeckoProfileDirectories {
      * Package-scoped because {@link GeckoProfile} needs access to it.
      *
      * @return null if there is no "Default" entry in profiles.ini, or the profile
      *         name if there is.
      * @throws NoMozillaDirectoryException
      *             if the Mozilla directory did not exist and could not be created.
      */
     static String findDefaultProfileName(final Context context) throws NoMozillaDirectoryException {
-        final INIParser parser = GeckoProfileDirectories.getProfilesINI(getMozillaDirectory(context));
-        if (parser.getSections() != null) {
-            for (Enumeration<INISection> e = parser.getSections().elements(); e.hasMoreElements(); ) {
-                final INISection section = e.nextElement();
-                if (section.getIntProperty("Default") == 1) {
-                    return section.getStringProperty("Name");
-                }
-            }
-        }
-        return null;
+      final INIParser parser = GeckoProfileDirectories.getProfilesINI(getMozillaDirectory(context));
+      if (parser.getSections() != null) {
+          for (Enumeration<INISection> e = parser.getSections().elements(); e.hasMoreElements(); ) {
+              final INISection section = e.nextElement();
+              if (section.getIntProperty("Default") == 1) {
+                  return section.getStringProperty("Name");
+              }
+          }
+      }
+      return null;
     }
 
     static Map<String, String> getDefaultProfile(final File mozillaDir) {
         return getMatchingProfiles(mozillaDir, sectionIsDefault, true);
     }
 
     static Map<String, String> getProfilesNamed(final File mozillaDir, final String name) {
         final INISectionPredicate predicate = new INISectionPredicate() {
@@ -183,18 +182,17 @@ public class GeckoProfileDirectories {
      *            a predicate to use when evaluating whether to include a
      *            particular INI section.
      * @param stopOnSuccess
      *            if true, this method will return with the first result that
      *            matches the predicate; if false, all matching results are
      *            included.
      * @return a {@link Map} from name to path.
      */
-    public static Map<String, String> getMatchingProfiles(final File mozillaDir,
-            final INISectionPredicate predicate, final boolean stopOnSuccess) {
+    public static Map<String, String> getMatchingProfiles(final File mozillaDir, INISectionPredicate predicate, boolean stopOnSuccess) {
         final HashMap<String, String> result = new HashMap<String, String>();
         final INIParser parser = GeckoProfileDirectories.getProfilesINI(mozillaDir);
 
         if (parser.getSections() != null) {
             for (Enumeration<INISection> e = parser.getSections().elements(); e.hasMoreElements(); ) {
                 final INISection section = e.nextElement();
                 if (predicate == null || predicate.matches(section)) {
                     final String name = section.getStringProperty("Name");
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoScreenOrientation.java
@@ -36,23 +36,23 @@ public class GeckoScreenOrientation {
         PORTRAIT(PORTRAIT_PRIMARY.value | PORTRAIT_SECONDARY.value),
         LANDSCAPE_PRIMARY(1 << 2),
         LANDSCAPE_SECONDARY(1 << 3),
         LANDSCAPE(LANDSCAPE_PRIMARY.value | LANDSCAPE_SECONDARY.value),
         DEFAULT(1 << 4);
 
         public final short value;
 
-        private ScreenOrientation(final int value) {
+        private ScreenOrientation(int value) {
             this.value = (short)value;
         }
 
         private final static ScreenOrientation[] sValues = ScreenOrientation.values();
 
-        public static ScreenOrientation get(final int value) {
+        public static ScreenOrientation get(int value) {
             for (ScreenOrientation orient: sValues) {
                 if (orient.value == value) {
                     return orient;
                 }
             }
             return NONE;
         }
     }
@@ -82,25 +82,25 @@ public class GeckoScreenOrientation {
     private GeckoScreenOrientation() {
         mListeners = new ArrayList<>();
         update();
     }
 
     /**
      * Add a listener that will be notified when the screen orientation has changed.
      */
-    public void addListener(final OrientationChangeListener aListener) {
+    public void addListener(OrientationChangeListener aListener) {
         ThreadUtils.assertOnUiThread();
         mListeners.add(aListener);
     }
 
     /**
      * Remove a OrientationChangeListener again.
      */
-    public void removeListener(final OrientationChangeListener aListener) {
+    public void removeListener(OrientationChangeListener aListener) {
         ThreadUtils.assertOnUiThread();
         mListeners.remove(aListener);
     }
 
     /*
      * Enable Gecko screen orientation events on update.
      */
     public void enableNotifications() {
@@ -134,57 +134,56 @@ public class GeckoScreenOrientation {
      * Update screen orientation given the android orientation.
      * Retrieve rotation via GeckoAppShell.
      *
      * @param aAndroidOrientation
      *        Android screen orientation from Configuration.orientation.
      *
      * @return Whether the screen orientation has changed.
      */
-    public boolean update(final int aAndroidOrientation) {
+    public boolean update(int aAndroidOrientation) {
         return update(getScreenOrientation(aAndroidOrientation, getRotation()));
     }
 
     @WrapForJNI(dispatchTo = "gecko")
     private static native void onOrientationChange(short screenOrientation, short angle);
 
     /*
      * Update screen orientation given the screen orientation.
      *
      * @param aScreenOrientation
      *        Gecko screen orientation based on android orientation and rotation.
      *
      * @return Whether the screen orientation has changed.
      */
-    public synchronized boolean update(final ScreenOrientation aScreenOrientation) {
+    public synchronized boolean update(ScreenOrientation aScreenOrientation) {
         if (mScreenOrientation == aScreenOrientation) {
             return false;
         }
         mScreenOrientation = aScreenOrientation;
         Log.d(LOGTAG, "updating to new orientation " + mScreenOrientation);
         notifyListeners(mScreenOrientation);
         if (mShouldNotify) {
             // Gecko expects a definite screen orientation, so we default to the
             // primary orientations.
-            ScreenOrientation primaryOrientation = aScreenOrientation;
             if (aScreenOrientation == ScreenOrientation.PORTRAIT) {
-                primaryOrientation = ScreenOrientation.PORTRAIT_PRIMARY;
+                aScreenOrientation = ScreenOrientation.PORTRAIT_PRIMARY;
             } else if (aScreenOrientation == ScreenOrientation.LANDSCAPE) {
-                primaryOrientation = ScreenOrientation.LANDSCAPE_PRIMARY;
+                aScreenOrientation = ScreenOrientation.LANDSCAPE_PRIMARY;
             } else if (aScreenOrientation == ScreenOrientation.DEFAULT) {
-                primaryOrientation = ScreenOrientation.PORTRAIT_PRIMARY;
+                aScreenOrientation = ScreenOrientation.PORTRAIT_PRIMARY;
             } else if (aScreenOrientation == ScreenOrientation.NONE) {
                 return false;
             }
 
             if (GeckoThread.isRunning()) {
-                onOrientationChange(primaryOrientation.value, getAngle());
+                onOrientationChange(aScreenOrientation.value, getAngle());
             } else {
                 GeckoThread.queueNativeCall(GeckoScreenOrientation.class, "onOrientationChange",
-                                            primaryOrientation.value, getAngle());
+                                            aScreenOrientation.value, getAngle());
             }
         }
         ScreenManagerHelper.refreshScreenInfo();
         return true;
     }
 
     private void notifyListeners(final ScreenOrientation newOrientation) {
         final Runnable notifier = new Runnable() {
@@ -219,30 +218,30 @@ public class GeckoScreenOrientation {
     }
 
     /**
      * Lock screen orientation given the Gecko screen orientation.
      *
      * @param aGeckoOrientation
      *        The Gecko orientation provided.
      */
-    public void lock(final int aGeckoOrientation) {
+    public void lock(int aGeckoOrientation) {
         lock(ScreenOrientation.get(aGeckoOrientation));
     }
 
     /**
      * Lock screen orientation given the Gecko screen orientation.
      *
      * @param aScreenOrientation
      *        Gecko screen orientation derived from Android orientation and
      *        rotation.
      *
      * @return Whether the locking was successful.
      */
-    public boolean lock(final ScreenOrientation aScreenOrientation) {
+    public boolean lock(ScreenOrientation aScreenOrientation) {
         Log.d(LOGTAG, "locking to " + aScreenOrientation);
         final ScreenOrientationDelegate delegate = GeckoAppShell.getScreenOrientationDelegate();
         final int activityInfoOrientation = screenOrientationToActivityInfoOrientation(aScreenOrientation);
         synchronized (this) {
             if (delegate.setRequestedOrientationForCurrentActivity(activityInfoOrientation)) {
                 update(aScreenOrientation);
                 return true;
             } else {
@@ -275,18 +274,17 @@ public class GeckoScreenOrientation {
      *
      * @param aAndroidOrientation
      *        Android orientation from Configuration.orientation.
      * @param aRotation
      *        Device rotation from Display.getRotation().
      *
      * @return Gecko screen orientation.
      */
-    private ScreenOrientation getScreenOrientation(final int aAndroidOrientation,
-                                                   final int aRotation) {
+    private ScreenOrientation getScreenOrientation(int aAndroidOrientation, int aRotation) {
         boolean isPrimary = aRotation == Surface.ROTATION_0 || aRotation == Surface.ROTATION_90;
         if (aAndroidOrientation == Configuration.ORIENTATION_PORTRAIT) {
             if (isPrimary) {
                 // Non-rotated portrait device or landscape device rotated
                 // to primary portrait mode counter-clockwise.
                 return ScreenOrientation.PORTRAIT_PRIMARY;
             }
             return ScreenOrientation.PORTRAIT_SECONDARY;
@@ -337,17 +335,17 @@ public class GeckoScreenOrientation {
     /*
      * Retrieve the screen orientation from an array string.
      *
      * @param aArray
      *        String containing comma-delimited strings.
      *
      * @return First parsed Gecko screen orientation.
      */
-    public static ScreenOrientation screenOrientationFromArrayString(final String aArray) {
+    public static ScreenOrientation screenOrientationFromArrayString(String aArray) {
         List<String> orientations = Arrays.asList(aArray.split(","));
         if ("".equals(aArray) || orientations.size() == 0) {
             // If nothing is listed, return default.
             Log.w(LOGTAG, "screenOrientationFromArrayString: no orientation in string");
             return ScreenOrientation.DEFAULT;
         }
 
         // We don't support multiple orientations yet. To avoid developer
@@ -358,17 +356,17 @@ public class GeckoScreenOrientation {
     /*
      * Retrieve the screen orientation from a string.
      *
      * @param aStr
      *        String hopefully containing a screen orientation name.
      * @return Gecko screen orientation if matched, DEFAULT_SCREEN_ORIENTATION
      *         otherwise.
      */
-    public static ScreenOrientation screenOrientationFromString(final String aStr) {
+    public static ScreenOrientation screenOrientationFromString(String aStr) {
         switch (aStr) {
             case "portrait":
                 return ScreenOrientation.PORTRAIT;
             case "landscape":
                 return ScreenOrientation.LANDSCAPE;
             case "portrait-primary":
                 return ScreenOrientation.PORTRAIT_PRIMARY;
             case "portrait-secondary":
@@ -387,18 +385,17 @@ public class GeckoScreenOrientation {
      * Convert Gecko screen orientation to Android orientation.
      *
      * @param aScreenOrientation
      *        Gecko screen orientation.
      * @return Android orientation. This conversion is lossy, the Android
      *         orientation does not differentiate between primary and secondary
      *         orientations.
      */
-    public static int screenOrientationToAndroidOrientation(
-            final ScreenOrientation aScreenOrientation) {
+    public static int screenOrientationToAndroidOrientation(ScreenOrientation aScreenOrientation) {
         switch (aScreenOrientation) {
             case PORTRAIT:
             case PORTRAIT_PRIMARY:
             case PORTRAIT_SECONDARY:
                 return Configuration.ORIENTATION_PORTRAIT;
             case LANDSCAPE:
             case LANDSCAPE_PRIMARY:
             case LANDSCAPE_SECONDARY:
@@ -415,18 +412,17 @@ public class GeckoScreenOrientation {
      * This is yet another orientation used by Android, but it's more detailed
      * than the Android orientation.
      * It is required for screen orientation locking and unlocking.
      *
      * @param aScreenOrientation
      *        Gecko screen orientation.
      * @return Android ActivityInfo orientation.
      */
-    public static int screenOrientationToActivityInfoOrientation(
-            final ScreenOrientation aScreenOrientation) {
+    public static int screenOrientationToActivityInfoOrientation(ScreenOrientation aScreenOrientation) {
         switch (aScreenOrientation) {
             case PORTRAIT:
                 return ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
             case PORTRAIT_PRIMARY:
                 return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
             case PORTRAIT_SECONDARY:
                 return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
             case LANDSCAPE:
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSharedPrefs.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSharedPrefs.java
@@ -80,90 +80,88 @@ public final class GeckoSharedPrefs {
 
     // For optimizing the migration check in subsequent get() calls
     private static volatile boolean migrationDone;
 
     public enum Flags {
         DISABLE_MIGRATIONS
     }
 
-    public static SharedPreferences forApp(final Context context) {
+    public static SharedPreferences forApp(Context context) {
         return forApp(context, EnumSet.noneOf(Flags.class));
     }
 
     /**
      * Returns an app-scoped SharedPreferences instance. You can disable
      * migrations by using the DISABLE_MIGRATIONS flag.
      */
-    public static SharedPreferences forApp(final Context context, final EnumSet<Flags> flags) {
+    public static SharedPreferences forApp(Context context, EnumSet<Flags> flags) {
         if (flags != null && !flags.contains(Flags.DISABLE_MIGRATIONS)) {
             migrateIfNecessary(context);
         }
 
         return context.getSharedPreferences(APP_PREFS_NAME, 0);
     }
 
-    public static SharedPreferences forCrashReporter(final Context context) {
+    public static SharedPreferences forCrashReporter(Context context) {
         return forCrashReporter(context, EnumSet.noneOf(Flags.class));
     }
 
     /**
      * Returns a crash-reporter-scoped SharedPreferences instance. You can disable
      * migrations by using the DISABLE_MIGRATIONS flag.
      */
-    public static SharedPreferences forCrashReporter(final Context context,
-                                                     final EnumSet<Flags> flags) {
+    public static SharedPreferences forCrashReporter(Context context, EnumSet<Flags> flags) {
         if (flags != null && !flags.contains(Flags.DISABLE_MIGRATIONS)) {
             migrateIfNecessary(context);
         }
 
         return context.getSharedPreferences(CRASH_PREFS_NAME, 0);
     }
 
-    public static SharedPreferences forProfile(final Context context) {
+    public static SharedPreferences forProfile(Context context) {
         return forProfile(context, EnumSet.noneOf(Flags.class));
     }
 
     /**
      * Returns a SharedPreferences instance scoped to the current profile
      * in the app. You can disable migrations by using the DISABLE_MIGRATIONS
      * flag.
      */
-    public static SharedPreferences forProfile(final Context context, final EnumSet<Flags> flags) {
+    public static SharedPreferences forProfile(Context context, EnumSet<Flags> flags) {
         String profileName = GeckoProfile.get(context).getName();
         if (profileName == null) {
             throw new IllegalStateException("Could not get current profile name");
         }
 
         return forProfileName(context, profileName, flags);
     }
 
-    public static SharedPreferences forProfileName(final Context context,
-                                                   final String profileName) {
+    public static SharedPreferences forProfileName(Context context, String profileName) {
         return forProfileName(context, profileName, EnumSet.noneOf(Flags.class));
     }
 
     /**
      * Returns an SharedPreferences instance scoped to the given profile name.
      * You can disable migrations by using the DISABLE_MIGRATION flag.
      */
-    public static SharedPreferences forProfileName(final Context context, final String profileName,
-            final EnumSet<Flags> flags) {
+    public static SharedPreferences forProfileName(Context context, String profileName,
+            EnumSet<Flags> flags) {
         if (flags != null && !flags.contains(Flags.DISABLE_MIGRATIONS)) {
             migrateIfNecessary(context);
         }
 
         final String prefsName = PROFILE_PREFS_NAME_PREFIX + profileName;
         return context.getSharedPreferences(prefsName, 0);
     }
 
     /**
      * Returns the current version of the prefs.
      */
-    public static int getVersion(final Context context) {
+    public static int getVersion(Context context) {
         return forApp(context, disableMigrations).getInt(PREFS_VERSION_KEY, 0);
     }
 
     /**
      * Resets migration flag. Should only be used in tests.
      */
     public static synchronized void reset() {
         migrationDone = false;
@@ -190,17 +188,17 @@ public final class GeckoSharedPrefs {
         // Avoid strict mode warnings when doing so.
         try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) {
             performMigration(context);
         }
 
         migrationDone = true;
     }
 
-    private static void performMigration(final Context context) {
+    private static void performMigration(Context context) {
         final SharedPreferences appPrefs = forApp(context, disableMigrations);
 
         final int currentVersion = appPrefs.getInt(PREFS_VERSION_KEY, 0);
         Log.d(LOGTAG, "Current version = " + currentVersion + ", prefs version = " + PREFS_VERSION);
 
         if (currentVersion == PREFS_VERSION) {
             return;
         }
@@ -253,20 +251,18 @@ public final class GeckoSharedPrefs {
         Log.d(LOGTAG, "All keys have been migrated");
     }
 
     /**
      * Moves all preferences stored in PreferenceManager's default prefs
      * to either app or profile scopes. The profile-scoped keys are defined
      * in given profileKeys list, all other keys are moved to the app scope.
      */
-    private static Editor migrateFromPreferenceManager(final Context context,
-                                                       final Editor appEditor,
-                                                       final Editor profileEditor,
-                                                       final List<String> profileKeys) {
+    private static Editor migrateFromPreferenceManager(Context context, Editor appEditor,
+            Editor profileEditor, List<String> profileKeys) {
         Log.d(LOGTAG, "Migrating from PreferenceManager");
 
         final SharedPreferences pmPrefs =
                 PreferenceManager.getDefaultSharedPreferences(context);
 
         for (Map.Entry<String, ?> entry : pmPrefs.getAll().entrySet()) {
             final String key = entry.getKey();
 
@@ -284,42 +280,40 @@ public final class GeckoSharedPrefs {
         // and return the Editor to be committed.
         return pmPrefs.edit().clear();
     }
 
     /**
      * Moves the crash reporter's preferences from the app-wide prefs
      * into its own shared prefs to avoid cross-process pref accesses.
      */
-    private static void migrateCrashReporterSettings(final SharedPreferences appPrefs,
-                                                     final Editor appEditor,
-                                                     final Editor crashEditor,
-                                                     final List<String> profileKeys) {
+    private static void migrateCrashReporterSettings(SharedPreferences appPrefs, Editor appEditor,
+                                                    Editor crashEditor, List<String> profileKeys) {
         Log.d(LOGTAG, "Migrating crash reporter settings");
 
         for (Map.Entry<String, ?> entry : appPrefs.getAll().entrySet()) {
             final String key = entry.getKey();
 
             if (profileKeys.contains(key)) {
                 putEntry(crashEditor, key, entry.getValue());
                 appEditor.remove(key);
             }
         }
     }
 
-    private static void putEntry(final Editor to, final String key, final Object value) {
+    private static void putEntry(Editor to, String key, Object value) {
         Log.d(LOGTAG, "Migrating key = " + key + " with value = " + value);
 
         if (value instanceof String) {
             to.putString(key, (String) value);
         } else if (value instanceof Boolean) {
             to.putBoolean(key, (Boolean) value);
         } else if (value instanceof Long) {
             to.putLong(key, (Long) value);
         } else if (value instanceof Float) {
             to.putFloat(key, (Float) value);
         } else if (value instanceof Integer) {
             to.putInt(key, (Integer) value);
         } else {
             throw new IllegalStateException("Unrecognized value type for key: " + key);
         }
     }
-}
+}
\ No newline at end of file
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSystemStateListener.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSystemStateListener.java
@@ -22,82 +22,82 @@ import org.mozilla.gecko.util.InputDevic
 import org.mozilla.gecko.util.ThreadUtils;
 
 public class GeckoSystemStateListener
         implements InputManager.InputDeviceListener {
     private static final String LOGTAG = "GeckoSystemStateListener";
 
     private static final GeckoSystemStateListener listenerInstance = new GeckoSystemStateListener();
 
-    private boolean mInitialized;
+    private boolean initialized;
     private ContentObserver mContentObserver;
     private static Context sApplicationContext;
     private InputManager mInputManager;
 
     public static GeckoSystemStateListener getInstance() {
         return listenerInstance;
     }
 
     private GeckoSystemStateListener() {
     }
 
     public synchronized void initialize(final Context context) {
-        if (mInitialized) {
+        if (initialized) {
             Log.w(LOGTAG, "Already initialized!");
             return;
         }
         mInputManager = (InputManager)
             context.getSystemService(Context.INPUT_SERVICE);
         mInputManager.registerInputDeviceListener(listenerInstance, ThreadUtils.getUiHandler());
 
         sApplicationContext = context;
         ContentResolver contentResolver = sApplicationContext.getContentResolver();
         Uri animationSetting = Settings.System.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE);
         mContentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
             @Override
-            public void onChange(final boolean selfChange) {
+            public void onChange(boolean selfChange) {
                 onDeviceChanged();
             }
         };
         contentResolver.registerContentObserver(animationSetting, false, mContentObserver);
 
-        mInitialized = true;
+        initialized = true;
     }
 
     public synchronized void shutdown() {
-        if (!mInitialized) {
+        if (!initialized) {
             Log.w(LOGTAG, "Already shut down!");
             return;
         }
 
         if (mInputManager != null) {
             Log.e(LOGTAG, "mInputManager should be valid!");
             return;
         }
 
         mInputManager.unregisterInputDeviceListener(listenerInstance);
 
         ContentResolver contentResolver = sApplicationContext.getContentResolver();
         contentResolver.unregisterContentObserver(mContentObserver);
 
-        mInitialized = false;
+        initialized = false;
         mInputManager = null;
         mContentObserver = null;
     }
 
     @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
     @WrapForJNI(calledFrom = "gecko")
     /**
      * For prefers-reduced-motion media queries feature.
      *
      * Uses `Settings.Global` which was introduced in API version 17.
      */
     private static boolean prefersReducedMotion() {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            return false;
+          return false;
         }
 
         ContentResolver contentResolver = sApplicationContext.getContentResolver();
 
         return Settings.Global.getFloat(contentResolver,
                                         Settings.Global.ANIMATOR_DURATION_SCALE,
                                         1) == 0.0f;
     }
@@ -117,35 +117,35 @@ public class GeckoSystemStateListener
             nativeOnDeviceChanged();
         } else {
             GeckoThread.queueNativeCallUntil(
                     GeckoThread.State.PROFILE_READY, GeckoSystemStateListener.class,
                     "nativeOnDeviceChanged");
         }
     }
 
-    private void notifyDeviceChanged(final int deviceId) {
+    private void notifyDeviceChanged(int deviceId) {
         InputDevice device = InputDevice.getDevice(deviceId);
         if (device == null ||
             !InputDeviceUtils.isPointerTypeDevice(device)) {
             return;
         }
         onDeviceChanged();
     }
 
     @Override
-    public void onInputDeviceAdded(final int deviceId) {
+    public void onInputDeviceAdded(int deviceId) {
         notifyDeviceChanged(deviceId);
     }
 
     @Override
-    public void onInputDeviceRemoved(final int deviceId) {
+    public void onInputDeviceRemoved(int deviceId) {
         // Call onDeviceChanged directly without checking device source types
         // since we can no longer get a valid `InputDevice` in the case of
         // device removal.
         onDeviceChanged();
     }
 
     @Override
-    public void onInputDeviceChanged(final int deviceId) {
+    public void onInputDeviceChanged(int deviceId) {
         notifyDeviceChanged(deviceId);
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoThread.java
@@ -64,31 +64,31 @@ public class GeckoThread extends Thread 
 
         /* The rank is an arbitrary value reflecting the amount of components or features
          * that are available for use. During startup and up to the RUNNING state, the
          * rank value increases because more components are initialized and available for
          * use. During shutdown and up to the EXITED state, the rank value decreases as
          * components are shut down and become unavailable. EXITING has the same rank as
          * LIBS_READY because both states have a similar amount of components available.
          */
-        private final int mRank;
+        private final int rank;
 
-        private State(final int rank) {
-            mRank = rank;
+        private State(int rank) {
+            this.rank = rank;
         }
 
         @Override
         public boolean is(final NativeQueue.State other) {
             return this == other;
         }
 
         @Override
         public boolean isAtLeast(final NativeQueue.State other) {
             if (other instanceof State) {
-                return mRank >= ((State) other).mRank;
+                return this.rank >= ((State) other).rank;
             }
             return false;
         }
 
         @Override
         public String toString() {
             return name();
         }
@@ -591,17 +591,17 @@ public class GeckoThread extends Thread 
     public static void waitOnGeckoForever() {
         nativeWaitOnGecko(0);
     }
 
     public static boolean waitOnGecko() {
         return waitOnGecko(DEFAULT_TIMEOUT);
     }
 
-    public static boolean waitOnGecko(final long timeoutMillis) {
+    public static boolean waitOnGecko(long timeoutMillis) {
         return nativeWaitOnGecko(timeoutMillis);
     }
 
     @WrapForJNI(stubName = "OnPause", dispatchTo = "gecko")
     private static native void nativeOnPause();
 
     public static void onPause() {
         if (isStateAtLeast(State.PROFILE_READY)) {
@@ -641,17 +641,17 @@ public class GeckoThread extends Thread 
 
     @WrapForJNI(dispatchTo = "gecko")
     public static native void forceQuit();
 
     @WrapForJNI(dispatchTo = "gecko")
     public static native void crash();
 
     @WrapForJNI
-    private static void requestUiThreadCallback(final long delay) {
+    private static void requestUiThreadCallback(long delay) {
         ThreadUtils.getUiHandler().postDelayed(UI_THREAD_CALLBACK, delay);
     }
 
     /**
      * Queue a call to the given static method until Gecko is in the RUNNING state.
      */
     public static void queueNativeCall(final Class<?> cls, final String methodName,
                                        final Object... args) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/HapticFeedbackDelegate.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/HapticFeedbackDelegate.java
@@ -1,15 +1,17 @@
 /* -*- Mode: Java; c-basic-offset: 4; 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/. */
 
 package org.mozilla.gecko;
 
+import android.view.HapticFeedbackConstants;
+
 /**
  * A <code>HapticFeedbackDelegate</code> is responsible for performing haptic feedback.
  */
 public interface HapticFeedbackDelegate {
     /**
      * Perform a haptic feedback effect. Called from the Gecko thread.
      *
      * @param effect Effect to perform from <code>android.view.HapticFeedbackConstants</code>.
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java
@@ -30,38 +30,37 @@ final public class InputMethods {
     public static final String METHOD_SONY = "com.sonyericsson.textinput.uxp/.glue.InputMethodServiceGlue";
     public static final String METHOD_SWIFTKEY = "com.touchtype.swiftkey/com.touchtype.KeyboardService";
     public static final String METHOD_SWYPE = "com.swype.android.inputmethod/.SwypeInputMethod";
     public static final String METHOD_SWYPE_BETA = "com.nuance.swype.input/.IME";
     public static final String METHOD_TOUCHPAL_KEYBOARD = "com.cootek.smartinputv5/com.cootek.smartinput5.TouchPalIME";
 
     private InputMethods() {}
 
-    public static String getCurrentInputMethod(final Context context) {
+    public static String getCurrentInputMethod(Context context) {
         String inputMethod = Secure.getString(context.getContentResolver(), Secure.DEFAULT_INPUT_METHOD);
         return (inputMethod != null ? inputMethod : "");
     }
 
-    public static InputMethodInfo getInputMethodInfo(final Context context,
-                                                     final String inputMethod) {
+    public static InputMethodInfo getInputMethodInfo(Context context, String inputMethod) {
         InputMethodManager imm = getInputMethodManager(context);
         Collection<InputMethodInfo> infos = imm.getEnabledInputMethodList();
         for (InputMethodInfo info : infos) {
             if (info.getId().equals(inputMethod)) {
                 return info;
             }
         }
         return null;
     }
 
-    public static InputMethodManager getInputMethodManager(final Context context) {
+    public static InputMethodManager getInputMethodManager(Context context) {
         return (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
     }
 
-    public static void restartInput(final Context context, final View view) {
+    public static void restartInput(Context context, View view) {
         final InputMethodManager imm = getInputMethodManager(context);
         if (imm != null) {
             imm.restartInput(view);
         }
     }
 
     public static boolean needsSoftResetWorkaround(final String inputMethod) {
         // Stock latin IME on Android 4.2 and above
@@ -84,16 +83,16 @@ final public class InputMethods {
                inputMethod.startsWith(METHOD_ATOK_OEM_PREFIX) ||
                METHOD_ATOK_OEM_SOFTBANK.equals(inputMethod);
     }
 
     public static boolean shouldCommitCharAsKey(final String inputMethod) {
         return METHOD_HTC_TOUCH_INPUT.equals(inputMethod);
     }
 
-    public static boolean needsRestartOnReplaceRemove(final Context context) {
+    public static boolean needsRestartOnReplaceRemove(Context context) {
         String inputMethod = getCurrentInputMethod(context);
         return METHOD_SONY.equals(inputMethod);
     }
 
     // TODO: Replace usages by definition in EditorInfoCompat once available (bug 1385726).
     public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 0x1000000;
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/NSSBridge.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/NSSBridge.java
@@ -11,39 +11,41 @@ import org.mozilla.gecko.annotation.Robo
 
 public class NSSBridge {
     private static final String LOGTAG = "NSSBridge";
 
     private static native String nativeEncrypt(String aDb, String aValue);
     private static native String nativeDecrypt(String aDb, String aValue);
 
     @RobocopTarget
-    static public String encrypt(final Context context, final String aValue) throws Exception {
+    static public String encrypt(Context context, String aValue)
+      throws Exception {
         GeckoLoader.loadNSSLibs(context);
 
         String path = GeckoProfile.get(context).getDir().toString();
         return nativeEncrypt(path, aValue);
     }
 
     @RobocopTarget
-    static public String encrypt(final Context context, final String profilePath,
-                                 final String aValue) throws Exception {
+    static public String encrypt(Context context, String profilePath, String aValue)
+      throws Exception {
         GeckoLoader.loadNSSLibs(context);
 
         return nativeEncrypt(profilePath, aValue);
     }
 
     @RobocopTarget
-    static public String decrypt(final Context context, final String aValue) throws Exception {
+    static public String decrypt(Context context, String aValue)
+      throws Exception {
         GeckoLoader.loadNSSLibs(context);
 
         String path = GeckoProfile.get(context).getDir().toString();
         return nativeDecrypt(path, aValue);
     }
 
     @RobocopTarget
-    static public String decrypt(final Context context, final String profilePath,
-                                 final String aValue) throws Exception {
+    static public String decrypt(Context context, String profilePath, String aValue)
+      throws Exception {
         GeckoLoader.loadNSSLibs(context);
 
         return nativeDecrypt(profilePath, aValue);
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/NativeQueue.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/NativeQueue.java
@@ -1,16 +1,18 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * vim: ts=4 sw=4 expandtab:
  * 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/. */
 
 package org.mozilla.gecko;
 
+import android.util.Log;
+
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 
 public class NativeQueue {
     private static final String LOGTAG = "GeckoNativeQueue";
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/NotificationListener.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/NotificationListener.java
@@ -1,16 +1,17 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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/. */
 
 package org.mozilla.gecko;
 
-public interface NotificationListener {
+public interface NotificationListener
+{
     void showNotification(String name, String cookie, String title, String text,
                           String host, String imageUrl);
 
     void showPersistentNotification(String name, String cookie, String title, String text,
                                     String host, String imageUrl, String data);
 
     void closeNotification(String name);
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/PrefsHelper.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/PrefsHelper.java
@@ -4,16 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.gecko.annotation.WrapForJNI;
 
 import android.support.v4.util.SimpleArrayMap;
+import android.util.Log;
+import android.util.SparseArray;
 
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 
 /**
  * Helper class to get/set gecko prefs.
@@ -202,27 +204,23 @@ public final class PrefsHelper {
         } else {
             GeckoThread.queueNativeCallUntil(
                     GeckoThread.State.PROFILE_READY, PrefsHelper.class, "nativeRemoveObserver",
                     String[].class, namesToUnobserve);
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    private static void callPrefHandler(final PrefHandler handler, final int originalType,
-                                        final String pref, final boolean originalBoolVal,
-                                        final int intVal, final String originalStrVal) {
+    private static void callPrefHandler(final PrefHandler handler, int type, final String pref,
+                                        boolean boolVal, int intVal, String strVal) {
+
         // Some Gecko preferences use integers or strings to reference state instead of
         // directly representing the value.  Since the Java UI uses the type to determine
         // which ui elements to show and how to handle them, we need to normalize these
         // preferences to the correct type.
-        int type = originalType;
-        String strVal = originalStrVal;
-        boolean boolVal = originalBoolVal;
-
         if (INT_TO_STRING_PREFS.contains(pref)) {
             type = PREF_STRING;
             strVal = String.valueOf(intVal);
         } else if (INT_TO_BOOL_PREFS.contains(pref)) {
             type = PREF_BOOL;
             boolVal = intVal == 1;
         }
 
@@ -281,29 +279,29 @@ public final class PrefsHelper {
         void prefValue(String pref, boolean value);
         void prefValue(String pref, int value);
         void prefValue(String pref, String value);
         void finish();
     }
 
     public static abstract class PrefHandlerBase implements PrefHandler {
         @Override
-        public void prefValue(final String pref, final boolean value) {
+        public void prefValue(String pref, boolean value) {
             throw new UnsupportedOperationException(
                     "Unhandled boolean pref " + pref + "; wrong type?");
         }
 
         @Override
-        public void prefValue(final String pref, final int value) {
+        public void prefValue(String pref, int value) {
             throw new UnsupportedOperationException(
                     "Unhandled int pref " + pref + "; wrong type?");
         }
 
         @Override
-        public void prefValue(final String pref, final String value) {
+        public void prefValue(String pref, String value) {
             throw new UnsupportedOperationException(
                     "Unhandled String pref " + pref + "; wrong type?");
         }
 
         @Override
         public void finish() {
         }
     }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
@@ -2,24 +2,26 @@
 /* vim: set ts=20 sts=4 et sw=4: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
+import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.Context;
 import android.os.Build;
 import android.speech.tts.TextToSpeech;
 import android.speech.tts.UtteranceProgressListener;
 import android.util.Log;
 
+import java.lang.System;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Set;
 import java.util.UUID;
 
 public class SpeechSynthesisService  {
     private static final String LOGTAG = "GeckoSpeechSynthesis";
@@ -30,17 +32,17 @@ public class SpeechSynthesisService  {
         if (sTTS != null) {
             return;
         }
 
         final Context ctx = GeckoAppShell.getApplicationContext();
 
         sTTS = new TextToSpeech(ctx, new TextToSpeech.OnInitListener() {
             @Override
-            public void onInit(final int status) {
+            public void onInit(int status) {
                 if (status != TextToSpeech.SUCCESS) {
                     Log.w(LOGTAG, "Failed to initialize TextToSpeech");
                     return;
                 }
 
                 setUtteranceListener();
                 registerVoicesByLocale();
             }
@@ -83,18 +85,17 @@ public class SpeechSynthesisService  {
 
     @WrapForJNI(dispatchTo = "gecko")
     private static native void registerVoice(String uri, String name, String locale, boolean isNetwork, boolean isDefault);
 
     @WrapForJNI(dispatchTo = "gecko")
     private static native void doneRegisteringVoices();
 
     @WrapForJNI(calledFrom = "gecko")
-    public static String speak(final String uri, final String text, final float rate,
-                               final float pitch, final float volume) {
+    public static String speak(final String uri, final String text, float rate, float pitch, float volume) {
         if (sTTS == null) {
             Log.w(LOGTAG, "TextToSpeech is not initialized");
             return null;
         }
 
         HashMap<String, String> params = new HashMap<String, String>();
         final String utteranceId = UUID.randomUUID().toString();
         params.put(TextToSpeech.Engine.KEY_PARAM_VOLUME, Float.toString(volume));
@@ -113,42 +114,41 @@ public class SpeechSynthesisService  {
     private static void setUtteranceListener() {
         if (sTTS == null) {
             Log.w(LOGTAG, "TextToSpeech is not initialized");
             return;
         }
 
         sTTS.setOnUtteranceProgressListener(new UtteranceProgressListener() {
             @Override
-            public void onDone(final String utteranceId) {
+            public void onDone(String utteranceId) {
                 dispatchEnd(utteranceId);
             }
 
             @Override
-            public void onError(final String utteranceId) {
+            public void onError(String utteranceId) {
                 dispatchError(utteranceId);
             }
 
             @Override
-            public void onStart(final String utteranceId) {
+            public void onStart(String utteranceId) {
                 dispatchStart(utteranceId);
             }
 
             @Override
-            public void onStop(final String utteranceId, final boolean interrupted) {
+            public void onStop(String utteranceId, boolean interrupted) {
                 if (interrupted) {
                     dispatchEnd(utteranceId);
                 } else {
                     // utterance isn't started yet.
                     dispatchError(utteranceId);
                 }
             }
 
-            public void onRangeStart(final String utteranceId, final int start, final int end,
-                                     final int frame) {
+            public void onRangeStart (String utteranceId, int start, int end, int frame) {
                 dispatchBoundary(utteranceId, start, end);
             }
         });
     }
 
     @WrapForJNI(dispatchTo = "gecko")
     private static native void dispatchStart(String utteranceId);
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SysInfo.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SysInfo.java
@@ -58,17 +58,17 @@ public final class SysInfo {
         try (StrictModeContext unused = StrictModeContext.allowDiskReads()) {
             return readCPUCount();
         }
     }
 
     private static int readCPUCount() {
         class CpuFilter implements FileFilter {
             @Override
-            public boolean accept(final File pathname) {
+            public boolean accept(File pathname) {
                 return Pattern.matches("cpu[0-9]+", pathname.getName());
             }
         }
         try {
             final File dir = new File("/sys/devices/system/cpu/");
             return cpuCount = dir.listFiles(new CpuFilter()).length;
         } catch (Exception e) {
             Log.w(LOG_TAG, "Assuming 1 CPU; got exception.", e);
@@ -76,18 +76,17 @@ public final class SysInfo {
         }
     }
 
     /**
      * Helper functions used to extract key/value data from /proc/meminfo
      * Pulled from:
      * http://androidxref.com/4.2_r1/xref/frameworks/base/core/java/com/android/internal/util/MemInfoReader.java
      */
-    private static boolean matchMemText(final byte[] buffer, final int index,
-                                        final int bufferLength, final byte[] text) {
+    private static boolean matchMemText(byte[] buffer, int index, int bufferLength, byte[] text) {
         final int N = text.length;
         if ((index + N) >= bufferLength) {
             return false;
         }
         for (int i = 0; i < N; i++) {
             if (buffer[index + i] != text[i]) {
                 return false;
             }
@@ -100,31 +99,32 @@ public final class SysInfo {
      *
      *  MemTotal: 1605324 kB
      *
      * into 1605324.
      *
      * @return the first uninterrupted sequence of digits following the
      *         specified index, parsed as an integer value in KB.
      */
-    private static int extractMemValue(final byte[] buffer, final int offset, final int length) {
+    private static int extractMemValue(byte[] buffer, int offset, int length) {
         if (offset >= length) {
             return 0;
         }
 
-        int i = offset;
-        while (i < length && buffer[i] != '\n') {
-            if (buffer[i] >= '0' && buffer[i] <= '9') {
-                int start = i++;
-                while (i < length && buffer[i] >= '0' && buffer[i] <= '9') {
-                    ++i;
+        while (offset < length && buffer[offset] != '\n') {
+            if (buffer[offset] >= '0' && buffer[offset] <= '9') {
+                int start = offset++;
+                while (offset < length &&
+                       buffer[offset] >= '0' &&
+                       buffer[offset] <= '9') {
+                    ++offset;
                 }
-                return Integer.parseInt(new String(buffer, start, i - start), 10);
+                return Integer.parseInt(new String(buffer, start, offset - start), 10);
             }
-            ++i;
+            ++offset;
         }
         return 0;
     }
 
     /**
      * Fetch the total memory of the device in MB by parsing /proc/meminfo.
      *
      * Of course, Android doesn't have a neat and tidy way to find total
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/TelemetryContract.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/TelemetryContract.java
@@ -115,25 +115,25 @@ public interface TelemetryContract {
 
         // VALUES BELOW THIS LINE ARE EXCLUSIVE TO TESTING.
         _TEST1("_test_event_1.1"),
         _TEST2("_test_event_2.1"),
         _TEST3("_test_event_3.1"),
         _TEST4("_test_event_4.1"),
         ;
 
-        private final String mString;
+        private final String string;
 
         Event(final String string) {
-            mString = string;
+            this.string = string;
         }
 
         @Override
         public String toString() {
-            return mString;
+            return string;
         }
     }
 
     /**
      * Holds event methods. Intended for use in
      * Telemetry.sendUIEvent() as the "method" parameter.
      *
      * Please keep this list sorted.
@@ -213,25 +213,25 @@ public interface TelemetryContract {
         // Action triggerred by pressing a SearchWidget button
         WIDGET("widget"),
 
         // VALUES BELOW THIS LINE ARE EXCLUSIVE TO TESTING.
         _TEST1("_test_method_1"),
         _TEST2("_test_method_2"),
         ;
 
-        private final String mString;
+        private final String string;
 
         Method(final String string) {
-            mString = string;
+            this.string = string;
         }
 
         @Override
         public String toString() {
-            return mString;
+            return string;
         }
     }
 
     /**
      * Holds session names. Intended for use with
      * Telemetry.startUISession() as the "sessionName" parameter.
      *
      * Please keep this list sorted.
@@ -267,25 +267,25 @@ public interface TelemetryContract {
         // Settings activity is active.
         SETTINGS("settings.1"),
 
         // VALUES BELOW THIS LINE ARE EXCLUSIVE TO TESTING.
         _TEST_STARTED_TWICE("_test_session_started_twice.1"),
         _TEST_STOPPED_TWICE("_test_session_stopped_twice.1"),
         ;
 
-        private final String mString;
+        private final String string;
 
         Session(final String string) {
-            mString = string;
+            this.string = string;
         }
 
         @Override
         public String toString() {
-            return mString;
+            return string;
         }
     }
 
     /**
      * Holds reasons for stopping a session. Intended for use in
      * Telemetry.stopUISession() as the "reason" parameter.
      *
      * Please keep this list sorted.
@@ -298,20 +298,20 @@ public interface TelemetryContract {
         NONE(null),
 
         // VALUES BELOW THIS LINE ARE EXCLUSIVE TO TESTING.
         _TEST1("_test_reason_1"),
         _TEST2("_test_reason_2"),
         _TEST_IGNORED("_test_reason_ignored"),
         ;
 
-        private final String mString;
+        private final String string;
 
         Reason(final String string) {
-            mString = string;
+            this.string = string;
         }
 
         @Override
         public String toString() {
-            return mString;
+            return string;
         }
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/TelemetryUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/TelemetryUtils.java
@@ -39,26 +39,26 @@ public class TelemetryUtils {
     }
 
     public static long realtime() {
         return SystemClock.elapsedRealtime();
     }
 
     // Define new histograms in:
     // toolkit/components/telemetry/Histograms.json
-    public static void addToHistogram(final String name, final int value) {
+    public static void addToHistogram(String name, int value) {
         if (GeckoThread.isRunning()) {
             nativeAddHistogram(name, value);
         } else {
             GeckoThread.queueNativeCall(TelemetryUtils.class, "nativeAddHistogram",
                                         String.class, name, value);
         }
     }
 
-    public static void addToKeyedHistogram(final String name, final String key, final int value) {
+    public static void addToKeyedHistogram(String name, String key, int value) {
         if (GeckoThread.isRunning()) {
             nativeAddKeyedHistogram(name, key, value);
         } else {
             GeckoThread.queueNativeCall(TelemetryUtils.class, "nativeAddKeyedHistogram",
                                         String.class, name, String.class, key, value);
         }
     }
 
@@ -66,27 +66,27 @@ public class TelemetryUtils {
         private final long mStartTime;
         private final String mName;
 
         private volatile boolean mHasFinished;
         private volatile long mElapsed = -1;
 
         protected abstract long now();
 
-        public Timer(final String name) {
+        public Timer(String name) {
             mName = name;
             mStartTime = now();
         }
 
         public void cancel() {
             mHasFinished = true;
         }
 
         public long getElapsed() {
-            return mElapsed;
+          return mElapsed;
         }
 
         public void stop() {
             // Only the first stop counts.
             if (mHasFinished) {
                 return;
             }
 
@@ -104,28 +104,28 @@ public class TelemetryUtils {
                 return;
             }
 
             addToHistogram(mName, (int) (elapsed));
         }
     }
 
     public static class RealtimeTimer extends Timer {
-        public RealtimeTimer(final String name) {
+        public RealtimeTimer(String name) {
             super(name);
         }
 
         @Override
         protected long now() {
             return TelemetryUtils.realtime();
         }
     }
 
     public static class UptimeTimer extends Timer {
-        public UptimeTimer(final String name) {
+        public UptimeTimer(String name) {
             super(name);
         }
 
         @Override
         protected long now() {
             return TelemetryUtils.uptime();
         }
     }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
@@ -23,51 +23,51 @@ public final class GeckoSurface extends 
     private volatile boolean mIsAvailable;
     private boolean mOwned = true;
 
     private int mMyPid;
     // Locally allocated surface/texture. Do not pass it over IPC.
     private GeckoSurface mSyncSurface;
 
     @WrapForJNI(exceptionMode = "nsresult")
-    public GeckoSurface(final GeckoSurfaceTexture gst) {
+    public GeckoSurface(GeckoSurfaceTexture gst) {
         super(gst);
         mHandle = gst.getHandle();
         mIsSingleBuffer = gst.isSingleBuffer();
         mIsAvailable = true;
         mMyPid = android.os.Process.myPid();
     }
 
-    public GeckoSurface(final Parcel p, final SurfaceTexture dummy) {
+    public GeckoSurface(Parcel p, SurfaceTexture dummy) {
         // A no-arg constructor exists, but is hidden in the SDK. We need to create a dummy
         // SurfaceTexture here in order to create the instance. This is used to transfer the
         // GeckoSurface across binder.
         super(dummy);
 
         readFromParcel(p);
         mHandle = p.readInt();
         mIsSingleBuffer = p.readByte() == 1 ? true : false;
         mIsAvailable = (p.readByte() == 1 ? true : false);
         mMyPid = p.readInt();
 
         dummy.release();
     }
 
     public static final Parcelable.Creator<GeckoSurface> CREATOR = new Parcelable.Creator<GeckoSurface>() {
-        public GeckoSurface createFromParcel(final Parcel p) {
+        public GeckoSurface createFromParcel(Parcel p) {
             return new GeckoSurface(p, new SurfaceTexture(0));
         }
 
-        public GeckoSurface[] newArray(final int size) {
+        public GeckoSurface[] newArray(int size) {
             return new GeckoSurface[size];
         }
     };
 
     @Override
-    public void writeToParcel(final Parcel out, final int flags) {
+    public void writeToParcel(Parcel out, int flags) {
         super.writeToParcel(out, flags);
         out.writeInt(mHandle);
         out.writeByte((byte) (mIsSingleBuffer ? 1 : 0));
         out.writeByte((byte) (mIsAvailable ? 1 : 0));
         out.writeInt(mMyPid);
 
         mOwned = false;
     }
@@ -94,25 +94,25 @@ public final class GeckoSurface extends 
     }
 
     @WrapForJNI
     public boolean getAvailable() {
         return mIsAvailable;
     }
 
     @WrapForJNI
-    public void setAvailable(final boolean available) {
+    public void setAvailable(boolean available) {
         mIsAvailable = available;
     }
 
     /* package */ boolean inProcess() {
         return android.os.Process.myPid() == mMyPid;
     }
 
-    /* package */ SyncConfig initSyncSurface(final int width, final int height) {
+    /* package */ SyncConfig initSyncSurface(int width, int height) {
         if (DEBUG_BUILD) {
             if (inProcess()) {
                 throw new AssertionError("no need for sync when allocated in process");
             }
         }
         if (GeckoSurfaceTexture.lookup(mHandle) != null) {
             throw new AssertionError("texture#" + mHandle + " already in use.");
         }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
@@ -35,39 +35,39 @@ import org.mozilla.gecko.mozglue.JNIObje
 
     private GeckoSurfaceTexture.Callbacks mListener;
     private AtomicInteger mUseCount;
     private boolean mFinalized;
 
     private int mUpstream;
     private NativeGLBlitHelper mBlitter;
 
-    private GeckoSurfaceTexture(final int handle) {
+    private GeckoSurfaceTexture(int handle) {
         super(0);
         init(handle, false);
     }
 
     @RequiresApi(api = Build.VERSION_CODES.KITKAT)
-    private GeckoSurfaceTexture(final int handle, final boolean singleBufferMode) {
+    private GeckoSurfaceTexture(int handle, boolean singleBufferMode) {
         super(0, singleBufferMode);
         init(handle, singleBufferMode);
     }
 
     @Override
     protected void finalize() throws Throwable {
         // We only want finalize() to be called once
         if (mFinalized) {
             return;
         }
 
         mFinalized = true;
         super.finalize();
     }
 
-    private void init(final int handle, final boolean singleBufferMode) {
+    private void init(int handle, boolean singleBufferMode) {
         mHandle = handle;
         mIsSingleBuffer = singleBufferMode;
         mUseCount = new AtomicInteger(1);
 
         // Start off detached
         detachFromGLContext();
     }
 
@@ -77,17 +77,17 @@ import org.mozilla.gecko.mozglue.JNIObje
     }
 
     @WrapForJNI
     public int getTexName() {
         return mTexName;
     }
 
     @WrapForJNI(exceptionMode = "nsresult")
-    public synchronized void attachToGLContext(final long context, final int texName) {
+    public synchronized void attachToGLContext(long context, int texName) {
         if (context == mAttachedContext && texName == mTexName) {
             return;
         }
 
         attachToGLContext(texName);
 
         mAttachedContext = context;
         mTexName = texName;
@@ -97,17 +97,17 @@ import org.mozilla.gecko.mozglue.JNIObje
     @WrapForJNI(exceptionMode = "nsresult")
     public synchronized void detachFromGLContext() {
         super.detachFromGLContext();
 
         mAttachedContext = mTexName = 0;
     }
 
     @WrapForJNI
-    public synchronized boolean isAttachedToGLContext(final long context) {
+    public synchronized boolean isAttachedToGLContext(long context) {
         return mAttachedContext == context;
     }
 
     @WrapForJNI
     public boolean isSingleBuffer() {
         return mIsSingleBuffer;
     }
 
@@ -155,17 +155,17 @@ import org.mozilla.gecko.mozglue.JNIObje
             if (mListener != null) {
                 mListener.onReleaseTexImage();
             }
         } catch (Exception e) {
             Log.w(LOGTAG, "releaseTexImage() failed", e);
         }
     }
 
-    public synchronized void setListener(final GeckoSurfaceTexture.Callbacks listener) {
+    public synchronized void setListener(GeckoSurfaceTexture.Callbacks listener) {
         mListener = listener;
     }
 
     @WrapForJNI
     public static boolean isSingleBufferSupported() {
         return Build.VERSION.SDK_INT >= 19;
     }
 
@@ -196,30 +196,30 @@ import org.mozilla.gecko.mozglue.JNIObje
                     sUnusedTextures.put(mAttachedContext, list);
                 }
                 list.addFirst(this);
             }
         }
     }
 
     @WrapForJNI
-    public static void destroyUnused(final long context) {
+    public static void destroyUnused(long context) {
         LinkedList<GeckoSurfaceTexture> list;
         synchronized (sUnusedTextures) {
             list = sUnusedTextures.remove(context);
         }
 
         if (list == null) {
             return;
         }
 
         for (GeckoSurfaceTexture tex : list) {
             try {
                 if (tex.isSingleBuffer()) {
-                    tex.releaseTexImage();
+                   tex.releaseTexImage();
                 }
 
                 tex.detachFromGLContext();
                 tex.release();
 
                 // We need to manually call finalize here, otherwise we can run out
                 // of file descriptors if the GC doesn't kick in soon enough. Bug 1416015.
                 try {
@@ -229,79 +229,77 @@ import org.mozilla.gecko.mozglue.JNIObje
                 }
             } catch (Exception e) {
                 Log.e(LOGTAG, "Failed to destroy SurfaceTexture", e);
             }
         }
     }
 
     @WrapForJNI
-    public static void detachAllFromGLContext(final long context) {
+    public static void detachAllFromGLContext(long context) {
         synchronized (sSurfaceTextures) {
             for (GeckoSurfaceTexture tex : sSurfaceTextures.values()) {
                 try {
                     if (tex.isAttachedToGLContext(context)) {
                         tex.detachFromGLContext();
                     }
                 } catch (Exception e) {
                     Log.e(LOGTAG, "Failed to detach SurfaceTexture with handle: " + tex.mHandle, e);
                 }
             }
         }
     }
 
-    public static GeckoSurfaceTexture acquire(final boolean singleBufferMode, final int handle) {
+    public static GeckoSurfaceTexture acquire(boolean singleBufferMode, int handle) {
         if (singleBufferMode && !isSingleBufferSupported()) {
             throw new IllegalArgumentException("single buffer mode not supported on API version < 19");
         }
 
         synchronized (sSurfaceTextures) {
             // We want to limit the maximum number of SurfaceTextures at any one time.
             // This is because they use a large number of fds, and once the process' limit
             // is reached bad things happen. See bug 1421586.
             if (sSurfaceTextures.size() >= MAX_SURFACE_TEXTURES) {
                 return null;
             }
 
-            int resolvedHandle = handle;
-            if (resolvedHandle == 0) {
+            if (handle == 0) {
                 // Generate new handle value when none specified.
-                resolvedHandle = sNextHandle++;
+                handle = sNextHandle++;
             }
 
             final GeckoSurfaceTexture gst;
             if (isSingleBufferSupported()) {
-                gst = new GeckoSurfaceTexture(resolvedHandle, singleBufferMode);
+                gst = new GeckoSurfaceTexture(handle, singleBufferMode);
             } else {
-                gst = new GeckoSurfaceTexture(resolvedHandle);
+                gst = new GeckoSurfaceTexture(handle);
             }
 
-            if (sSurfaceTextures.containsKey(resolvedHandle)) {
+            if (sSurfaceTextures.containsKey(handle)) {
                 gst.release();
                 throw new IllegalArgumentException("Already have a GeckoSurfaceTexture with that handle");
             }
 
-            sSurfaceTextures.put(resolvedHandle, gst);
+            sSurfaceTextures.put(handle, gst);
             return gst;
         }
     }
 
     @WrapForJNI
-    public static GeckoSurfaceTexture lookup(final int handle) {
+    public static GeckoSurfaceTexture lookup(int handle) {
         synchronized (sSurfaceTextures) {
             return sSurfaceTextures.get(handle);
         }
     }
 
-    /* package */ synchronized void track(final int upstream) {
+    /* package */ synchronized void track(int upstream) {
         mUpstream = upstream;
     }
 
-    /* package */ synchronized void configureSnapshot(final GeckoSurface target,
-                                                      final int width, final int height) {
+    /* package */ synchronized void configureSnapshot(GeckoSurface target, int width, int height) {
         mBlitter = NativeGLBlitHelper.create(mHandle, target, width, height);
     }
 
     /* package */ synchronized void takeSnapshot() {
         mBlitter.blit();
     }
 
     public interface Callbacks {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/StackScroller.java
@@ -29,17 +29,17 @@ import org.mozilla.gecko.annotation.Wrap
 
     private static float sViscousFluidScale;
     private static float sViscousFluidNormalize;
 
     /**
      * Creates an StackScroller with a viscous fluid scroll interpolator and flywheel.
      * @param context
      */
-    public StackScroller(final Context context) {
+    public StackScroller(Context context) {
         mFlywheel = true;
         mScrollerX = new SplineStackScroller(context);
         mScrollerY = new SplineStackScroller(context);
         initContants();
     }
 
     private static void initContants() {
         // This controls the viscous fluid effect (how much of it)
@@ -62,17 +62,17 @@ import org.mozilla.gecko.annotation.Wrap
     /**
      * Force the finished field to a particular value. Contrary to
      * {@link #abortAnimation()}, forcing the animation to finished
      * does NOT cause the scroller to move to the final x and y
      * position.
      *
      * @param finished The new finished value.
      */
-    public final void forceFinished(final boolean finished) {
+    public final void forceFinished(boolean finished) {
         mScrollerX.mFinished = mScrollerY.mFinished = finished;
     }
 
     /**
      * Returns the current X offset in the scroll.
      *
      * @return The new X offset as an absolute distance from the origin.
      */
@@ -115,38 +115,38 @@ import org.mozilla.gecko.annotation.Wrap
         return mScrollerY.mFinal;
     }
 
     /**
      * Sets where the scroll will end.  Valid only for "fling" scrolls.
      *
      * @param x The final X offset as an absolute distance from the origin.
      */
-    public final void setFinalX(final int x) {
+    public final void setFinalX(int x) {
         mScrollerX.setFinalPosition(x);
     }
 
-    private static float viscousFluid(final float x) {
-        float y = x * sViscousFluidScale;
-        if (y < 1.0f) {
-            y -= (1.0f - (float) Math.exp(-y));
+    private static float viscousFluid(float x) {
+        x *= sViscousFluidScale;
+        if (x < 1.0f) {
+            x -= (1.0f - (float) Math.exp(-x));
         } else {
             float start = 0.36787944117f; // 1/e == exp(-1)
-            y = 1.0f - (float) Math.exp(1.0f - y);
-            y = start + y * (1.0f - start);
+            x = 1.0f - (float) Math.exp(1.0f - x);
+            x = start + x * (1.0f - start);
         }
-        y *= sViscousFluidNormalize;
-        return y;
+        x *= sViscousFluidNormalize;
+        return x;
     }
 
     /**
      * Call this when you want to know the new location. If it returns true, the
      * animation is not yet finished.
      */
-    public boolean computeScrollOffset(final long time) {
+    public boolean computeScrollOffset(long time) {
         if (isFinished()) {
             return false;
         }
 
         switch (mMode) {
             case SCROLL_MODE:
                 // Any scroller can be used for time, since they were started
                 // together in scroll mode. We use X here.
@@ -197,18 +197,17 @@ import org.mozilla.gecko.annotation.Wrap
      * @param startY Starting vertical scroll offset in pixels. Positive numbers
      *        will scroll the content up.
      * @param dx Horizontal distance to travel. Positive numbers will scroll the
      *        content to the left.
      * @param dy Vertical distance to travel. Positive numbers will scroll the
      *        content up.
      * @param duration Duration of the scroll in milliseconds.
      */
-    public void startScroll(final int startX, final int startY, final int dx, final int dy,
-                            final long startTime, final int duration) {
+    public void startScroll(int startX, int startY, int dx, int dy, long startTime, int duration) {
         mMode = SCROLL_MODE;
         mScrollerX.startScroll(startX, dx, startTime, duration);
         mScrollerY.startScroll(startY, dy, startTime, duration);
     }
 
     /**
      * Call this when you want to 'spring back' into a valid coordinate range.
      *
@@ -217,18 +216,17 @@ import org.mozilla.gecko.annotation.Wrap
      * @param minX Minimum valid X value
      * @param maxX Maximum valid X value
      * @param minY Minimum valid Y value
      * @param maxY Minimum valid Y value
      * @return true if a springback was initiated, false if startX and startY were
      *          already within the valid range.
      */
     public boolean springBack(
-            final int startX, final int startY, final int minX, final int maxX, final int minY,
-            final int maxY, final long time) {
+            int startX, int startY, int minX, int maxX, int minY, int maxY, long time) {
         mMode = FLING_MODE;
 
         // Make sure both methods are called.
         final boolean spingbackX = mScrollerX.springback(startX, minX, maxX, time);
         final boolean spingbackY = mScrollerY.springback(startY, minY, maxY, time);
         return spingbackX || spingbackY;
     }
 
@@ -252,41 +250,37 @@ import org.mozilla.gecko.annotation.Wrap
      * @param maxY Maximum Y value. The scroller will not scroll past this point
      *            unless overY > 0. If overfling is allowed, it will use maxY as
      *            a springback boundary.
      * @param overX Overfling range. If > 0, horizontal overfling in either
      *            direction will be possible.
      * @param overY Overfling range. If > 0, vertical overfling in either
      *            direction will be possible.
      */
-    public void fling(final int startX, final int startY, final int velocityX, final int velocityY,
-                      final int minX, final int maxX, final int minY, final int maxY,
-                      final int overX, final int overY, final long time) {
-        int newVelocityX = velocityX;
-        int newVelocityY = velocityY;
-
+    public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX,
+            int minY, int maxY, int overX, int overY, long time) {
         // Continue a scroll or fling in progress
         if (mFlywheel && !isFinished()) {
             float oldVelocityX = mScrollerX.mCurrVelocity;
             float oldVelocityY = mScrollerY.mCurrVelocity;
-            boolean sameXDirection = (newVelocityX == 0) || (oldVelocityX == 0) ||
-                ((newVelocityX < 0) == (oldVelocityX < 0));
-            boolean sameYDirection = (newVelocityY == 0) || (oldVelocityY == 0) ||
-                ((newVelocityY < 0) == (oldVelocityY < 0));
+            boolean sameXDirection = (velocityX == 0) || (oldVelocityX == 0) ||
+                ((velocityX < 0) == (oldVelocityX < 0));
+            boolean sameYDirection = (velocityY == 0) || (oldVelocityY == 0) ||
+                ((velocityY < 0) == (oldVelocityY < 0));
             if (sameXDirection) {
-                newVelocityX += + oldVelocityX;
+                velocityX += oldVelocityX;
             }
             if (sameYDirection) {
-                newVelocityY += oldVelocityY;
+                velocityY += oldVelocityY;
             }
         }
 
         mMode = FLING_MODE;
-        mScrollerX.fling(startX, newVelocityX, minX, maxX, overX, time);
-        mScrollerY.fling(startY, newVelocityY, minY, maxY, overY, time);
+        mScrollerX.fling(startX, velocityX, minX, maxX, overX, time);
+        mScrollerY.fling(startY, velocityY, minY, maxY, overY, time);
     }
 
     /**
      * Stops the animation. Contrary to {@link #forceFinished(boolean)},
      * aborting the animating causes the scroller to move to the final x and y
      * positions.
      *
      * @see #forceFinished(boolean)
@@ -394,56 +388,55 @@ import org.mozilla.gecko.annotation.Wrap
                         yMin = y;
                     }
                 }
                 SPLINE_TIME[i] = coef * ((1.0f - y) * P1 + y * P2) + y * y * y;
             }
             SPLINE_POSITION[NB_SAMPLES] = SPLINE_TIME[NB_SAMPLES] = 1.0f;
         }
 
-        SplineStackScroller(final Context context) {
+        SplineStackScroller(Context context) {
             mFinished = true;
             final float ppi = context.getResources().getDisplayMetrics().density * 160.0f;
             mPhysicalCoeff = SensorManager.GRAVITY_EARTH // g (m/s^2)
                     * 39.37f // inch/meter
                     * ppi * 0.84f; // look and feel tuning
         }
 
-        void updateScroll(final float q) {
+        void updateScroll(float q) {
             mCurrentPosition = mStart + Math.round(q * (mFinal - mStart));
         }
 
         /*
          * Get a signed deceleration that will reduce the velocity.
          */
-        private static float getDeceleration(final int velocity) {
+        private static float getDeceleration(int velocity) {
             return velocity > 0 ? -GRAVITY : GRAVITY;
         }
 
         /*
          * Modifies mDuration to the duration it takes to get from start to newFinal using the
          * spline interpolation. The previous duration was needed to get to oldFinal.
          */
-        private void adjustDuration(final int start, final int oldFinal, final int newFinal) {
+        private void adjustDuration(int start, int oldFinal, int newFinal) {
             final int oldDistance = oldFinal - start;
             final int newDistance = newFinal - start;
             final float x = Math.abs((float) newDistance / oldDistance);
             final int index = (int) (NB_SAMPLES * x);
             if (index < NB_SAMPLES) {
                 final float xInf = (float) index / NB_SAMPLES;
                 final float xSup = (float) (index + 1) / NB_SAMPLES;
                 final float tInf = SPLINE_TIME[index];
                 final float tSup = SPLINE_TIME[index + 1];
                 final float timeCoef = tInf + (x - xInf) / (xSup - xInf) * (tSup - tInf);
                 mDuration *= timeCoef;
             }
         }
 
-        void startScroll(final int start, final int distance, final long startTime,
-                         final int duration) {
+        void startScroll(int start, int distance, long startTime, int duration) {
             mFinished = false;
 
             mStart = start;
             mFinal = start + distance;
 
             mStartTime = startTime;
             mDuration = duration;
 
@@ -455,22 +448,22 @@ import org.mozilla.gecko.annotation.Wrap
         void finish() {
             mCurrentPosition = mFinal;
             // Not reset since WebView relies on this value for fast fling.
             // TODO: restore when WebView uses the fast fling implemented in this class.
             // mCurrVelocity = 0.0f;
             mFinished = true;
         }
 
-        void setFinalPosition(final int position) {
+        void setFinalPosition(int position) {
             mFinal = position;
             mFinished = false;
         }
 
-        boolean springback(final int start, final int min, final int max, final long time) {
+        boolean springback(int start, int min, int max, long time) {
             mFinished = true;
 
             mStart = mFinal = start;
             mVelocity = 0;
 
             mStartTime = time;
             mDuration = 0;
 
@@ -478,32 +471,31 @@ import org.mozilla.gecko.annotation.Wrap
                 startSpringback(start, min, 0);
             } else if (start > max) {
                 startSpringback(start, max, 0);
             }
 
             return !mFinished;
         }
 
-        private void startSpringback(final int start, final int end, final int velocity) {
+        private void startSpringback(int start, int end, int velocity) {
             // mStartTime has been set
             mFinished = false;
             mState = CUBIC;
             mStart = start;
             mFinal = end;
             final int delta = start - end;
             mDeceleration = getDeceleration(delta);
             // TODO take velocity into account
             mVelocity = -delta; // only sign is used
             mOver = Math.abs(delta);
             mDuration = (int) (1000.0 * Math.sqrt(-2.0 * delta / mDeceleration));
         }
 
-        void fling(final int start, final int velocity, final int min, final int max,
-                   final int over, final long time) {
+        void fling(int start, int velocity, int min, int max, int over, long time) {
             mOver = over;
             mFinished = false;
             mCurrVelocity = mVelocity = velocity;
             mDuration = mSplineDuration = 0;
             mStartTime = time;
             mCurrentPosition = mStart = start;
 
             if (start > max || start < min) {
@@ -529,54 +521,53 @@ import org.mozilla.gecko.annotation.Wrap
             }
 
             if (mFinal > max) {
                 adjustDuration(mStart, mFinal, max);
                 mFinal = max;
             }
         }
 
-        private double getSplineDeceleration(final int velocity) {
+        private double getSplineDeceleration(int velocity) {
             return Math.log(INFLEXION * Math.abs(velocity) / (mFlingFriction * mPhysicalCoeff));
         }
 
-        private double getSplineFlingDistance(final int velocity) {
+        private double getSplineFlingDistance(int velocity) {
             final double l = getSplineDeceleration(velocity);
             final double decelMinusOne = DECELERATION_RATE - 1.0;
             return mFlingFriction * mPhysicalCoeff
                     * Math.exp(DECELERATION_RATE / decelMinusOne * l);
         }
 
         /* Returns the duration, expressed in milliseconds */
-        private int getSplineFlingDuration(final int velocity) {
+        private int getSplineFlingDuration(int velocity) {
             final double l = getSplineDeceleration(velocity);
             final double decelMinusOne = DECELERATION_RATE - 1.0;
             return (int) (1000.0 * Math.exp(l / decelMinusOne));
         }
 
-        private void fitOnBounceCurve(final int start, final int end, final int velocity) {
+        private void fitOnBounceCurve(int start, int end, int velocity) {
             // Simulate a bounce that started from edge
             final float durationToApex = -velocity / mDeceleration;
             final float distanceToApex = velocity * velocity / 2.0f / Math.abs(mDeceleration);
             final float distanceToEdge = Math.abs(end - start);
             final float totalDuration = (float) Math.sqrt(
                     2.0 * (distanceToApex + distanceToEdge) / Math.abs(mDeceleration));
             mStartTime -= (int) (1000.0f * (totalDuration - durationToApex));
             mStart = end;
             mVelocity = (int) (-mDeceleration * totalDuration);
         }
 
-        private void startBounceAfterEdge(final int start, final int end, final int velocity) {
+        private void startBounceAfterEdge(int start, int end, int velocity) {
             mDeceleration = getDeceleration(velocity == 0 ? start - end : velocity);
             fitOnBounceCurve(start, end, velocity);
             onEdgeReached();
         }
 
-        private void startAfterEdge(final int start, final int min, final int max,
-                                    final int velocity, final long time) {
+        private void startAfterEdge(int start, int min, int max, int velocity, long time) {
             if (start > min && start < max) {
                 Log.e("StackScroller", "startAfterEdge called from a valid position");
                 mFinished = true;
                 return;
             }
             final boolean positive = start > max;
             final int edge = positive ? max : min;
             final int overDistance = start - edge;
@@ -607,17 +598,17 @@ import org.mozilla.gecko.annotation.Wrap
             }
 
             mOver = (int) distance;
             mState = BALLISTIC;
             mFinal = mStart + (int) (mVelocity > 0 ? distance : -distance);
             mDuration = -(int) (1000.0f * mVelocity / mDeceleration);
         }
 
-        boolean continueWhenFinished(final long time) {
+        boolean continueWhenFinished(long time) {
             switch (mState) {
                 case SPLINE:
                     // Duration from start to null velocity
                     if (mDuration < mSplineDuration) {
                         // If the animation was clamped, we reached the edge
                         mStart = mFinal;
                         // TODO Better compute speed when edge was reached
                         mVelocity = (int) mCurrVelocity;
@@ -641,17 +632,17 @@ import org.mozilla.gecko.annotation.Wrap
             return true;
         }
 
         /*
          * Update the current position and velocity for current time. Returns
          * true if update has been done and false if animation duration has been
          * reached.
          */
-        boolean update(final long time) {
+        boolean update(long time) {
             final long currentTime = time - mStartTime;
 
             if (((mState == SPLINE) && (mSplineDuration <= 0)) ||
                     ((mState == CUBIC) && (mDuration <= 0))) {
                 return false;
             }
 
             if (currentTime > mDuration) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocator.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocator.java
@@ -34,18 +34,17 @@ import org.mozilla.gecko.GeckoAppShell;
 
         // FIXME: may not want to auto create
         if (!GeckoAppShell.getApplicationContext().bindService(intent, sConnection, Context.BIND_AUTO_CREATE)) {
             throw new Exception("Failed to connect to surface allocator service!");
         }
     }
 
     @WrapForJNI
-    public static GeckoSurface acquireSurface(final int width, final int height,
-                                              final boolean singleBufferMode) {
+    public static GeckoSurface acquireSurface(int width, int height, boolean singleBufferMode) {
         try {
             ensureConnection();
 
             if (singleBufferMode && !GeckoSurfaceTexture.isSingleBufferSupported()) {
                 return null;
             }
             ISurfaceAllocator allocator = sConnection.getAllocator();
             GeckoSurface surface = allocator.acquireSurface(width, height, singleBufferMode);
@@ -55,17 +54,17 @@ import org.mozilla.gecko.GeckoAppShell;
             return surface;
         } catch (Exception e) {
             Log.w(LOGTAG, "Failed to acquire GeckoSurface", e);
             return null;
         }
     }
 
     @WrapForJNI
-    public static void disposeSurface(final GeckoSurface surface) {
+    public static void disposeSurface(GeckoSurface surface) {
         try {
             ensureConnection();
         } catch (Exception e) {
             Log.w(LOGTAG, "Failed to dispose surface, no connection");
             return;
         }
 
         // Release the SurfaceTexture on the other side
@@ -78,17 +77,17 @@ import org.mozilla.gecko.GeckoAppShell;
         // And now our Surface
         try {
             surface.release();
         } catch (Exception e) {
             Log.w(LOGTAG, "Failed to release surface", e);
         }
     }
 
-    public static void sync(final int upstream) {
+    public static void sync(int upstream) {
         try {
             ensureConnection();
         } catch (Exception e) {
             Log.w(LOGTAG, "Failed to sync texture, no connection");
             return;
         }
 
         // Release the SurfaceTexture on the other side
@@ -108,20 +107,19 @@ import org.mozilla.gecko.GeckoAppShell;
                     this.wait();
                 } catch (InterruptedException e) { }
             }
 
             return mAllocator;
         }
 
         @Override
-        public synchronized void onServiceConnected(final ComponentName name,
-                                                    final IBinder service) {
+        public synchronized void onServiceConnected(ComponentName name, IBinder service) {
             mAllocator = ISurfaceAllocator.Stub.asInterface(service);
             this.notifyAll();
         }
 
         @Override
-        public synchronized void onServiceDisconnected(final ComponentName name) {
+        public synchronized void onServiceDisconnected(ComponentName name) {
             mAllocator = null;
         }
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocatorService.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocatorService.java
@@ -14,53 +14,52 @@ public final class SurfaceAllocatorServi
 
     private static final String LOGTAG = "SurfaceAllocatorService";
 
     public int onStartCommand(final Intent intent, final int flags, final int startId) {
         return Service.START_STICKY;
     }
 
     private Binder mBinder = new ISurfaceAllocator.Stub() {
-        public GeckoSurface acquireSurface(final int width, final int height,
-                                           final boolean singleBufferMode) {
+        public GeckoSurface acquireSurface(int width, int height, boolean singleBufferMode) {
             GeckoSurfaceTexture gst = GeckoSurfaceTexture.acquire(singleBufferMode, 0);
 
             if (gst == null) {
                 return null;
             }
 
             if (width > 0 && height > 0) {
                 gst.setDefaultBufferSize(width, height);
             }
 
             return new GeckoSurface(gst);
         }
 
-        public void releaseSurface(final int handle) {
+        public void releaseSurface(int handle) {
             final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(handle);
             if (gst != null) {
                 gst.decrementUse();
             }
         }
 
-        public void configureSync(final SyncConfig config) {
+        public void configureSync(SyncConfig config) {
             final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(config.sourceTextureHandle);
             if (gst != null) {
                 gst.configureSnapshot(config.targetSurface, config.width, config.height);
             }
         }
 
-        public void sync(final int handle) {
+        public void sync(int handle) {
             final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(handle);
             if (gst != null) {
                 gst.takeSnapshot();
             }
         }
     };
 
     public IBinder onBind(final Intent intent) {
         return mBinder;
     }
 
-    public boolean onUnbind(final Intent intent) {
+    public boolean onUnbind(Intent intent) {
         return false;
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceTextureListener.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceTextureListener.java
@@ -6,34 +6,35 @@
 package org.mozilla.gecko;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 
 import android.graphics.SurfaceTexture;
 
 /* package */ final class SurfaceTextureListener
-    extends JNIObject implements SurfaceTexture.OnFrameAvailableListener {
+    extends JNIObject implements SurfaceTexture.OnFrameAvailableListener
+{
     @WrapForJNI(calledFrom = "gecko")
     private SurfaceTextureListener() {
     }
 
     @WrapForJNI(dispatchTo = "gecko") @Override // JNIObject
     protected native void disposeNative();
 
     @Override
     protected void finalize() {
         disposeNative();
     }
 
     @WrapForJNI(stubName = "OnFrameAvailable")
     private native void nativeOnFrameAvailable();
 
     @Override // SurfaceTexture.OnFrameAvailableListener
-    public void onFrameAvailable(final SurfaceTexture surfaceTexture) {
+    public void onFrameAvailable(SurfaceTexture surfaceTexture) {
         try {
             nativeOnFrameAvailable();
         } catch (final NullPointerException e) {
             // Ignore exceptions caused by a disposed object, i.e.
             // getting a callback after this listener is no longer in use.
         }
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SyncConfig.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SyncConfig.java
@@ -4,51 +4,51 @@ import android.os.Parcel;
 import android.os.Parcelable;
 
 /* package */ final class SyncConfig implements Parcelable {
     final int sourceTextureHandle;
     final GeckoSurface targetSurface;
     final int width;
     final int height;
 
-    /* package */ SyncConfig(final int sourceTextureHandle,
-                             final GeckoSurface targetSurface,
-                             final int width,
-                             final int height) {
+    /* package */ SyncConfig(int sourceTextureHandle,
+                             GeckoSurface targetSurface,
+                             int width,
+                             int height) {
         this.sourceTextureHandle = sourceTextureHandle;
         this.targetSurface = targetSurface;
         this.width = width;
         this.height = height;
     }
 
     public static final Creator<SyncConfig> CREATOR =
         new Creator<SyncConfig>() {
             @Override
-            public SyncConfig createFromParcel(final Parcel parcel) {
+            public SyncConfig createFromParcel(Parcel parcel) {
                 return new SyncConfig(parcel);
             }
 
             @Override
-            public SyncConfig[] newArray(final int i) {
+            public SyncConfig[] newArray(int i) {
                 return new SyncConfig[i];
             }
         };
 
-    private SyncConfig(final Parcel parcel) {
+    private SyncConfig(Parcel parcel) {
         sourceTextureHandle = parcel.readInt();
         targetSurface = GeckoSurface.CREATOR.createFromParcel(parcel);
         width = parcel.readInt();
         height = parcel.readInt();
     }
 
     @Override
     public int describeContents() {
         return 0;
     }
 
     @Override
-    public void writeToParcel(final Parcel parcel, final int flags) {
+    public void writeToParcel(Parcel parcel, int flags) {
         parcel.writeInt(sourceTextureHandle);
         targetSurface.writeToParcel(parcel, flags);
         parcel.writeInt(width);
         parcel.writeInt(height);
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/VsyncSource.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/VsyncSource.java
@@ -40,30 +40,30 @@ import org.mozilla.gecko.GeckoAppShell;
             }
         });
     }
 
     @WrapForJNI(stubName = "NotifyVsync")
     private static native void nativeNotifyVsync();
 
     // Choreographer callback implementation.
-    public void doFrame(final long frameTimeNanos) {
+    public void doFrame(long frameTimeNanos) {
         if (mObservingVsync) {
             mChoreographer.postFrameCallback(this);
             nativeNotifyVsync();
         }
     }
 
     /**
      * Start/stop observing Vsync event.
      * @param enable true to start observing; false to stop.
      * @return true if observing and false if not.
      */
     @WrapForJNI
-    public synchronized boolean observeVsync(final boolean enable) {
+    public synchronized boolean observeVsync(boolean enable) {
         if (mObservingVsync != enable) {
             mObservingVsync = enable;
 
             if (mChoreographer != null) {
                 if (enable) {
                     mChoreographer.postFrameCallback(this);
                 } else {
                     mChoreographer.removeFrameCallback(this);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/AsyncCodecFactory.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/AsyncCodecFactory.java
@@ -4,16 +4,16 @@
 
 package org.mozilla.gecko.media;
 
 import android.os.Build;
 
 import java.io.IOException;
 
 public final class AsyncCodecFactory {
-    public static AsyncCodec create(final String name) throws IOException {
+    public static AsyncCodec create(String name) throws IOException {
         // A bug that getInputBuffer() could fail after flush() then start() wasn't fixed until MR1.
         // See: https://android.googlesource.com/platform/frameworks/av/+/d9e0603a1be07dbb347c55050c7d4629ea7492e8
         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
                ? new LollipopAsyncCodec(name)
                : new JellyBeanAsyncCodec(name);
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/BaseHlsPlayer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/BaseHlsPlayer.java
@@ -17,32 +17,32 @@ public interface BaseHlsPlayer {
 
     public enum ResourceError {
         BASE(-100),
         UNKNOWN(-101),
         PLAYER(-102),
         UNSUPPORTED(-103);
 
         private int mNumVal;
-        private ResourceError(final int numVal) {
+        private ResourceError(int numVal) {
             mNumVal = numVal;
         }
         public int code() {
             return mNumVal;
         }
     }
 
     public enum DemuxerError {
         BASE(-200),
         UNKNOWN(-201),
         PLAYER(-202),
         UNSUPPORTED(-203);
 
         private int mNumVal;
-        private DemuxerError(final int numVal) {
+        private DemuxerError(int numVal) {
             mNumVal = numVal;
         }
         public int code() {
             return mNumVal;
         }
     }
 
     public interface DemuxerCallbacks {
@@ -88,9 +88,9 @@ public interface BaseHlsPlayer {
 
     public void resume();
 
     public void play();
 
     public void pause();
 
     public void release();
-}
+}
\ No newline at end of file
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
@@ -15,46 +15,46 @@ import android.util.Log;
 import android.view.Surface;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
 
 import org.mozilla.gecko.gfx.GeckoSurface;
 
 /* package */ final class Codec extends ICodec.Stub implements IBinder.DeathRecipient {
     private static final String LOGTAG = "GeckoRemoteCodec";
     private static final boolean DEBUG = false;
 
     public enum Error {
         DECODE, FATAL
     }
 
     private final class Callbacks implements AsyncCodec.Callbacks {
         @Override
-        public void onInputBufferAvailable(final AsyncCodec codec, final int index) {
+        public void onInputBufferAvailable(AsyncCodec codec, int index) {
             mInputProcessor.onBuffer(index);
         }
 
         @Override
-        public void onOutputBufferAvailable(final AsyncCodec codec, final int index,
-                                            final MediaCodec.BufferInfo info) {
+        public void onOutputBufferAvailable(AsyncCodec codec, int index, MediaCodec.BufferInfo info) {
             mOutputProcessor.onBuffer(index, info);
         }
 
         @Override
-        public void onError(final AsyncCodec codec, final int error) {
+        public void onError(AsyncCodec codec, int error) {
             reportError(Error.FATAL, new Exception("codec error:" + error));
         }
 
         @Override
-        public void onOutputFormatChanged(final AsyncCodec codec, final MediaFormat format) {
+        public void onOutputFormatChanged(AsyncCodec codec, MediaFormat format) {
             mOutputProcessor.onFormatChanged(format);
         }
     }
 
     private static final class Input {
         public final Sample sample;
         public boolean reported;
 
@@ -65,23 +65,23 @@ import org.mozilla.gecko.gfx.GeckoSurfac
 
     private final class InputProcessor {
         private boolean mHasInputCapacitySet;
         private Queue<Integer> mAvailableInputBuffers = new LinkedList<>();
         private Queue<Sample> mDequeuedSamples = new LinkedList<>();
         private Queue<Input> mInputSamples = new LinkedList<>();
         private boolean mStopped;
 
-        private synchronized Sample onAllocate(final int size) {
+        private synchronized Sample onAllocate(int size) {
             Sample sample = mSamplePool.obtainInput(size);
             mDequeuedSamples.add(sample);
             return sample;
         }
 
-        private synchronized void onSample(final Sample sample) {
+        private synchronized void onSample(Sample sample) {
             if (sample == null) {
                 // Ignore empty input.
                 mSamplePool.recycleInput(mDequeuedSamples.remove());
                 Log.w(LOGTAG, "WARN: empty input sample");
                 return;
             }
 
             if (sample.isEOS()) {
@@ -92,30 +92,30 @@ import org.mozilla.gecko.gfx.GeckoSurfac
             Sample dequeued = mDequeuedSamples.remove();
             dequeued.info = sample.info;
             dequeued.cryptoInfo = sample.cryptoInfo;
             queueSample(dequeued);
 
             sample.dispose();
         }
 
-        private void queueSample(final Sample sample) {
+        private void queueSample(Sample sample) {
             if (!mInputSamples.offer(new Input(sample))) {
                 reportError(Error.FATAL, new Exception("FAIL: input sample queue is full"));
                 return;
             }
 
             try {
                 feedSampleToBuffer();
             } catch (Exception e) {
                 reportError(Error.FATAL, e);
             }
         }
 
-        private synchronized void onBuffer(final int index) {
+        private synchronized void onBuffer(int index) {
             if (mStopped || !isValidBuffer(index)) {
                 return;
             }
 
             if (!mHasInputCapacitySet) {
                 int capacity = mCodec.getInputBuffer(index).capacity();
                 if (capacity > 0) {
                     mSamplePool.setInputBufferSize(capacity);
@@ -130,19 +130,17 @@ import org.mozilla.gecko.gfx.GeckoSurfac
             }
 
         }
 
         private boolean isValidBuffer(final int index) {
             try {
                 return mCodec.getInputBuffer(index) != null;
             } catch (IllegalStateException e) {
-                if (DEBUG) {
-                    Log.d(LOGTAG, "invalid input buffer#" + index, e);
-                }
+                if (DEBUG) { Log.d(LOGTAG, "invalid input buffer#" + index, e); }
                 return false;
             }
         }
 
         private void feedSampleToBuffer() {
             while (!mAvailableInputBuffers.isEmpty() && !mInputSamples.isEmpty()) {
                 int index = mAvailableInputBuffers.poll();
                 int len = 0;
@@ -223,33 +221,33 @@ import org.mozilla.gecko.gfx.GeckoSurfac
             reset();
         }
     }
 
     private static final class Output {
         public final Sample sample;
         public final int index;
 
-        public Output(final Sample sample, final int index) {
+        public Output(final Sample sample, int index) {
             this.sample = sample;
             this.index = index;
         }
     }
 
     private class OutputProcessor {
         private final boolean mRenderToSurface;
         private boolean mHasOutputCapacitySet;
         private Queue<Output> mSentOutputs = new LinkedList<>();
         private boolean mStopped;
 
-        private OutputProcessor(final boolean renderToSurface) {
+        private OutputProcessor(boolean renderToSurface) {
             mRenderToSurface = renderToSurface;
         }
 
-        private synchronized void onBuffer(final int index, final MediaCodec.BufferInfo info) {
+        private synchronized void onBuffer(int index, MediaCodec.BufferInfo info) {
             if (mStopped || !isValidBuffer(index)) {
                 return;
             }
 
             try {
                 Sample output = obtainOutputSample(index, info);
                 mSentOutputs.add(new Output(output, index));
                 mCallbacks.onOutput(output);
@@ -263,24 +261,22 @@ import org.mozilla.gecko.gfx.GeckoSurfac
                 Log.d(LOGTAG, "output EOS");
             }
         }
 
         private boolean isValidBuffer(final int index) {
             try {
                 return (mCodec.getOutputBuffer(index) != null) || mRenderToSurface;
             } catch (IllegalStateException e) {
-                if (DEBUG) {
-                    Log.e(LOGTAG, "invalid buffer#" + index, e);
-                }
+                if (DEBUG) { Log.e(LOGTAG, "invalid buffer#" + index, e); }
                 return false;
             }
         }
 
-        private Sample obtainOutputSample(final int index, final MediaCodec.BufferInfo info) {
+        private Sample obtainOutputSample(int index, MediaCodec.BufferInfo info) {
             Sample sample = mSamplePool.obtainOutput(info);
 
             if (mRenderToSurface) {
                 return sample;
             }
 
             ByteBuffer output = mCodec.getOutputBuffer(index);
             if (!mHasOutputCapacitySet) {
@@ -297,31 +293,29 @@ import org.mozilla.gecko.gfx.GeckoSurfac
                 } catch (IOException e) {
                     Log.e(LOGTAG, "Fail to read output buffer:" + e.getMessage());
                 }
             }
 
             return sample;
         }
 
-        private synchronized void onRelease(final Sample sample, final boolean render) {
+        private synchronized void onRelease(Sample sample, boolean render) {
             final Output output = mSentOutputs.poll();
             if (output == null) {
-                if (DEBUG) {
-                    Log.d(LOGTAG, sample + " already released");
-                }
+                if (DEBUG) { Log.d(LOGTAG, sample + " already released"); }
                 return;
             }
             mCodec.releaseOutputBuffer(output.index, render);
             mSamplePool.recycleOutput(output.sample);
 
             sample.dispose();
         }
 
-        private void onFormatChanged(final MediaFormat format) {
+        private void onFormatChanged(MediaFormat format) {
             try {
                 mCallbacks.onOutputFormatChanged(new FormatParam(format));
             } catch (RemoteException re) {
                 // Dead recipient.
                 re.printStackTrace();
             }
         }
 
@@ -354,52 +348,48 @@ import org.mozilla.gecko.gfx.GeckoSurfac
     private InputProcessor mInputProcessor;
     private OutputProcessor mOutputProcessor;
     private SamplePool mSamplePool;
     // Values will be updated after configure called.
     private volatile boolean mIsAdaptivePlaybackSupported = false;
     private volatile boolean mIsHardwareAccelerated = false;
     private boolean mIsTunneledPlaybackSupported = false;
 
-    public synchronized void setCallbacks(final ICodecCallbacks callbacks) throws RemoteException {
+    public synchronized void setCallbacks(ICodecCallbacks callbacks) throws RemoteException {
         mCallbacks = callbacks;
         callbacks.asBinder().linkToDeath(this, 0);
     }
 
     // IBinder.DeathRecipient
     @Override
     public synchronized void binderDied() {
         Log.e(LOGTAG, "Callbacks is dead");
         try {
             release();
         } catch (RemoteException e) {
             // Nowhere to report the error.
         }
     }
 
     @Override
-    public synchronized boolean configure(final FormatParam format,
-                                          final GeckoSurface surface,
-                                          final int flags,
-                                          final String drmStubId) throws RemoteException {
+    public synchronized boolean configure(FormatParam format,
+                                          GeckoSurface surface,
+                                          int flags,
+                                          String drmStubId) throws RemoteException {
         if (mCallbacks == null) {
             Log.e(LOGTAG, "FAIL: callbacks must be set before calling configure()");
             return false;
         }
 
         if (mCodec != null) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "release existing codec: " + mCodec);
-            }
+            if (DEBUG) { Log.d(LOGTAG, "release existing codec: " + mCodec); }
             mCodec.release();
         }
 
-        if (DEBUG) {
-            Log.d(LOGTAG, "configure " + this);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "configure " + this); }
 
         final MediaFormat fmt = format.asFormat();
         final String mime = fmt.getString(MediaFormat.KEY_MIME);
         if (mime == null || mime.isEmpty()) {
             Log.e(LOGTAG, "invalid MIME type: " + mime);
             return false;
         }
 
@@ -414,19 +404,17 @@ import org.mozilla.gecko.gfx.GeckoSurfac
             mCodec = codec;
             mInputProcessor = new InputProcessor();
             final boolean renderToSurface = surface != null;
             mOutputProcessor = new OutputProcessor(renderToSurface);
             mSamplePool = new SamplePool(name, renderToSurface);
             if (renderToSurface) {
                 mIsTunneledPlaybackSupported = mCodec.isTunneledPlaybackSupported(mime);
             }
-            if (DEBUG) {
-                Log.d(LOGTAG, codec.toString() + " created. Render to surface?" + renderToSurface);
-            }
+            if (DEBUG) { Log.d(LOGTAG, codec.toString() + " created. Render to surface?" + renderToSurface); }
             return true;
         }
 
         return false;
     }
 
     private List<String> findMatchingCodecNames(final String mimeType, final boolean isEncoder) {
         final int numCodecs = MediaCodecList.getCodecCount();
@@ -474,19 +462,17 @@ import org.mozilla.gecko.gfx.GeckoSurfac
         }
     }
 
     private void setupAdaptivePlayback(final AsyncCodec codec, final MediaFormat format) {
         // Video decoder should config with adaptive playback capability.
         mIsAdaptivePlaybackSupported = codec.isAdaptivePlaybackSupported(
                 format.getString(MediaFormat.KEY_MIME));
         if (mIsAdaptivePlaybackSupported) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "codec supports adaptive playback  = " + mIsAdaptivePlaybackSupported);
-            }
+            if (DEBUG) { Log.d(LOGTAG, "codec supports adaptive playback  = " + mIsAdaptivePlaybackSupported); }
             // TODO: may need to find a way to not use hard code to decide the max w/h.
             format.setInteger(MediaFormat.KEY_MAX_WIDTH, 1920);
             format.setInteger(MediaFormat.KEY_MAX_HEIGHT, 1080);
         }
     }
 
     @Override
     public synchronized boolean isAdaptivePlaybackSupported() {
@@ -500,119 +486,109 @@ import org.mozilla.gecko.gfx.GeckoSurfac
 
     @Override
     public synchronized boolean isTunneledPlaybackSupported() {
         return mIsTunneledPlaybackSupported;
     }
 
     @Override
     public synchronized void start() throws RemoteException {
-        if (DEBUG) {
-            Log.d(LOGTAG, "start " + this);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "start " + this); }
         mInputProcessor.start();
         mOutputProcessor.start();
         try {
             mCodec.start();
         } catch (Exception e) {
             reportError(Error.FATAL, e);
         }
     }
 
-    private void reportError(final Error error, final Exception e) {
+    private void reportError(Error error, Exception e) {
         if (e != null) {
             e.printStackTrace();
         }
         try {
             mCallbacks.onError(error == Error.FATAL);
         } catch (NullPointerException ne) {
             // mCallbacks has been disposed by release().
         } catch (RemoteException re) {
             re.printStackTrace();
         }
     }
 
     @Override
     public synchronized void stop() throws RemoteException {
-        if (DEBUG) {
-            Log.d(LOGTAG, "stop " + this);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "stop " + this); }
         try {
             mInputProcessor.stop();
             mOutputProcessor.stop();
 
             mCodec.stop();
         } catch (Exception e) {
             reportError(Error.FATAL, e);
         }
     }
 
     @Override
     public synchronized void flush() throws RemoteException {
-        if (DEBUG) {
-            Log.d(LOGTAG, "flush " + this);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "flush " + this); }
         try {
             mInputProcessor.stop();
             mOutputProcessor.stop();
 
             mCodec.flush();
-            if (DEBUG) {
-                Log.d(LOGTAG, "flushed " + this);
-            }
+            if (DEBUG) { Log.d(LOGTAG, "flushed " + this); }
             mInputProcessor.start();
             mOutputProcessor.start();
             mCodec.resumeReceivingInputs();
         } catch (Exception e) {
             reportError(Error.FATAL, e);
         }
     }
 
     @Override
-    public synchronized Sample dequeueInput(final int size) throws RemoteException {
+    public synchronized Sample dequeueInput(int size) throws RemoteException {
         try {
             return mInputProcessor.onAllocate(size);
         } catch (Exception e) {
             // Translate allocation error to remote exception.
             throw new RemoteException(e.getMessage());
         }
     }
 
     @Override
-    public synchronized void queueInput(final Sample sample) throws RemoteException {
+    public synchronized void queueInput(Sample sample) throws RemoteException {
         try {
             mInputProcessor.onSample(sample);
         } catch (Exception e) {
             throw new RemoteException(e.getMessage());
         }
     }
 
     @Override
-    public synchronized void setRates(final int newBitRate) {
+    public synchronized void setRates(int newBitRate) {
         try {
             mCodec.setRates(newBitRate);
         } catch (Exception e) {
             reportError(Error.FATAL, e);
         }
     }
 
     @Override
-    public synchronized void releaseOutput(final Sample sample, final boolean render) {
+    public synchronized void releaseOutput(Sample sample, boolean render) {
         try {
             mOutputProcessor.onRelease(sample, render);
         } catch (Exception e) {
             reportError(Error.FATAL, e);
         }
     }
 
     @Override
     public synchronized void release() throws RemoteException {
-        if (DEBUG) {
-            Log.d(LOGTAG, "release " + this);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "release " + this); }
         try {
             // In case Codec.stop() is not called yet.
             mInputProcessor.stop();
             mOutputProcessor.stop();
 
             mCodec.release();
         } catch (Exception e) {
             reportError(Error.FATAL, e);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/CodecProxy.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/CodecProxy.java
@@ -6,16 +6,17 @@ package org.mozilla.gecko.media;
 
 import android.media.MediaCodec;
 import android.media.MediaCodec.BufferInfo;
 import android.media.MediaCodec.CryptoInfo;
 import android.media.MediaFormat;
 import android.os.DeadObjectException;
 import android.os.RemoteException;
 import android.util.Log;
+import android.view.Surface;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.gfx.GeckoSurface;
 import org.mozilla.gecko.mozglue.JNIObject;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Queue;
@@ -54,99 +55,96 @@ public final class CodecProxy {
             throw new UnsupportedOperationException();
         }
     }
 
     private class CallbacksForwarder extends ICodecCallbacks.Stub {
         private final Callbacks mCallbacks;
         private boolean mCodecProxyReleased;
 
-        CallbacksForwarder(final Callbacks callbacks) {
+        CallbacksForwarder(Callbacks callbacks) {
             mCallbacks = callbacks;
         }
 
         @Override
-        public synchronized void onInputQueued(final long timestamp) throws RemoteException {
+        public synchronized void onInputQueued(long timestamp) throws RemoteException {
             if (!mCodecProxyReleased) {
                 mCallbacks.onInputStatus(timestamp, true /* processed */);
             }
         }
 
         @Override
-        public synchronized void onInputPending(final long timestamp) throws RemoteException {
+        public synchronized void onInputPending(long timestamp) throws RemoteException {
             if (!mCodecProxyReleased) {
                 mCallbacks.onInputStatus(timestamp, false /* processed */);
             }
         }
 
         @Override
-        public synchronized void onOutputFormatChanged(final FormatParam format)
-                throws RemoteException {
+        public synchronized void onOutputFormatChanged(FormatParam format) throws RemoteException {
             if (!mCodecProxyReleased) {
                 mCallbacks.onOutputFormatChanged(format.asFormat());
             }
         }
 
         @Override
-        public synchronized void onOutput(final Sample sample) throws RemoteException {
+        public synchronized void onOutput(Sample sample) throws RemoteException {
             if (mCodecProxyReleased) {
                 sample.dispose();
                 return;
             }
             if (mOutputSurface != null) {
                 // Don't render to surface just yet. Callback will make that happen when it's time.
                 mSurfaceOutputs.offer(sample);
             }
             mCallbacks.onOutput(sample);
         }
 
         @Override
-        public void onError(final boolean fatal) throws RemoteException {
+        public void onError(boolean fatal) throws RemoteException {
             reportError(fatal);
         }
 
-        private synchronized void reportError(final boolean fatal) {
+        private synchronized void reportError(boolean fatal) {
             if (!mCodecProxyReleased) {
                 mCallbacks.onError(fatal);
             }
         }
 
         private synchronized void setCodecProxyReleased() {
             mCodecProxyReleased = true;
         }
     }
 
     @WrapForJNI
-    public static CodecProxy create(final boolean isEncoder,
-                                    final MediaFormat format,
-                                    final GeckoSurface surface,
-                                    final Callbacks callbacks,
-                                    final String drmStubId) {
+    public static CodecProxy create(boolean isEncoder,
+                                    MediaFormat format,
+                                    GeckoSurface surface,
+                                    Callbacks callbacks,
+                                    String drmStubId) {
         return RemoteManager.getInstance().createCodec(isEncoder, format, surface, callbacks, drmStubId);
     }
 
-    public static CodecProxy createCodecProxy(final boolean isEncoder,
-                                              final MediaFormat format,
-                                              final GeckoSurface surface,
-                                              final Callbacks callbacks,
-                                              final String drmStubId) {
+    public static CodecProxy createCodecProxy(boolean isEncoder,
+                                              MediaFormat format,
+                                              GeckoSurface surface,
+                                              Callbacks callbacks,
+                                              String drmStubId) {
         return new CodecProxy(isEncoder, format, surface, callbacks, drmStubId);
     }
 
-    private CodecProxy(final boolean isEncoder, final MediaFormat format,
-                       final GeckoSurface surface, final Callbacks callbacks,
-                       final String drmStubId) {
+    private CodecProxy(boolean isEncoder, MediaFormat format, GeckoSurface surface, Callbacks callbacks, String drmStubId) {
         mIsEncoder = isEncoder;
         mFormat = new FormatParam(format);
         mOutputSurface = surface;
         mRemoteDrmStubId = drmStubId;
         mCallbacks = new CallbacksForwarder(callbacks);
     }
 
-    boolean init(final ICodec remote) {
+    boolean init(ICodec remote) {
         try {
             remote.setCallbacks(mCallbacks);
             if (!remote.configure(mFormat, mOutputSurface, mIsEncoder ? MediaCodec.CONFIGURE_FLAG_ENCODE : 0, mRemoteDrmStubId)) {
                 return false;
             }
             remote.start();
         } catch (RemoteException e) {
             e.printStackTrace();
@@ -165,60 +163,62 @@ public final class CodecProxy {
             return true;
         } catch (RemoteException e) {
             e.printStackTrace();
             return false;
         }
     }
 
     @WrapForJNI
-    public synchronized boolean isAdaptivePlaybackSupported() {
-        if (mRemote == null) {
-            Log.e(LOGTAG, "cannot check isAdaptivePlaybackSupported with an ended codec");
-            return false;
-        }
-        try {
+    public synchronized boolean isAdaptivePlaybackSupported()
+    {
+      if (mRemote == null) {
+          Log.e(LOGTAG, "cannot check isAdaptivePlaybackSupported with an ended codec");
+          return false;
+      }
+      try {
             return mRemote.isAdaptivePlaybackSupported();
         } catch (RemoteException e) {
             e.printStackTrace();
             return false;
         }
     }
 
     @WrapForJNI
-    public synchronized boolean isHardwareAccelerated() {
-        if (mRemote == null) {
-            Log.e(LOGTAG, "cannot check isHardwareAccelerated with an ended codec");
-            return false;
-        }
-        try {
+    public synchronized boolean isHardwareAccelerated()
+    {
+      if (mRemote == null) {
+          Log.e(LOGTAG, "cannot check isHardwareAccelerated with an ended codec");
+          return false;
+      }
+      try {
             return mRemote.isHardwareAccelerated();
         } catch (RemoteException e) {
             e.printStackTrace();
             return false;
         }
     }
 
     @WrapForJNI
-    public synchronized boolean isTunneledPlaybackSupported() {
-        if (mRemote == null) {
-            Log.e(LOGTAG, "cannot check isTunneledPlaybackSupported with an ended codec");
-            return false;
-        }
-        try {
+    public synchronized boolean isTunneledPlaybackSupported()
+    {
+      if (mRemote == null) {
+          Log.e(LOGTAG, "cannot check isTunneledPlaybackSupported with an ended codec");
+          return false;
+      }
+      try {
             return mRemote.isTunneledPlaybackSupported();
         } catch (RemoteException e) {
             e.printStackTrace();
             return false;
         }
     }
 
     @WrapForJNI
-    public synchronized boolean input(final ByteBuffer bytes, final BufferInfo info,
-                                      final CryptoInfo cryptoInfo) {
+    public synchronized boolean input(ByteBuffer bytes, BufferInfo info, CryptoInfo cryptoInfo) {
         if (mRemote == null) {
             Log.e(LOGTAG, "cannot send input to an ended codec");
             return false;
         }
 
         boolean eos = info.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM;
 
         if (eos) {
@@ -232,17 +232,17 @@ public final class CodecProxy {
         } catch (IOException e) {
             Log.e(LOGTAG, "fail to copy input data.", e);
             // Balance dequeue/queue.
             sendInput(null);
         }
         return false;
     }
 
-    private boolean sendInput(final Sample sample) {
+    private boolean sendInput(Sample sample) {
         try {
             mRemote.queueInput(sample);
             if (sample != null) {
                 sample.dispose();
                 mFlushed = false;
             }
         } catch (Exception e) {
             Log.e(LOGTAG, "fail to queue input:" + sample, e);
@@ -257,19 +257,17 @@ public final class CodecProxy {
         if (mFlushed) {
             return true;
         }
         if (mRemote == null) {
             Log.e(LOGTAG, "cannot flush an ended codec");
             return false;
         }
         try {
-            if (DEBUG) {
-                Log.d(LOGTAG, "flush " + this);
-            }
+            if (DEBUG) { Log.d(LOGTAG, "flush " + this); }
             mRemote.flush();
             mFlushed = true;
         } catch (DeadObjectException e) {
             return false;
         } catch (RemoteException e) {
             e.printStackTrace();
             return false;
         }
@@ -279,19 +277,17 @@ public final class CodecProxy {
     @WrapForJNI
     public boolean release() {
         mCallbacks.setCodecProxyReleased();
         synchronized (this) {
             if (mRemote == null) {
                 Log.w(LOGTAG, "codec already ended");
                 return true;
             }
-            if (DEBUG) {
-                Log.d(LOGTAG, "release " + this);
-            }
+            if (DEBUG) { Log.d(LOGTAG, "release " + this); }
 
             if (!mSurfaceOutputs.isEmpty()) {
                 // Flushing output buffers to surface may cause some frames to be skipped and
                 // should not happen unless caller release codec before processing all buffers.
                 Log.w(LOGTAG, "release codec when " + mSurfaceOutputs.size() + " output buffers unhandled");
                 try {
                     for (Sample s : mSurfaceOutputs) {
                         mRemote.releaseOutput(s, true);
@@ -310,17 +306,17 @@ public final class CodecProxy {
                 e.printStackTrace();
                 return false;
             }
             return true;
         }
     }
 
     @WrapForJNI
-    public synchronized boolean setRates(final int newBitRate) {
+    public synchronized boolean setRates(int newBitRate) {
         if (!mIsEncoder) {
             Log.w(LOGTAG, "this api is encoder-only");
             return false;
         }
 
         if (android.os.Build.VERSION.SDK_INT < 19) {
             Log.w(LOGTAG, "this api was added in API level 19");
             return false;
@@ -336,17 +332,17 @@ public final class CodecProxy {
         } catch (RemoteException e) {
             Log.e(LOGTAG, "remote fail to set rates:" + newBitRate);
             e.printStackTrace();
         }
         return true;
     }
 
     @WrapForJNI
-    public synchronized boolean releaseOutput(final Sample sample, final boolean render) {
+    public synchronized boolean releaseOutput(Sample sample, boolean render) {
         if (mOutputSurface != null) {
             if (!mSurfaceOutputs.remove(sample)) {
                 if (mRemote != null) Log.w(LOGTAG, "already released: " + sample);
                 return true;
             }
 
             if (DEBUG && !render) {
                 Log.d(LOGTAG, "drop output:" + sample.info.presentationTimeUs);
@@ -365,12 +361,12 @@ public final class CodecProxy {
             Log.e(LOGTAG, "remote fail to release output:" + sample.info.presentationTimeUs);
             e.printStackTrace();
         }
         sample.dispose();
 
         return true;
     }
 
-    /* package */ void reportError(final boolean fatal) {
+    /* package */ void reportError(boolean fatal) {
         mCallbacks.reportError(fatal);
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/FormatParam.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/FormatParam.java
@@ -34,48 +34,48 @@ public final class FormatParam implement
     private static final String KEY_CONFIG_1 = "csd-1";
 
     private MediaFormat mFormat;
 
     public MediaFormat asFormat() {
         return mFormat;
     }
 
-    public FormatParam(final MediaFormat format) {
+    public FormatParam(MediaFormat format) {
         mFormat = format;
     }
 
-    protected FormatParam(final Parcel in) {
+    protected FormatParam(Parcel in) {
         mFormat = new MediaFormat();
         readFromParcel(in);
     }
 
     public static final Creator<FormatParam> CREATOR = new Creator<FormatParam>() {
         @Override
-        public FormatParam createFromParcel(final Parcel in) {
+        public FormatParam createFromParcel(Parcel in) {
             return new FormatParam(in);
         }
 
         @Override
-        public FormatParam[] newArray(final int size) {
+        public FormatParam[] newArray(int size) {
             return new FormatParam[size];
         }
     };
 
     @Override
     public int describeContents() {
         return 0;
     }
 
-    public void readFromParcel(final Parcel in) {
+    public void readFromParcel(Parcel in) {
         Bundle bundle = in.readBundle();
         fromBundle(bundle);
     }
 
-    private void fromBundle(final Bundle bundle) {
+    private void fromBundle(Bundle bundle) {
         if (bundle.containsKey(MediaFormat.KEY_MIME)) {
             mFormat.setString(MediaFormat.KEY_MIME,
                     bundle.getString(MediaFormat.KEY_MIME));
         }
         if (bundle.containsKey(MediaFormat.KEY_WIDTH)) {
             mFormat.setInteger(MediaFormat.KEY_WIDTH,
                     bundle.getInt(MediaFormat.KEY_WIDTH));
         }
@@ -117,17 +117,17 @@ public final class FormatParam implement
         }
         if (bundle.containsKey(MediaFormat.KEY_I_FRAME_INTERVAL)) {
             mFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,
                     bundle.getInt(MediaFormat.KEY_I_FRAME_INTERVAL));
         }
     }
 
     @Override
-    public void writeToParcel(final Parcel dest, final int flags) {
+    public void writeToParcel(Parcel dest, int flags) {
         dest.writeBundle(toBundle());
     }
 
     private Bundle toBundle() {
         Bundle bundle = new Bundle();
         if (mFormat.containsKey(MediaFormat.KEY_MIME)) {
             bundle.putString(MediaFormat.KEY_MIME, mFormat.getString(MediaFormat.KEY_MIME));
         }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoAudioInfo.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoAudioInfo.java
@@ -1,29 +1,29 @@
 /* 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/. */
 
 package org.mozilla.gecko.media;
 
+import java.nio.ByteBuffer;
 import org.mozilla.gecko.annotation.WrapForJNI;
 
 //A subset of the class AudioInfo in dom/media/MediaInfo.h
 @WrapForJNI
 public final class GeckoAudioInfo {
     final public byte[] codecSpecificData;
     final public int rate;
     final public int channels;
     final public int bitDepth;
     final public int profile;
     final public long duration;
     final public String mimeType;
-    public GeckoAudioInfo(final int rate, final int channels, final int bitDepth, final int profile,
-                          final long duration, final String mimeType,
-                          final byte[] codecSpecificData) {
+    public GeckoAudioInfo(int rate, int channels, int bitDepth, int profile,
+                          long duration, String mimeType, byte[] codecSpecificData) {
         this.rate = rate;
         this.channels = channels;
         this.bitDepth = bitDepth;
         this.profile = profile;
         this.duration = duration;
         this.mimeType = mimeType;
         this.codecSpecificData = codecSpecificData;
     }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSDemuxerWrapper.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSDemuxerWrapper.java
@@ -19,27 +19,29 @@ public final class GeckoHLSDemuxerWrappe
 
     // NOTE : These TRACK definitions should be synced with Gecko.
     public enum TrackType {
         UNDEFINED(0),
         AUDIO(1),
         VIDEO(2),
         TEXT(3);
         private int mType;
-        private TrackType(final int type) {
+        private TrackType(int type) {
             mType = type;
         }
         public int value() {
             return mType;
         }
     }
 
     private BaseHlsPlayer mPlayer = null;
 
-    public static class Callbacks extends JNIObject implements BaseHlsPlayer.DemuxerCallbacks {
+    public static class Callbacks extends JNIObject
+    implements BaseHlsPlayer.DemuxerCallbacks {
+
         @WrapForJNI(calledFrom = "gecko")
         Callbacks() {}
 
         @Override
         @WrapForJNI
         public native void onInitialized(boolean hasAudio, boolean hasVideo);
 
         @Override
@@ -47,23 +49,23 @@ public final class GeckoHLSDemuxerWrappe
         public native void onError(int errorCode);
 
         @Override // JNIObject
         protected void disposeNative() {
             throw new UnsupportedOperationException();
         }
     } // Callbacks
 
-    private static void assertTrue(final boolean condition) {
+    private static void assertTrue(boolean condition) {
         if (DEBUG && !condition) {
             throw new AssertionError("Expected condition to be true");
         }
     }
 
-    private BaseHlsPlayer.TrackType getPlayerTrackType(final int trackType) {
+    private BaseHlsPlayer.TrackType getPlayerTrackType(int trackType) {
         if (trackType == TrackType.AUDIO.value()) {
             return BaseHlsPlayer.TrackType.AUDIO;
         } else if (trackType == TrackType.VIDEO.value()) {
             return BaseHlsPlayer.TrackType.VIDEO;
         } else if (trackType == TrackType.TEXT.value()) {
             return BaseHlsPlayer.TrackType.TEXT;
         }
         return BaseHlsPlayer.TrackType.UNDEFINED;
@@ -71,69 +73,68 @@ public final class GeckoHLSDemuxerWrappe
 
     @WrapForJNI
     public long getBuffered() {
         assertTrue(mPlayer != null);
         return mPlayer.getBufferedPosition();
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    public static GeckoHLSDemuxerWrapper create(final int id,
-                                                final BaseHlsPlayer.DemuxerCallbacks callback) {
+    public static GeckoHLSDemuxerWrapper create(int id, BaseHlsPlayer.DemuxerCallbacks callback) {
         return new GeckoHLSDemuxerWrapper(id, callback);
     }
 
     @WrapForJNI
-    public int getNumberOfTracks(final int trackType) {
+    public int getNumberOfTracks(int trackType) {
         assertTrue(mPlayer != null);
         int tracks = mPlayer.getNumberOfTracks(getPlayerTrackType(trackType));
         if (DEBUG) Log.d(LOGTAG, "[GetNumberOfTracks] type : " + trackType + ", num = " + tracks);
         return tracks;
     }
 
     @WrapForJNI
-    public GeckoAudioInfo getAudioInfo(final int index) {
+    public GeckoAudioInfo getAudioInfo(int index) {
         assertTrue(mPlayer != null);
         if (DEBUG) Log.d(LOGTAG, "[getAudioInfo] formatIndex : " + index);
         GeckoAudioInfo aInfo = mPlayer.getAudioInfo(index);
         return aInfo;
     }
 
     @WrapForJNI
-    public GeckoVideoInfo getVideoInfo(final int index) {
+    public GeckoVideoInfo getVideoInfo(int index) {
         assertTrue(mPlayer != null);
         if (DEBUG) Log.d(LOGTAG, "[getVideoInfo] formatIndex : " + index);
         GeckoVideoInfo vInfo = mPlayer.getVideoInfo(index);
         return vInfo;
     }
 
     @WrapForJNI
-    public boolean seek(final long seekTime) {
+    public boolean seek(long seekTime) {
         // seekTime : microseconds.
         assertTrue(mPlayer != null);
         if (DEBUG) Log.d(LOGTAG, "seek  : " + seekTime + " (Us)");
         return mPlayer.seek(seekTime);
     }
 
-    GeckoHLSDemuxerWrapper(final int id, final BaseHlsPlayer.DemuxerCallbacks callback) {
+    GeckoHLSDemuxerWrapper(int id, BaseHlsPlayer.DemuxerCallbacks callback) {
         if (DEBUG) Log.d(LOGTAG, "Constructing GeckoHLSDemuxerWrapper ...");
         assertTrue(callback != null);
         try {
             mPlayer = GeckoPlayerFactory.getPlayer(id);
             if (mPlayer != null) {
                 mPlayer.addDemuxerWrapperCallbackListener(callback);
             }
         } catch (Exception e) {
             Log.e(LOGTAG, "Constructing GeckoHLSDemuxerWrapper ... error", e);
             callback.onError(BaseHlsPlayer.DemuxerError.UNKNOWN.code());
         }
     }
 
     @WrapForJNI
-    private GeckoHLSSample[] getSamples(final int mediaType, final int number) {
+    private GeckoHLSSample[] getSamples(int mediaType, int number) {
         assertTrue(mPlayer != null);
         ConcurrentLinkedQueue<GeckoHLSSample> samples = null;
         // getA/VSamples will always return a non-null instance.
         samples = mPlayer.getSamples(getPlayerTrackType(mediaType), number);
         assertTrue(samples.size() <= number);
         return samples.toArray(new GeckoHLSSample[samples.size()]);
     }
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSResourceWrapper.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSResourceWrapper.java
@@ -11,17 +11,18 @@ import org.mozilla.gecko.annotation.Wrap
 import org.mozilla.gecko.mozglue.JNIObject;
 
 public class GeckoHLSResourceWrapper {
     private static final String LOGTAG = "GeckoHLSResourceWrapper";
     private static final boolean DEBUG = !BuildConfig.MOZILLA_OFFICIAL;
     private BaseHlsPlayer mPlayer = null;
     private boolean mDestroy = false;
 
-    public static class Callbacks extends JNIObject implements BaseHlsPlayer.ResourceCallbacks {
+    public static class Callbacks extends JNIObject
+    implements BaseHlsPlayer.ResourceCallbacks {
         @WrapForJNI(calledFrom = "gecko")
         Callbacks() {}
 
         @Override
         @WrapForJNI
         public native void onDataArrived();
 
         @Override
@@ -29,33 +30,33 @@ public class GeckoHLSResourceWrapper {
         public native void onError(int errorCode);
 
         @Override // JNIObject
         protected void disposeNative() {
             throw new UnsupportedOperationException();
         }
     } // Callbacks
 
-    private GeckoHLSResourceWrapper(final String url,
-                                    final BaseHlsPlayer.ResourceCallbacks callback) {
+    private GeckoHLSResourceWrapper(String url,
+                                    BaseHlsPlayer.ResourceCallbacks callback) {
         if (DEBUG) Log.d(LOGTAG, "GeckoHLSResourceWrapper created with url = " + url);
         assertTrue(callback != null);
 
         mPlayer = GeckoPlayerFactory.getPlayer();
         try {
             mPlayer.init(url, callback);
         } catch (Exception e) {
             Log.e(LOGTAG, "Failed to create GeckoHlsResourceWrapper !", e);
             callback.onError(BaseHlsPlayer.ResourceError.UNKNOWN.code());
         }
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    public static GeckoHLSResourceWrapper create(final String url,
-                                                 final BaseHlsPlayer.ResourceCallbacks callback) {
+    public static GeckoHLSResourceWrapper create(String url,
+                                                 BaseHlsPlayer.ResourceCallbacks callback) {
         return new GeckoHLSResourceWrapper(url, callback);
     }
 
     @WrapForJNI(calledFrom = "gecko")
     public int getPlayerId() {
         // GeckoHLSResourceWrapper should always be created before others
         assertTrue(!mDestroy);
         assertTrue(mPlayer != null);
@@ -89,17 +90,17 @@ public class GeckoHLSResourceWrapper {
     @WrapForJNI(calledFrom = "gecko")
     public void pause() {
         if (DEBUG) Log.d(LOGTAG, "GeckoHLSResourceWrapper mediaelement paused");
         if (mPlayer != null) {
             mPlayer.pause();
         }
     }
 
-    private static void assertTrue(final boolean condition) {
+    private static void assertTrue(boolean condition) {
         if (DEBUG && !condition) {
             throw new AssertionError("Expected condition to be true");
         }
     }
 
     @WrapForJNI // Called when native object is mDestroy.
     private void destroy() {
         if (DEBUG) Log.d(LOGTAG, "destroy!! Native object is destroyed.");
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSSample.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSSample.java
@@ -29,45 +29,45 @@ public final class GeckoHLSSample {
     public long duration;
 
     @WrapForJNI
     final public BufferInfo info;
 
     @WrapForJNI
     final public CryptoInfo cryptoInfo;
 
-    private ByteBuffer mBuffer = null;
+    private ByteBuffer buffer = null;
 
     @WrapForJNI
-    public void writeToByteBuffer(final ByteBuffer dest) throws IOException {
-        if (mBuffer != null && dest != null && info.size > 0) {
-            dest.put(mBuffer);
+    public void writeToByteBuffer(ByteBuffer dest) throws IOException {
+        if (buffer != null && dest != null && info.size > 0) {
+            dest.put(buffer);
         }
     }
 
     @WrapForJNI
     public boolean isEOS() {
         return (info.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
     }
 
     @WrapForJNI
     public boolean isKeyFrame() {
         return (info.flags & MediaCodec.BUFFER_FLAG_KEY_FRAME) != 0;
     }
 
-    public static GeckoHLSSample create(final ByteBuffer src, final BufferInfo info,
-                                        final CryptoInfo cryptoInfo, final int formatIndex) {
+    public static GeckoHLSSample create(ByteBuffer src, BufferInfo info, CryptoInfo cryptoInfo,
+                                        int formatIndex) {
         return new GeckoHLSSample(src, info, cryptoInfo, formatIndex);
     }
 
-    private GeckoHLSSample(final ByteBuffer buffer, final BufferInfo info,
-                           final CryptoInfo cryptoInfo, final int formatIndex) {
+    private GeckoHLSSample(ByteBuffer buffer, BufferInfo info, CryptoInfo cryptoInfo,
+                           int formatIndex) {
         this.formatIndex = formatIndex;
         duration = Long.MAX_VALUE;
-        this.mBuffer = buffer;
+        this.buffer = buffer;
         this.info = info;
         this.cryptoInfo = cryptoInfo;
     }
 
     @Override
     public String toString() {
         if (isEOS()) {
             return "EOS GeckoHLSSample";
@@ -76,11 +76,11 @@ public final class GeckoHLSSample {
         StringBuilder str = new StringBuilder();
         str.append("{ info=").
                 append("{ offset=").append(info.offset).
                 append(", size=").append(info.size).
                 append(", pts=").append(info.presentationTimeUs).
                 append(", duration=").append(duration).
                 append(", flags=").append(Integer.toHexString(info.flags)).append(" }").
                 append(" }");
-        return str.toString();
+            return str.toString();
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsAudioRenderer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsAudioRenderer.java
@@ -20,25 +20,25 @@ import com.google.android.exoplayer2.dec
 import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
 import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
 import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
 import com.google.android.exoplayer2.util.MimeTypes;
 
 import java.nio.ByteBuffer;
 
 public class GeckoHlsAudioRenderer extends GeckoHlsRendererBase {
-    public GeckoHlsAudioRenderer(final GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
+    public GeckoHlsAudioRenderer(GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
         super(C.TRACK_TYPE_AUDIO, eventDispatcher);
         assertTrue(Build.VERSION.SDK_INT >= 16);
         LOGTAG = getClass().getSimpleName();
         DEBUG = !BuildConfig.MOZILLA_OFFICIAL;
     }
 
     @Override
-    public final int supportsFormat(final Format format) {
+    public final int supportsFormat(Format format) {
         /*
          * FORMAT_EXCEEDS_CAPABILITIES : The Renderer is capable of rendering
          *                               formats with the same mime type, but
          *                               the properties of the format exceed
          *                               the renderer's capability.
          * FORMAT_UNSUPPORTED_SUBTYPE : The Renderer is a general purpose
          *                              renderer for formats of the same
          *                              top-level type, but is not capable of
@@ -93,34 +93,33 @@ public class GeckoHlsAudioRenderer exten
 
     @Override
     protected void resetRenderer() {
         mInputBuffer = null;
         mInitialized = false;
     }
 
     @Override
-    protected void handleReconfiguration(final DecoderInputBuffer bufferForRead) {
+    protected void handleReconfiguration(DecoderInputBuffer bufferForRead) {
         // Do nothing
     }
 
     @Override
-    protected void handleFormatRead(final DecoderInputBuffer bufferForRead)
-            throws ExoPlaybackException {
+    protected void handleFormatRead(DecoderInputBuffer bufferForRead) throws ExoPlaybackException {
         onInputFormatChanged(mFormatHolder.format);
     }
 
     @Override
-    protected void handleEndOfStream(final DecoderInputBuffer bufferForRead) {
+    protected void handleEndOfStream(DecoderInputBuffer bufferForRead) {
         mInputStreamEnded = true;
         mDemuxedInputSamples.offer(GeckoHLSSample.EOS);
     }
 
     @Override
-    protected void handleSamplePreparation(final DecoderInputBuffer bufferForRead) {
+    protected void handleSamplePreparation(DecoderInputBuffer bufferForRead) {
         int size = bufferForRead.data.limit();
         byte[] realData = new byte[size];
         bufferForRead.data.get(realData, 0, size);
         ByteBuffer buffer = ByteBuffer.wrap(realData);
         mInputBuffer = bufferForRead.data;
         mInputBuffer.clear();
 
         CryptoInfo cryptoInfo = bufferForRead.isEncrypted() ? bufferForRead.cryptoInfo.getFrameworkCryptoInfoV16() : null;
@@ -147,20 +146,18 @@ public class GeckoHlsAudioRenderer exten
                           sample.duration + ", formatIndex(" +
                           sample.formatIndex + "), queue size : " +
                           mDemuxedInputSamples.size());
         }
     }
 
     @Override
     protected boolean clearInputSamplesQueue() {
-        if (DEBUG) {
-            Log.d(LOGTAG, "clearInputSamplesQueue");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "clearInputSamplesQueue"); }
         mDemuxedInputSamples.clear();
         return true;
     }
 
     @Override
-    protected void notifyPlayerInputFormatChanged(final Format newFormat) {
+    protected void notifyPlayerInputFormatChanged(Format newFormat) {
         mPlayerEventDispatcher.onAudioInputFormatChanged(newFormat);
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
@@ -91,26 +91,22 @@ public class GeckoHlsPlayer implements B
 
     private GeckoHlsVideoRenderer mVRenderer = null;
     private GeckoHlsAudioRenderer mARenderer = null;
 
     // Able to control if we only want V/A/V+A tracks from bitstream.
     private class RendererController {
         private final boolean mEnableV;
         private final boolean mEnableA;
-        RendererController(final boolean enableVideoRenderer, final boolean enableAudioRenderer) {
+        RendererController(boolean enableVideoRenderer, boolean enableAudioRenderer) {
             this.mEnableV = enableVideoRenderer;
             this.mEnableA = enableAudioRenderer;
         }
-        boolean isVideoRendererEnabled() {
-            return mEnableV;
-        }
-        boolean isAudioRendererEnabled() {
-            return mEnableA;
-        }
+        boolean isVideoRendererEnabled() { return mEnableV; }
+        boolean isAudioRendererEnabled() { return mEnableA; }
     }
     private RendererController mRendererController = new RendererController(true, true);
 
     // Provide statistical information of tracks.
     private class HlsMediaTracksInfo {
         private int mNumVideoTracks = 0;
         private int mNumAudioTracks = 0;
         private boolean mVideoInfoUpdated = false;
@@ -121,41 +117,25 @@ public class GeckoHlsPlayer implements B
         public void reset() {
             mNumVideoTracks = 0;
             mNumAudioTracks = 0;
             mVideoInfoUpdated = false;
             mAudioInfoUpdated = false;
             mVideoDataArrived = false;
             mAudioDataArrived = false;
         }
-        public void updateNumOfVideoTracks(final int numOfTracks) {
-            mNumVideoTracks = numOfTracks;
-        }
-        public void updateNumOfAudioTracks(final int numOfTracks) {
-            mNumAudioTracks = numOfTracks;
-        }
-        public boolean hasVideo() {
-            return mNumVideoTracks > 0;
-        }
-        public boolean hasAudio() {
-            return mNumAudioTracks > 0;
-        }
-        public int getNumOfVideoTracks() {
-            return mNumVideoTracks;
-        }
-        public int getNumOfAudioTracks() {
-            return mNumAudioTracks;
-        }
-        public void onVideoInfoUpdated() {
-            mVideoInfoUpdated = true;
-        }
-        public void onAudioInfoUpdated() {
-            mAudioInfoUpdated = true;
-        }
-        public void onDataArrived(final int trackType) {
+        public void updateNumOfVideoTracks(int numOfTracks) { mNumVideoTracks = numOfTracks; }
+        public void updateNumOfAudioTracks(int numOfTracks) { mNumAudioTracks = numOfTracks; }
+        public boolean hasVideo() { return mNumVideoTracks > 0; }
+        public boolean hasAudio() { return mNumAudioTracks > 0; }
+        public int getNumOfVideoTracks() { return mNumVideoTracks; }
+        public int getNumOfAudioTracks() { return mNumAudioTracks; }
+        public void onVideoInfoUpdated() { mVideoInfoUpdated = true; }
+        public void onAudioInfoUpdated() { mAudioInfoUpdated = true; }
+        public void onDataArrived(int trackType) {
             if (trackType == C.TRACK_TYPE_VIDEO) {
                 mVideoDataArrived = true;
             } else if (trackType == C.TRACK_TYPE_AUDIO) {
                 mAudioDataArrived = true;
             }
         }
         public boolean videoReady() {
             return !hasVideo() || (mVideoInfoUpdated && mVideoDataArrived);
@@ -167,20 +147,20 @@ public class GeckoHlsPlayer implements B
     private HlsMediaTracksInfo mTracksInfo = new HlsMediaTracksInfo();
 
     private boolean mIsPlayerInitDone = false;
     private boolean mIsDemuxerInitDone = false;
 
     private BaseHlsPlayer.DemuxerCallbacks mDemuxerCallbacks;
     private BaseHlsPlayer.ResourceCallbacks mResourceCallbacks;
 
-    private static void assertTrue(final boolean condition) {
-        if (DEBUG && !condition) {
-            throw new AssertionError("Expected condition to be true");
-        }
+    private static void assertTrue(boolean condition) {
+      if (DEBUG && !condition) {
+        throw new AssertionError("Expected condition to be true");
+      }
     }
 
     protected void checkInitDone() {
         if (mIsDemuxerInitDone) {
             return;
         }
         assertTrue(mDemuxerCallbacks != null);
 
@@ -244,183 +224,163 @@ public class GeckoHlsPlayer implements B
             }
         }
     }
 
     public final class ComponentListener {
 
         // General purpose implementation
         // Called on GeckoHlsPlayerThread
-        public void onDataArrived(final int trackType) {
+        public void onDataArrived(int trackType) {
             synchronized (GeckoHlsPlayer.this) {
-                if (DEBUG) {
-                    Log.d(LOGTAG, "[CB][onDataArrived] id " + mPlayerId);
-                }
+                if (DEBUG) { Log.d(LOGTAG, "[CB][onDataArrived] id " + mPlayerId); }
                 if (!mIsPlayerInitDone) {
                     return;
                 }
                 mTracksInfo.onDataArrived(trackType);
                 mResourceCallbacks.onDataArrived();
                 checkInitDone();
             }
         }
 
         // Called on GeckoHlsPlayerThread
-        public void onVideoInputFormatChanged(final Format format) {
+        public void onVideoInputFormatChanged(Format format) {
             synchronized (GeckoHlsPlayer.this) {
                 if (DEBUG) {
                     Log.d(LOGTAG, "[CB] onVideoInputFormatChanged [" + format + "]");
                     Log.d(LOGTAG, "[CB] SampleMIMEType [" +
                             format.sampleMimeType + "], ContainerMIMEType [" +
                             format.containerMimeType + "], id : " + mPlayerId);
                 }
                 if (!mIsPlayerInitDone) {
                     return;
                 }
                 mTracksInfo.onVideoInfoUpdated();
                 checkInitDone();
             }
         }
 
         // Called on GeckoHlsPlayerThread
-        public void onAudioInputFormatChanged(final Format format) {
+        public void onAudioInputFormatChanged(Format format) {
             synchronized (GeckoHlsPlayer.this) {
                 if (DEBUG) {
                     Log.d(LOGTAG, "[CB] onAudioInputFormatChanged [" + format + "], mPlayerId :" + mPlayerId);
                 }
                 if (!mIsPlayerInitDone) {
                     return;
                 }
                 mTracksInfo.onAudioInfoUpdated();
                 checkInitDone();
             }
         }
     }
 
-    private DataSource.Factory buildDataSourceFactory(final Context ctx,
-                                                      final DefaultBandwidthMeter bandwidthMeter) {
+    private DataSource.Factory buildDataSourceFactory(Context ctx, DefaultBandwidthMeter bandwidthMeter) {
         return new DefaultDataSourceFactory(ctx, bandwidthMeter,
                 buildHttpDataSourceFactory(bandwidthMeter));
     }
 
-    private HttpDataSource.Factory buildHttpDataSourceFactory(
-            final DefaultBandwidthMeter bandwidthMeter) {
+    private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
         return new DefaultHttpDataSourceFactory(
             BuildConfig.USER_AGENT_GECKOVIEW_MOBILE,
             bandwidthMeter /* listener */,
             DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
             DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
             true /* allowCrossProtocolRedirects */
         );
     }
 
     private synchronized long getDuration() {
         long duration = 0L;
         // Value returned by getDuration() is in milliseconds.
         if (mPlayer != null && !isLiveStream()) {
             duration = Math.max(0L, mPlayer.getDuration() * 1000L);
         }
-        if (DEBUG) {
-            Log.d(LOGTAG, "getDuration : " + duration  + "(Us)");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "getDuration : " + duration  + "(Us)"); }
         return duration;
     }
 
     // To make sure that each player has a unique id, GeckoHlsPlayer should be
     // created only from synchronized APIs in GeckoPlayerFactory.
     public GeckoHlsPlayer() {
         mPlayerId = sPlayerId.incrementAndGet();
-        if (DEBUG) {
-            Log.d(LOGTAG, " construct player with id(" + mPlayerId + ")");
-        }
+        if (DEBUG) { Log.d(LOGTAG, " construct player with id(" + mPlayerId + ")"); }
     }
 
     // Should be only called by GeckoPlayerFactory and GeckoHLSResourceWrapper.
     // The mPlayerId is used to make sure that the same GeckoHlsPlayer is used by
     // corresponding HLSResource and HLSDemuxer for each media playback.
     // Called on Gecko's main thread
     @Override
     public int getId() {
         return mPlayerId;
     }
 
     // Called on Gecko's main thread
     @Override
-    public synchronized void addDemuxerWrapperCallbackListener(
-            final BaseHlsPlayer.DemuxerCallbacks callback) {
-        if (DEBUG) {
-            Log.d(LOGTAG, " addDemuxerWrapperCallbackListener ...");
-        }
+    public synchronized void addDemuxerWrapperCallbackListener(BaseHlsPlayer.DemuxerCallbacks callback) {
+        if (DEBUG) { Log.d(LOGTAG, " addDemuxerWrapperCallbackListener ..."); }
         mDemuxerCallbacks = callback;
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
-    public synchronized void onLoadingChanged(final boolean isLoading) {
-        if (DEBUG) {
-            Log.d(LOGTAG, "loading [" + isLoading + "]");
-        }
+    public synchronized void onLoadingChanged(boolean isLoading) {
+        if (DEBUG) { Log.d(LOGTAG, "loading [" + isLoading + "]"); }
         if (!isLoading) {
             if (mMediaDecoderPlayState != MediaDecoderPlayState.PLAY_STATE_PLAYING) {
                 suspendExoplayer();
             }
             // To update buffered position.
             mComponentEventDispatcher.onDataArrived(C.TRACK_TYPE_DEFAULT);
         }
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
-    public synchronized void onPlayerStateChanged(final boolean playWhenReady, final int state) {
-        if (DEBUG) {
-            Log.d(LOGTAG, "state [" + playWhenReady + ", " + getStateString(state) + "]");
-        }
+    public synchronized void onPlayerStateChanged(boolean playWhenReady, int state) {
+        if (DEBUG) { Log.d(LOGTAG, "state [" + playWhenReady + ", " + getStateString(state) + "]"); }
         if (state == ExoPlayer.STATE_READY &&
             !mExoplayerSuspended &&
             mMediaDecoderPlayState == MediaDecoderPlayState.PLAY_STATE_PLAYING) {
             resumeExoplayer();
         }
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
     public void onPositionDiscontinuity() {
-        if (DEBUG) {
-            Log.d(LOGTAG, "positionDiscontinuity");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "positionDiscontinuity"); }
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
-    public void onPlaybackParametersChanged(final PlaybackParameters playbackParameters) {
+    public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
         if (DEBUG) {
             Log.d(LOGTAG, "playbackParameters " +
                   String.format("[speed=%.2f, pitch=%.2f]", playbackParameters.speed, playbackParameters.pitch));
         }
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
-    public synchronized void onPlayerError(final ExoPlaybackException e) {
-        if (DEBUG) {
-            Log.e(LOGTAG, "playerFailed" , e);
-        }
+    public synchronized void onPlayerError(ExoPlaybackException e) {
+        if (DEBUG) { Log.e(LOGTAG, "playerFailed" , e); }
         mIsPlayerInitDone = false;
         if (mResourceCallbacks != null) {
             mResourceCallbacks.onError(ResourceError.PLAYER.code());
         }
         if (mDemuxerCallbacks != null) {
             mDemuxerCallbacks.onError(DemuxerError.PLAYER.code());
         }
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
-    public synchronized void onTracksChanged(final TrackGroupArray ignored,
-                                             final TrackSelectionArray trackSelections) {
+    public synchronized void onTracksChanged(TrackGroupArray ignored, TrackSelectionArray trackSelections) {
         if (DEBUG) {
             Log.d(LOGTAG, "onTracksChanged : TGA[" + ignored +
                           "], TSA[" + trackSelections + "]");
 
             MappedTrackInfo mappedTrackInfo = mTrackSelector.getCurrentMappedTrackInfo();
             if (mappedTrackInfo == null) {
                 Log.d(LOGTAG, "Tracks []");
                 return;
@@ -490,109 +450,106 @@ public class GeckoHlsPlayer implements B
             }
         }
         mTracksInfo.updateNumOfVideoTracks(numVideoTracks);
         mTracksInfo.updateNumOfAudioTracks(numAudioTracks);
     }
 
     // Called on GeckoHlsPlayerThread from ExoPlayer
     @Override
-    public synchronized void onTimelineChanged(final Timeline timeline, final Object manifest) {
+    public synchronized void onTimelineChanged(Timeline timeline, Object manifest) {
         // For now, we use the interface ExoPlayer.getDuration() for gecko,
         // so here we create local variable 'window' & 'peroid' to obtain
         // the dynamic duration.
         // See. http://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/Timeline.html
         // for further information.
         Timeline.Window window = new Timeline.Window();
         mIsTimelineStatic = !timeline.isEmpty()
                 && !timeline.getWindow(timeline.getWindowCount() - 1, window).isDynamic;
 
         int periodCount = timeline.getPeriodCount();
         int windowCount = timeline.getWindowCount();
-        if (DEBUG) {
-            Log.d(LOGTAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "sourceInfo [periodCount=" + periodCount + ", windowCount=" + windowCount); }
         Timeline.Period period = new Timeline.Period();
         for (int i = 0; i < Math.min(periodCount, MAX_TIMELINE_ITEM_LINES); i++) {
-            timeline.getPeriod(i, period);
-            if (mDurationUs < period.getDurationUs()) {
-                mDurationUs = period.getDurationUs();
-            }
+          timeline.getPeriod(i, period);
+          if (mDurationUs < period.getDurationUs()) {
+              mDurationUs = period.getDurationUs();
+          }
         }
         for (int i = 0; i < Math.min(windowCount, MAX_TIMELINE_ITEM_LINES); i++) {
-            timeline.getWindow(i, window);
-            if (mDurationUs < window.getDurationUs()) {
-                mDurationUs = window.getDurationUs();
-            }
+          timeline.getWindow(i, window);
+          if (mDurationUs < window.getDurationUs()) {
+              mDurationUs = window.getDurationUs();
+          }
         }
         // TODO : Need to check if the duration from play.getDuration is different
         // with the one calculated from multi-timelines/windows.
         if (DEBUG) {
             Log.d(LOGTAG, "Media duration (from Timeline) = " + mDurationUs +
-                    "(us)" + " player.getDuration() = " + mPlayer.getDuration() +
-                    "(ms)");
+                          "(us)" + " player.getDuration() = " + mPlayer.getDuration() +
+                          "(ms)");
         }
     }
 
-    private static String getStateString(final int state) {
+    private static String getStateString(int state) {
         switch (state) {
             case ExoPlayer.STATE_BUFFERING:
                 return "B";
             case ExoPlayer.STATE_ENDED:
                 return "E";
             case ExoPlayer.STATE_IDLE:
                 return "I";
             case ExoPlayer.STATE_READY:
                 return "R";
             default:
                 return "?";
         }
     }
 
-    private static String getFormatSupportString(final int formatSupport) {
+    private static String getFormatSupportString(int formatSupport) {
         switch (formatSupport) {
-            case RendererCapabilities.FORMAT_HANDLED:
-                return "YES";
-            case RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES:
-                return "NO_EXCEEDS_CAPABILITIES";
-            case RendererCapabilities.FORMAT_UNSUPPORTED_SUBTYPE:
-                return "NO_UNSUPPORTED_TYPE";
-            case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE:
-                return "NO";
-            default:
-                return "?";
+          case RendererCapabilities.FORMAT_HANDLED:
+            return "YES";
+          case RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES:
+            return "NO_EXCEEDS_CAPABILITIES";
+          case RendererCapabilities.FORMAT_UNSUPPORTED_SUBTYPE:
+            return "NO_UNSUPPORTED_TYPE";
+          case RendererCapabilities.FORMAT_UNSUPPORTED_TYPE:
+            return "NO";
+          default:
+            return "?";
         }
-    }
+      }
 
-    private static String getAdaptiveSupportString(final int trackCount,
-                                                   final int adaptiveSupport) {
+    private static String getAdaptiveSupportString(int trackCount, int adaptiveSupport) {
         if (trackCount < 2) {
-            return "N/A";
+          return "N/A";
         }
         switch (adaptiveSupport) {
-            case RendererCapabilities.ADAPTIVE_SEAMLESS:
-                return "YES";
-            case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
-                return "YES_NOT_SEAMLESS";
-            case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
-                return "NO";
-            default:
-                return "?";
+          case RendererCapabilities.ADAPTIVE_SEAMLESS:
+            return "YES";
+          case RendererCapabilities.ADAPTIVE_NOT_SEAMLESS:
+            return "YES_NOT_SEAMLESS";
+          case RendererCapabilities.ADAPTIVE_NOT_SUPPORTED:
+            return "NO";
+          default:
+            return "?";
         }
-    }
+      }
 
-    private static String getTrackStatusString(final TrackSelection selection,
-                                               final TrackGroup group, final int trackIndex) {
+      private static String getTrackStatusString(TrackSelection selection, TrackGroup group,
+                                                 int trackIndex) {
         return getTrackStatusString(selection != null && selection.getTrackGroup() == group
                 && selection.indexOf(trackIndex) != C.INDEX_UNSET);
-    }
+      }
 
-    private static String getTrackStatusString(final boolean enabled) {
+      private static String getTrackStatusString(boolean enabled) {
         return enabled ? "[X]" : "[ ]";
-    }
+      }
 
     // Called on GeckoHlsPlayerThread
     private synchronized void createExoPlayer(final String url) {
         Context ctx = GeckoAppShell.getApplicationContext();
         mComponentListener = new ComponentListener();
         mComponentEventDispatcher = new ComponentEventDispatcher();
         mDurationUs = 0;
 
@@ -630,21 +587,18 @@ public class GeckoHlsPlayer implements B
         mPlayer.prepare(mMediaSource);
         mIsPlayerInitDone = true;
     }
     // =======================================================================
     // API for GeckoHLSResourceWrapper
     // =======================================================================
     // Called on Gecko Main Thread
     @Override
-    public synchronized void init(final String url,
-                                  final BaseHlsPlayer.ResourceCallbacks callback) {
-        if (DEBUG) {
-            Log.d(LOGTAG, " init");
-        }
+    public synchronized void init(final String url, BaseHlsPlayer.ResourceCallbacks callback) {
+        if (DEBUG) { Log.d(LOGTAG, " init"); }
         assertTrue(callback != null);
         assertTrue(!mIsPlayerInitDone);
 
         mResourceCallbacks = callback;
         mThread = new HandlerThread("GeckoHlsPlayerThread");
         mThread.start();
         mMainHandler = new Handler(mThread.getLooper());
 
@@ -661,60 +615,54 @@ public class GeckoHlsPlayer implements B
     public boolean isLiveStream() {
         return !mIsTimelineStatic;
     }
     // =======================================================================
     // API for GeckoHLSDemuxerWrapper
     // =======================================================================
     // Called on HLSDemuxer's TaskQueue
     @Override
-    public synchronized ConcurrentLinkedQueue<GeckoHLSSample> getSamples(
-            final TrackType trackType, final int number) {
+    public synchronized ConcurrentLinkedQueue<GeckoHLSSample> getSamples(TrackType trackType,
+                                                            int number) {
         if (trackType == TrackType.VIDEO) {
             return mVRenderer != null ? mVRenderer.getQueuedSamples(number) :
                                         new ConcurrentLinkedQueue<GeckoHLSSample>();
         } else if (trackType == TrackType.AUDIO) {
             return mARenderer != null ? mARenderer.getQueuedSamples(number) :
                                         new ConcurrentLinkedQueue<GeckoHLSSample>();
         } else {
             return new ConcurrentLinkedQueue<GeckoHLSSample>();
         }
     }
 
     // Called on MFR's TaskQueue
     @Override
     public synchronized long getBufferedPosition() {
         // Value returned by getBufferedPosition() is in milliseconds.
         long bufferedPos = mPlayer == null ? 0L : Math.max(0L, mPlayer.getBufferedPosition() * 1000L);
-        if (DEBUG) {
-            Log.d(LOGTAG, "getBufferedPosition : " + bufferedPos + "(Us)");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "getBufferedPosition : " + bufferedPos + "(Us)"); }
         return bufferedPos;
     }
 
     // Called on MFR's TaskQueue
     @Override
-    public synchronized int getNumberOfTracks(final TrackType trackType) {
-        if (DEBUG) {
-            Log.d(LOGTAG, "getNumberOfTracks : type " + trackType);
-        }
+    public synchronized int getNumberOfTracks(TrackType trackType) {
+        if (DEBUG) { Log.d(LOGTAG, "getNumberOfTracks : type " + trackType); }
         if (trackType == TrackType.VIDEO) {
             return mTracksInfo.getNumOfVideoTracks();
         } else if (trackType == TrackType.AUDIO) {
             return mTracksInfo.getNumOfAudioTracks();
         }
         return 0;
     }
 
     // Called on MFR's TaskQueue
     @Override
-    public synchronized GeckoVideoInfo getVideoInfo(final int index) {
-        if (DEBUG) {
-            Log.d(LOGTAG, "getVideoInfo");
-        }
+    public synchronized GeckoVideoInfo getVideoInfo(int index) {
+        if (DEBUG) { Log.d(LOGTAG, "getVideoInfo"); }
         assertTrue(mVRenderer != null);
         if (!mTracksInfo.hasVideo()) {
             return null;
         }
         Format fmt = mVRenderer.getFormat(index);
         if (fmt == null) {
             return null;
         }
@@ -723,20 +671,18 @@ public class GeckoHlsPlayer implements B
                                                   fmt.rotationDegrees, fmt.stereoMode,
                                                   getDuration(), fmt.sampleMimeType,
                                                   null, null);
         return vInfo;
     }
 
     // Called on MFR's TaskQueue
     @Override
-    public synchronized GeckoAudioInfo getAudioInfo(final int index) {
-        if (DEBUG) {
-            Log.d(LOGTAG, "getAudioInfo");
-        }
+    public synchronized GeckoAudioInfo getAudioInfo(int index) {
+        if (DEBUG) { Log.d(LOGTAG, "getAudioInfo"); }
         assertTrue(mARenderer != null);
         if (!mTracksInfo.hasAudio()) {
             return null;
         }
         Format fmt = mARenderer.getFormat(index);
         if (fmt == null) {
             return null;
         }
@@ -753,17 +699,17 @@ public class GeckoHlsPlayer implements B
         GeckoAudioInfo aInfo = new GeckoAudioInfo(fmt.sampleRate, fmt.channelCount,
                                                   16, 0, getDuration(),
                                                   fmt.sampleMimeType, csd);
         return aInfo;
     }
 
     // Called on HLSDemuxer's TaskQueue
     @Override
-    public synchronized boolean seek(final long positionUs) {
+    public synchronized boolean seek(long positionUs) {
         if (mPlayer == null) {
             Log.d(LOGTAG, "Seek operation won't be performed as no player exists!");
             return false;
         }
 
         // Need to temporarily resume Exoplayer to download the chunks for getting the demuxed
         // keyframe sample when HTMLMediaElement is paused. Suspend Exoplayer when collecting enough
         // samples in onLoadingChanged.
@@ -823,77 +769,67 @@ public class GeckoHlsPlayer implements B
             suspendExoplayer();
         }
     }
 
     // Called on Gecko's main thread.
     @Override
     public synchronized void resume() {
         if (!mExoplayerSuspended) {
-            return;
+          return;
         }
         if (mMediaDecoderPlayState == MediaDecoderPlayState.PLAY_STATE_PLAYING) {
             if (DEBUG) {
                 Log.d(LOGTAG, "resume player id : " + mPlayerId);
             }
             resumeExoplayer();
         }
     }
 
     // Called on Gecko's main thread.
     @Override
     public synchronized void play() {
         if (mMediaDecoderPlayState == MediaDecoderPlayState.PLAY_STATE_PLAYING) {
             return;
         }
-        if (DEBUG) {
-            Log.d(LOGTAG, "MediaDecoder played.");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "MediaDecoder played."); }
         mMediaDecoderPlayState = MediaDecoderPlayState.PLAY_STATE_PLAYING;
         resumeExoplayer();
     }
 
     // Called on Gecko's main thread.
     @Override
     public synchronized void pause() {
         if (mMediaDecoderPlayState != MediaDecoderPlayState.PLAY_STATE_PLAYING) {
             return;
         }
-        if (DEBUG) {
-            Log.d(LOGTAG, "MediaDecoder paused.");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "MediaDecoder paused."); }
         mMediaDecoderPlayState = MediaDecoderPlayState.PLAY_STATE_PAUSED;
         suspendExoplayer();
     }
 
     private synchronized void suspendExoplayer() {
         if (mPlayer != null) {
             mExoplayerSuspended = true;
-            if (DEBUG) {
-                Log.d(LOGTAG, "suspend Exoplayer");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "suspend Exoplayer"); }
             mPlayer.setPlayWhenReady(false);
         }
     }
 
     private synchronized void resumeExoplayer() {
         if (mPlayer != null) {
             mExoplayerSuspended = false;
-            if (DEBUG) {
-                Log.d(LOGTAG, "resume Exoplayer");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "resume Exoplayer"); }
             mPlayer.setPlayWhenReady(true);
         }
     }
     // Called on Gecko's main thread, when HLSDemuxer or HLSResource destructs.
     @Override
     public synchronized void release() {
-        if (DEBUG) {
-            Log.d(LOGTAG, "releasing  ... id : " + mPlayerId);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "releasing  ... id : " + mPlayerId); }
         if (mPlayer != null) {
             mPlayer.removeListener(this);
             mPlayer.stop();
             mPlayer.release();
             mVRenderer = null;
             mARenderer = null;
             mPlayer = null;
         }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsRendererBase.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsRendererBase.java
@@ -48,26 +48,25 @@ public abstract class GeckoHlsRendererBa
     protected abstract void handleEndOfStream(DecoderInputBuffer bufferForRead);
     protected abstract void handleSamplePreparation(DecoderInputBuffer bufferForRead);
     protected abstract void resetRenderer();
     protected abstract boolean clearInputSamplesQueue();
     protected abstract void notifyPlayerInputFormatChanged(Format newFormat);
 
     private DecoderInputBuffer mBufferForRead =
         new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_NORMAL);
-    private final DecoderInputBuffer mFlagsOnlyBuffer = DecoderInputBuffer.newFlagsOnlyInstance();
+    private final DecoderInputBuffer mflagsOnlyBuffer = DecoderInputBuffer.newFlagsOnlyInstance();
 
-    protected void assertTrue(final boolean condition) {
+    protected void assertTrue(boolean condition) {
         if (DEBUG && !condition) {
             throw new AssertionError("Expected condition to be true");
         }
     }
 
-    public GeckoHlsRendererBase(final int trackType,
-                                final GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
+    public GeckoHlsRendererBase(int trackType, GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
         super(trackType);
         mPlayerEventDispatcher = eventDispatcher;
     }
 
     private boolean isQueuedEnoughData() {
         if (mDemuxedInputSamples.isEmpty()) {
             return false;
         }
@@ -81,86 +80,78 @@ public abstract class GeckoHlsRendererBa
         long lastPTS = firstPTS;
         while (iter.hasNext()) {
             GeckoHLSSample sample = iter.next();
             lastPTS = sample.info.presentationTimeUs;
         }
         return Math.abs(lastPTS - firstPTS) > QUEUED_INPUT_SAMPLE_DURATION_THRESHOLD;
     }
 
-    public Format getFormat(final int index) {
+    public Format getFormat(int index) {
         assertTrue(index >= 0);
         Format fmt = index < mFormats.size() ? mFormats.get(index) : null;
-        if (DEBUG) {
-            Log.d(LOGTAG, "getFormat : index = " + index + ", format : " + fmt);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "getFormat : index = " + index + ", format : " + fmt); }
         return fmt;
     }
 
-    public synchronized long getFirstSamplePTS() {
-        return mFirstSampleStartTime;
-    }
+    public synchronized long getFirstSamplePTS() { return mFirstSampleStartTime; }
 
-    public synchronized ConcurrentLinkedQueue<GeckoHLSSample> getQueuedSamples(final int number) {
+    public synchronized ConcurrentLinkedQueue<GeckoHLSSample> getQueuedSamples(int number) {
         ConcurrentLinkedQueue<GeckoHLSSample> samples =
             new ConcurrentLinkedQueue<GeckoHLSSample>();
 
         GeckoHLSSample sample = null;
         int queuedSize = mDemuxedInputSamples.size();
         for (int i = 0; i < queuedSize; i++) {
             if (i >= number) {
                 break;
             }
             sample = mDemuxedInputSamples.poll();
             samples.offer(sample);
         }
 
         sample = samples.isEmpty() ? null : samples.peek();
         if (sample == null) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "getQueuedSamples isEmpty, mWaitingForData = true !");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "getQueuedSamples isEmpty, mWaitingForData = true !"); }
             mWaitingForData = true;
         } else if (mFirstSampleStartTime == Long.MIN_VALUE) {
             mFirstSampleStartTime = sample.info.presentationTimeUs;
-            if (DEBUG) {
-                Log.d(LOGTAG, "mFirstSampleStartTime = " + mFirstSampleStartTime);
-            }
+            if (DEBUG) { Log.d(LOGTAG, "mFirstSampleStartTime = " + mFirstSampleStartTime); }
         }
         return samples;
     }
 
-    protected void handleDrmInitChanged(final Format oldFormat, final Format newFormat) {
+    protected void handleDrmInitChanged(Format oldFormat, Format newFormat) {
         Object oldDrmInit = oldFormat == null ? null : oldFormat.drmInitData;
         Object newDrnInit = newFormat.drmInitData;
 
         // TODO: Notify MFR if the content is encrypted or not.
         if (newDrnInit != oldDrmInit) {
             if (newDrnInit != null) {
             } else {
             }
         }
     }
 
-    protected boolean canReconfigure(final Format oldFormat, final Format newFormat) {
+    protected boolean canReconfigure(Format oldFormat, Format newFormat) {
         // Referring to ExoPlayer's MediaCodecBaseRenderer, the default is set
         // to false. Only override it in video renderer subclass.
         return false;
     }
 
     protected void prepareReconfiguration() {
         // Referring to ExoPlayer's MediaCodec related renderers, only video
         // renderer handles this.
     }
 
-    protected void updateCSDInfo(final Format format) {
+    protected void updateCSDInfo(Format format) {
         // do nothing.
     }
 
-    protected void onInputFormatChanged(final Format newFormat) throws ExoPlaybackException {
+    protected void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
         Format oldFormat;
         try {
             oldFormat = mFormats.get(mFormats.size() - 1);
         } catch (IndexOutOfBoundsException e) {
             oldFormat = null;
         }
         if (DEBUG) {
             Log.d(LOGTAG, "[onInputFormatChanged] old : " + oldFormat +
@@ -179,19 +170,17 @@ public abstract class GeckoHlsRendererBa
         updateCSDInfo(newFormat);
         notifyPlayerInputFormatChanged(newFormat);
     }
 
     protected void maybeInitRenderer() throws ExoPlaybackException {
         if (mInitialized || mFormats.size() == 0) {
             return;
         }
-        if (DEBUG) {
-            Log.d(LOGTAG, "Initializing ... ");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "Initializing ... "); }
         try {
             createInputBuffer();
             mInitialized = true;
         } catch (OutOfMemoryError e) {
             throw ExoPlaybackException.createForRenderer(new RuntimeException(e), getIndex());
         }
     }
 
@@ -234,51 +223,47 @@ public abstract class GeckoHlsRendererBa
 
         if (result == C.RESULT_FORMAT_READ) {
             handleFormatRead(mBufferForRead);
             return true;
         }
 
         // We've read a buffer.
         if (mBufferForRead.isEndOfStream()) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "Now we're at the End Of Stream.");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "Now we're at the End Of Stream."); }
             handleEndOfStream(mBufferForRead);
             return false;
         }
 
         mBufferForRead.flip();
 
         handleSamplePreparation(mBufferForRead);
 
         maybeNotifyDataArrived();
         return true;
     }
 
     private void maybeNotifyDataArrived() {
         if (mWaitingForData && isQueuedEnoughData()) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "onDataArrived");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "onDataArrived"); }
             mPlayerEventDispatcher.onDataArrived(getTrackType());
             mWaitingForData = false;
         }
     }
 
     private void readFormat() throws ExoPlaybackException {
-        mFlagsOnlyBuffer.clear();
-        int result = readSource(mFormatHolder, mFlagsOnlyBuffer, true);
+        mflagsOnlyBuffer.clear();
+        int result = readSource(mFormatHolder, mflagsOnlyBuffer, true);
         if (result == C.RESULT_FORMAT_READ) {
             onInputFormatChanged(mFormatHolder.format);
         }
     }
 
     @Override
-    protected void onEnabled(final boolean joining) {
+    protected void onEnabled(boolean joining) {
         // Do nothing.
     }
 
     @Override
     protected void onDisabled() {
         mFormats.clear();
         resetRenderer();
     }
@@ -289,34 +274,31 @@ public abstract class GeckoHlsRendererBa
     }
 
     @Override
     public boolean isEnded() {
         return mInputStreamEnded;
     }
 
     @Override
-    protected synchronized void onPositionReset(final long positionUs, final boolean joining) {
-        if (DEBUG) {
-            Log.d(LOGTAG, "onPositionReset : positionUs = " + positionUs);
-        }
+    protected synchronized void onPositionReset(long positionUs, boolean joining) {
+        if (DEBUG) { Log.d(LOGTAG, "onPositionReset : positionUs = " + positionUs); }
         mInputStreamEnded = false;
         if (mInitialized) {
             clearInputSamplesQueue();
         }
     }
 
     /*
      * This is called by ExoPlayerImplInternal.java.
      * ExoPlayer checks the status of renderer, i.e. isReady() / isEnded(), and
      * calls renderer.render by passing its wall clock time.
      */
     @Override
-    public void render(final long positionUs, final long elapsedRealtimeUs)
-            throws ExoPlaybackException {
+    public void render(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException {
         if (BuildConfig.DEBUG_BUILD) {
             Log.d(LOGTAG, "positionUs = " + positionUs +
                           ", mInputStreamEnded = " + mInputStreamEnded);
         }
         if (mInputStreamEnded) {
             return;
         }
         if (mFormats.size() == 0) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsVideoRenderer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsVideoRenderer.java
@@ -48,30 +48,30 @@ public class GeckoHlsVideoRenderer exten
     private ConcurrentLinkedQueue<GeckoHLSSample> mDemuxedNoDurationSamples =
         new ConcurrentLinkedQueue<>();
 
     // Contain CSD-0(SPS)/CSD-1(PPS) information (in AnnexB format) for
     // prepending each keyframe. When video format changes, this information
     // changes accordingly.
     private byte[] mCSDInfo = null;
 
-    public GeckoHlsVideoRenderer(final GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
+    public GeckoHlsVideoRenderer(GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
         super(C.TRACK_TYPE_VIDEO, eventDispatcher);
         assertTrue(Build.VERSION.SDK_INT >= 16);
         LOGTAG = getClass().getSimpleName();
         DEBUG = !BuildConfig.MOZILLA_OFFICIAL;
     }
 
     @Override
     public final int supportsMixedMimeTypeAdaptation() {
         return ADAPTIVE_NOT_SEAMLESS;
     }
 
     @Override
-    public final int supportsFormat(final Format format) {
+    public final int supportsFormat(Format format) {
         /*
          * FORMAT_EXCEEDS_CAPABILITIES : The Renderer is capable of rendering
          *                               formats with the same mime type, but
          *                               the properties of the format exceed
          *                               the renderer's capability.
          * FORMAT_UNSUPPORTED_SUBTYPE : The Renderer is a general purpose
          *                              renderer for formats of the same
          *                              top-level type, but is not capable of
@@ -150,87 +150,76 @@ public class GeckoHlsVideoRenderer exten
         } catch (OutOfMemoryError e) {
             Log.e(LOGTAG, "cannot allocate input buffer of size " + mCodecMaxValues.inputSize, e);
             throw ExoPlaybackException.createForRenderer(new Exception(e), getIndex());
         }
     }
 
     @Override
     protected void resetRenderer() {
-        if (DEBUG) {
-            Log.d(LOGTAG, "[resetRenderer] mInitialized = " + mInitialized);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "[resetRenderer] mInitialized = " + mInitialized); }
         if (mInitialized) {
             mRendererReconfigured = false;
             mRendererReconfigurationState = RECONFIGURATION_STATE.NONE;
             mInputBuffer = null;
             mCSDInfo = null;
             mInitialized = false;
         }
     }
 
     @Override
-    protected void handleReconfiguration(final DecoderInputBuffer bufferForRead) {
+    protected void handleReconfiguration(DecoderInputBuffer bufferForRead) {
         // For adaptive reconfiguration OMX decoders expect all reconfiguration
         // data to be supplied at the start of the buffer that also contains
         // the first frame in the new format.
         assertTrue(mFormats.size() > 0);
         if (mRendererReconfigurationState == RECONFIGURATION_STATE.WRITE_PENDING) {
             if (bufferForRead.data == null) {
-                if (DEBUG) {
-                    Log.d(LOGTAG, "[feedInput][WRITE_PENDING] bufferForRead.data is not initialized.");
-                }
+                if (DEBUG) { Log.d(LOGTAG, "[feedInput][WRITE_PENDING] bufferForRead.data is not initialized."); }
                 return;
             }
-            if (DEBUG) {
-                Log.d(LOGTAG, "[feedInput][WRITE_PENDING] put initialization data");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "[feedInput][WRITE_PENDING] put initialization data"); }
             Format currentFormat = mFormats.get(mFormats.size() - 1);
             for (int i = 0; i < currentFormat.initializationData.size(); i++) {
                 byte[] data = currentFormat.initializationData.get(i);
                 bufferForRead.data.put(data);
             }
             mRendererReconfigurationState = RECONFIGURATION_STATE.QUEUE_PENDING;
         }
     }
 
     @Override
-    protected void handleFormatRead(final DecoderInputBuffer bufferForRead)
-            throws ExoPlaybackException {
+    protected void handleFormatRead(DecoderInputBuffer bufferForRead) throws ExoPlaybackException {
         if (mRendererReconfigurationState == RECONFIGURATION_STATE.QUEUE_PENDING) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] 2 formats in a row.");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] 2 formats in a row."); }
             // We received two formats in a row. Clear the current buffer of any reconfiguration data
             // associated with the first format.
             bufferForRead.clear();
             mRendererReconfigurationState = RECONFIGURATION_STATE.WRITE_PENDING;
         }
         onInputFormatChanged(mFormatHolder.format);
     }
 
     @Override
-    protected void handleEndOfStream(final DecoderInputBuffer bufferForRead) {
+    protected void handleEndOfStream(DecoderInputBuffer bufferForRead) {
         if (mRendererReconfigurationState == RECONFIGURATION_STATE.QUEUE_PENDING) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] isEndOfStream.");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "[feedInput][QUEUE_PENDING] isEndOfStream."); }
             // We received a new format immediately before the end of the stream. We need to clear
             // the corresponding reconfiguration data from the current buffer, but re-write it into
             // a subsequent buffer if there are any (e.g. if the user seeks backwards).
             bufferForRead.clear();
             mRendererReconfigurationState = RECONFIGURATION_STATE.WRITE_PENDING;
         }
         mInputStreamEnded = true;
         GeckoHLSSample sample = GeckoHLSSample.EOS;
         calculatDuration(sample);
     }
 
     @Override
-    protected void handleSamplePreparation(final DecoderInputBuffer bufferForRead) {
+    protected void handleSamplePreparation(DecoderInputBuffer bufferForRead) {
         int csdInfoSize = mCSDInfo != null ? mCSDInfo.length : 0;
         int dataSize = bufferForRead.data.limit();
         int size = bufferForRead.isKeyFrame() ? csdInfoSize + dataSize : dataSize;
         byte[] realData = new byte[size];
         if (bufferForRead.isKeyFrame()) {
             // Prepend the CSD information to the sample if it's a key frame.
             System.arraycopy(mCSDInfo, 0, realData, 0, csdInfoSize);
             bufferForRead.data.get(realData, csdInfoSize, dataSize);
@@ -259,100 +248,89 @@ public class GeckoHlsVideoRenderer exten
 
         // There's no duration information from the ExoPlayer's sample, we need
         // to calculate it.
         calculatDuration(sample);
         mRendererReconfigurationState = RECONFIGURATION_STATE.NONE;
     }
 
     @Override
-    protected void onPositionReset(final long positionUs, final boolean joining) {
+    protected void onPositionReset(long positionUs, boolean joining) {
         super.onPositionReset(positionUs, joining);
         if (mInitialized && mRendererReconfigured && mFormats.size() != 0) {
-            if (DEBUG) {
-                Log.d(LOGTAG, "[onPositionReset] WRITE_PENDING");
-            }
+            if (DEBUG) { Log.d(LOGTAG, "[onPositionReset] WRITE_PENDING"); }
             // Any reconfiguration data that we put shortly before the reset
             // may be invalid. We avoid this issue by sending reconfiguration
             // data following every position reset.
             mRendererReconfigurationState = RECONFIGURATION_STATE.WRITE_PENDING;
         }
     }
 
     @Override
     protected boolean clearInputSamplesQueue() {
-        if (DEBUG) {
-            Log.d(LOGTAG, "clearInputSamplesQueue");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "clearInputSamplesQueue"); }
         mDemuxedInputSamples.clear();
         mDemuxedNoDurationSamples.clear();
         return true;
     }
 
     @Override
-    protected boolean canReconfigure(final Format oldFormat, final Format newFormat) {
+    protected boolean canReconfigure(Format oldFormat, Format newFormat) {
         boolean canReconfig = areAdaptationCompatible(oldFormat, newFormat)
-                && newFormat.width <= mCodecMaxValues.width
-                && newFormat.height <= mCodecMaxValues.height
-                && newFormat.maxInputSize <= mCodecMaxValues.inputSize;
-        if (DEBUG) {
-            Log.d(LOGTAG, "[canReconfigure] : " + canReconfig);
-        }
+          && newFormat.width <= mCodecMaxValues.width && newFormat.height <= mCodecMaxValues.height
+          && newFormat.maxInputSize <= mCodecMaxValues.inputSize;
+        if (DEBUG) { Log.d(LOGTAG, "[canReconfigure] : " + canReconfig); }
         return canReconfig;
     }
 
     @Override
     protected void prepareReconfiguration() {
-        if (DEBUG) {
-            Log.d(LOGTAG, "[onInputFormatChanged] starting reconfiguration !");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "[onInputFormatChanged] starting reconfiguration !"); }
         mRendererReconfigured = true;
         mRendererReconfigurationState = RECONFIGURATION_STATE.WRITE_PENDING;
     }
 
     @Override
-    protected void updateCSDInfo(final Format format) {
+    protected void updateCSDInfo(Format format) {
         int size = 0;
         for (int i = 0; i < format.initializationData.size(); i++) {
             size += format.initializationData.get(i).length;
         }
         int startPos = 0;
         mCSDInfo = new byte[size];
         for (int i = 0; i < format.initializationData.size(); i++) {
             byte[] data = format.initializationData.get(i);
             System.arraycopy(data, 0, mCSDInfo, startPos, data.length);
             startPos += data.length;
         }
-        if (DEBUG) {
-            Log.d(LOGTAG, "mCSDInfo [" + Utils.bytesToHex(mCSDInfo) + "]");
-        }
+        if (DEBUG) { Log.d(LOGTAG, "mCSDInfo [" + Utils.bytesToHex(mCSDInfo) + "]"); }
     }
 
     @Override
-    protected void notifyPlayerInputFormatChanged(final Format newFormat) {
+    protected void notifyPlayerInputFormatChanged(Format newFormat) {
         mPlayerEventDispatcher.onVideoInputFormatChanged(newFormat);
     }
 
-    private void calculateSamplesWithin(final GeckoHLSSample[] samples, final int range) {
+    private void calculateSamplesWithin(GeckoHLSSample[] samples, int range) {
         // Calculate the first 'range' elements.
         for (int i = 0; i < range; i++) {
             // Comparing among samples in the window.
             for (int j = -2; j < 14; j++) {
                 if (i + j >= 0 &&
                     i + j < range &&
                     samples[i + j].info.presentationTimeUs > samples[i].info.presentationTimeUs) {
                     samples[i].duration =
                         Math.min(samples[i].duration,
                                  samples[i + j].info.presentationTimeUs - samples[i].info.presentationTimeUs);
                 }
             }
         }
     }
 
-    private void calculatDuration(final GeckoHLSSample inputSample) {
+    private void calculatDuration(GeckoHLSSample inputSample) {
         /*
          * NOTE :
          * Since we customized renderer as a demuxer. Here we're not able to
          * obtain duration from the DecoderInputBuffer as there's no duration inside.
          * So we calcualte it by referring to nearby samples' timestamp.
          * A temporary queue |mDemuxedNoDurationSamples| is used to queue demuxed
          * samples from HlsMediaSource which have no duration information at first.
          * We're choosing 16 as the comparing window size, because it's commonly
@@ -393,19 +371,17 @@ public class GeckoHlsVideoRenderer exten
 
             // NOTE : We're not able to calculate the duration for the last sample.
             //        A workaround here is to assign a close duration to it.
             long prevDuration = 33333;
             GeckoHLSSample sample = null;
             for (sample = mDemuxedNoDurationSamples.poll(); sample != null; sample = mDemuxedNoDurationSamples.poll()) {
                 if (sample.duration == Long.MAX_VALUE) {
                     sample.duration = prevDuration;
-                    if (DEBUG) {
-                        Log.d(LOGTAG, "Adjust the PTS of the last sample to " + sample.duration + " (us)");
-                    }
+                    if (DEBUG) { Log.d(LOGTAG, "Adjust the PTS of the last sample to " + sample.duration + " (us)"); }
                 }
                 prevDuration = sample.duration;
                 if (DEBUG) {
                     Log.d(LOGTAG, "last loop to offer samples - PTS : " +
                                   sample.info.presentationTimeUs + ", Duration : " +
                                   sample.duration + ", isEOS : " + sample.isEOS());
                 }
                 mDemuxedInputSamples.offer(sample);
@@ -424,36 +400,35 @@ public class GeckoHlsVideoRenderer exten
                 nextKeyFrameTime = sample.info.presentationTimeUs;
                 break;
             }
         }
         return nextKeyFrameTime;
     }
 
     @Override
-    protected void onStreamChanged(final Format[] formats) {
+    protected void onStreamChanged(Format[] formats) {
         mStreamFormats = formats;
     }
 
-    private static CodecMaxValues getCodecMaxValues(final Format format,
-                                                    final Format[] streamFormats) {
+    private static CodecMaxValues getCodecMaxValues(Format format, Format[] streamFormats) {
         int maxWidth = format.width;
         int maxHeight = format.height;
         int maxInputSize = getMaxInputSize(format);
         for (Format streamFormat : streamFormats) {
             if (areAdaptationCompatible(format, streamFormat)) {
                 maxWidth = Math.max(maxWidth, streamFormat.width);
                 maxHeight = Math.max(maxHeight, streamFormat.height);
                 maxInputSize = Math.max(maxInputSize, getMaxInputSize(streamFormat));
             }
         }
         return new CodecMaxValues(maxWidth, maxHeight, maxInputSize);
     }
 
-    private static int getMaxInputSize(final Format format) {
+    private static int getMaxInputSize(Format format) {
         if (format.maxInputSize != Format.NO_VALUE) {
             // The format defines an explicit maximum input size.
             return format.maxInputSize;
         }
 
         if (format.width == Format.NO_VALUE || format.height == Format.NO_VALUE) {
             // We can't infer a maximum input size without video dimensions.
             return Format.NO_VALUE;
@@ -471,28 +446,28 @@ public class GeckoHlsVideoRenderer exten
             default:
                 // Leave the default max input size.
                 return Format.NO_VALUE;
         }
         // Estimate the maximum input size assuming three channel 4:2:0 subsampled input frames.
         return (maxPixels * 3) / (2 * minCompressionRatio);
     }
 
-    private static boolean areAdaptationCompatible(final Format first, final Format second) {
+    private static boolean areAdaptationCompatible(Format first, Format second) {
         return first.sampleMimeType.equals(second.sampleMimeType) &&
                getRotationDegrees(first) == getRotationDegrees(second);
     }
 
-    private static int getRotationDegrees(final Format format) {
+    private static int getRotationDegrees(Format format) {
         return format.rotationDegrees == Format.NO_VALUE ? 0 : format.rotationDegrees;
     }
 
     private static final class CodecMaxValues {
         public final int width;
         public final int height;
         public final int inputSize;
-        public CodecMaxValues(final int width, final int height, final int inputSize) {
+        public CodecMaxValues(int width, int height, int inputSize) {
             this.width = width;
             this.height = height;
             this.inputSize = inputSize;
         }
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV21.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV21.java
@@ -1,14 +1,15 @@
 /* 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/. */
 
 package org.mozilla.gecko.media;
 
+import java.lang.*;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLEncoder;
 import java.nio.ByteBuffer;
@@ -20,17 +21,19 @@ import java.util.ArrayDeque;
 import android.annotation.SuppressLint;
 import android.annotation.TargetApi;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.media.DeniedByServerException;
 import android.media.MediaCrypto;
+import android.media.MediaCryptoException;
 import android.media.MediaDrm;
+import android.media.MediaDrmException;
 import android.media.NotProvisionedException;
 import android.util.Log;
 
 import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.ProxySelector;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
 public class GeckoMediaDrmBridgeV21 implements GeckoMediaDrm {
@@ -66,53 +69,53 @@ public class GeckoMediaDrmBridgeV21 impl
 
     // Store session data while provisioning
     private static class PendingCreateSessionData {
         public final int mToken;
         public final int mPromiseId;
         public final byte[] mInitData;
         public final String mMimeType;
 
-        private PendingCreateSessionData(final int token, final int promiseId,
-                                         final byte[] initData, final String mimeType) {
+        private PendingCreateSessionData(int token, int promiseId,
+                                         byte[] initData, String mimeType) {
             mToken = token;
             mPromiseId = promiseId;
             mInitData = initData;
             mMimeType = mimeType;
         }
     }
 
-    public boolean isSecureDecoderComonentRequired(final String mimeType) {
+    public boolean isSecureDecoderComonentRequired(String mimeType) {
         if (mCrypto != null) {
             return mCrypto.requiresSecureDecoderComponent(mimeType);
         }
         return false;
-    }
+      }
 
-    private static void assertTrue(final boolean condition) {
-        if (DEBUG && !condition) {
-            throw new AssertionError("Expected condition to be true");
-        }
+    private static void assertTrue(boolean condition) {
+      if (DEBUG && !condition) {
+        throw new AssertionError("Expected condition to be true");
+      }
     }
 
     @SuppressLint("WrongConstant")
     private void configureVendorSpecificProperty() {
         assertTrue(mDrm != null);
         if (mDrm == null) {
             return;
         }
         // Support L3 for now
         mDrm.setPropertyString("securityLevel", "L3");
         // Refer to chromium, set multi-session mode for Widevine.
         if (mSchemeUUID.equals(WIDEVINE_SCHEME_UUID)) {
             mDrm.setPropertyString("sessionSharing", "enable");
         }
     }
 
-    GeckoMediaDrmBridgeV21(final String keySystem) throws Exception {
+    GeckoMediaDrmBridgeV21(String keySystem) throws Exception {
         LOGTAG = getClass().getSimpleName();
         if (DEBUG) Log.d(LOGTAG, "GeckoMediaDrmBridgeV21 ctor");
 
         mProvisioningPromiseId = 0;
         mSessionIds = new HashSet<ByteBuffer>();
         mSessionMIMETypes = new HashMap<ByteBuffer, String>();
         mPendingCreateSessionDataQueue = new ArrayDeque<PendingCreateSessionData>();
 
@@ -133,26 +136,26 @@ public class GeckoMediaDrmBridgeV21 impl
         } catch (android.media.NotProvisionedException e) {
             if (DEBUG) Log.d(LOGTAG, "Device not provisioned:" + e.getMessage());
             startProvisioning(MAX_PROMISE_ID);
         }
 
     }
 
     @Override
-    public void setCallbacks(final GeckoMediaDrm.Callbacks callbacks) {
+    public void setCallbacks(GeckoMediaDrm.Callbacks callbacks) {
         assertTrue(callbacks != null);
         mCallbacks = callbacks;
     }
 
     @Override
-    public void createSession(final int createSessionToken,
-                              final int promiseId,
-                              final String initDataType,
-                              final byte[] initData) {
+    public void createSession(int createSessionToken,
+                              int promiseId,
+                              String initDataType,
+                              byte[] initData) {
         if (DEBUG) Log.d(LOGTAG, "createSession()");
         if (mDrm == null) {
             onRejectPromise(promiseId, "MediaDrm instance doesn't exist !!");
             return;
         }
 
         if (mProvisioningPromiseId > 0 && mCrypto == null) {
             if (DEBUG) Log.d(LOGTAG, "Pending createSession because it's provisioning !");
@@ -201,19 +204,19 @@ public class GeckoMediaDrmBridgeV21 impl
             }
             savePendingCreateSessionData(createSessionToken, promiseId,
                                          initData, initDataType);
             startProvisioning(promiseId);
         }
     }
 
     @Override
-    public void updateSession(final int promiseId,
-                              final String sessionId,
-                              final byte[] response) {
+    public void updateSession(int promiseId,
+                              String sessionId,
+                              byte[] response) {
         if (DEBUG) Log.d(LOGTAG, "updateSession(), sessionId = " + sessionId);
         if (mDrm == null) {
             onRejectPromise(promiseId, "MediaDrm instance doesn't exist !!");
             return;
         }
 
         ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes(StringUtils.UTF_8));
         if (!sessionExists(session)) {
@@ -238,17 +241,17 @@ public class GeckoMediaDrmBridgeV21 impl
             onSessionError(session.array(), "Got exception during updateSession.");
             onRejectPromise(promiseId, "Got exception during updateSession.");
         }
         release();
         return;
     }
 
     @Override
-    public void closeSession(final int promiseId, final String sessionId) {
+    public void closeSession(int promiseId, String sessionId) {
         if (DEBUG) Log.d(LOGTAG, "closeSession()");
         if (mDrm == null) {
             onRejectPromise(promiseId, "MediaDrm instance doesn't exist !!");
             return;
         }
 
         ByteBuffer session = ByteBuffer.wrap(sessionId.getBytes(StringUtils.UTF_8));
         mSessionIds.remove(session);
@@ -307,82 +310,83 @@ public class GeckoMediaDrmBridgeV21 impl
         if (DEBUG) Log.d(LOGTAG, "setServerCertificate()");
         if (mDrm == null) {
             throw new IllegalStateException("MediaDrm instance doesn't exist !!");
         }
         mDrm.setPropertyByteArray("serviceCertificate", cert);
         return;
     }
 
-    protected void HandleKeyStatusChangeByDummyKey(final String sessionId) {
+    protected void HandleKeyStatusChangeByDummyKey(String sessionId)
+    {
         SessionKeyInfo[] keyInfos = new SessionKeyInfo[1];
         keyInfos[0] = new SessionKeyInfo(DUMMY_KEY_ID,
                                          MediaDrm.KeyStatus.STATUS_USABLE);
         onSessionBatchedKeyChanged(sessionId.getBytes(), keyInfos);
         if (DEBUG) Log.d(LOGTAG, "Key successfully added for session " + sessionId);
     }
 
-    protected void onSessionCreated(final int createSessionToken,
-                                    final int promiseId,
-                                    final byte[] sessionId,
-                                    final byte[] request) {
+    protected void onSessionCreated(int createSessionToken,
+                                    int promiseId,
+                                    byte[] sessionId,
+                                    byte[] request) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onSessionCreated(createSessionToken, promiseId, sessionId, request);
         }
     }
 
-    protected void onSessionUpdated(final int promiseId, final byte[] sessionId) {
+    protected void onSessionUpdated(int promiseId, byte[] sessionId) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onSessionUpdated(promiseId, sessionId);
         }
     }
 
-    protected void onSessionClosed(final int promiseId, final byte[] sessionId) {
+    protected void onSessionClosed(int promiseId, byte[] sessionId) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onSessionClosed(promiseId, sessionId);
         }
     }
 
-    protected void onSessionMessage(final byte[] sessionId,
-                                    final int sessionMessageType,
-                                    final byte[] request) {
+    protected void onSessionMessage(byte[] sessionId,
+                                    int sessionMessageType,
+                                    byte[] request) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onSessionMessage(sessionId, sessionMessageType, request);
         }
     }
 
-    protected void onSessionError(final byte[] sessionId, final String message) {
+    protected void onSessionError(byte[] sessionId, String message) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onSessionError(sessionId, message);
         }
     }
 
-    protected void  onSessionBatchedKeyChanged(final byte[] sessionId,
-                                               final SessionKeyInfo[] keyInfos) {
+    protected void  onSessionBatchedKeyChanged(byte[] sessionId,
+                                               SessionKeyInfo[] keyInfos) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onSessionBatchedKeyChanged(sessionId, keyInfos);
         }
     }
 
-    protected void onRejectPromise(final int promiseId, final String message) {
+    protected void onRejectPromise(int promiseId, String message) {
         assertTrue(mCallbacks != null);
         if (mCallbacks != null) {
             mCallbacks.onRejectPromise(promiseId, message);
         }
     }
 
-    private MediaDrm.KeyRequest getKeyRequest(final ByteBuffer aSession,
-                                              final byte[] data,
-                                              final String mimeType)
+    private MediaDrm.KeyRequest getKeyRequest(ByteBuffer aSession,
+                                              byte[] data,
+                                              String mimeType)
         throws android.media.NotProvisionedException {
         if (mProvisioningPromiseId > 0) {
             // Now provisioning.
             return null;
         }
 
         try {
             HashMap<String, String> optionalParameters = new HashMap<String, String>();
@@ -394,18 +398,18 @@ public class GeckoMediaDrmBridgeV21 impl
         } catch (Exception e) {
             Log.e(LOGTAG, "Got excpetion during MediaDrm.getKeyRequest", e);
         }
         return null;
     }
 
     private class MediaDrmListener implements MediaDrm.OnEventListener {
         @Override
-        public void onEvent(final MediaDrm mediaDrm, final byte[] sessionArray, final int event,
-                            final int extra, final byte[] data) {
+        public void onEvent(MediaDrm mediaDrm, byte[] sessionArray, int event,
+                            int extra, byte[] data) {
             if (DEBUG) Log.d(LOGTAG, "MediaDrmListener.onEvent()");
             if (sessionArray == null) {
                 if (DEBUG) Log.d(LOGTAG, "MediaDrmListener: Null session.");
                 return;
             }
             ByteBuffer session = ByteBuffer.wrap(sessionArray);
             if (!sessionExists(session)) {
                 if (DEBUG) Log.d(LOGTAG, "MediaDrmListener: Invalid session.");
@@ -450,17 +454,17 @@ public class GeckoMediaDrmBridgeV21 impl
         } catch (android.media.MediaDrmException e) {
             // Other MediaDrmExceptions (e.g. ResourceBusyException) are not
             // recoverable.
             release();
             return null;
         }
     }
 
-    protected boolean sessionExists(final ByteBuffer session) {
+    protected boolean sessionExists(ByteBuffer session) {
         if (mCryptoSessionId == null) {
             if (DEBUG) Log.d(LOGTAG, "Session doesn't exist because media crypto session is not created.");
             return false;
         }
         if (session == null) {
             if (DEBUG) Log.d(LOGTAG, "Session is null, not in map !");
             return false;
         }
@@ -470,24 +474,24 @@ public class GeckoMediaDrmBridgeV21 impl
     private class PostRequestTask extends AsyncTask<Void, Void, Void> {
         private static final String LOGTAG = "PostRequestTask";
 
         private int mPromiseId;
         private String mURL;
         private byte[] mDrmRequest;
         private byte[] mResponseBody;
 
-        PostRequestTask(final int promiseId, final String url, final byte[] drmRequest) {
+        PostRequestTask(int promiseId, String url, byte[] drmRequest) {
             this.mPromiseId = promiseId;
             this.mURL = url;
             this.mDrmRequest = drmRequest;
         }
 
         @Override
-        protected Void doInBackground(final Void... params) {
+        protected Void doInBackground(Void... params) {
             HttpURLConnection urlConnection = null;
             BufferedReader in = null;
             try {
                 URI finalURI = new URI(mURL + "&signedRequest=" + URLEncoder.encode(new String(mDrmRequest), "UTF-8"));
                 urlConnection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(finalURI);
                 urlConnection.setRequestMethod("POST");
                 if (DEBUG) Log.d(LOGTAG, "Provisioning, posting url =" + finalURI.toString());
 
@@ -530,42 +534,42 @@ public class GeckoMediaDrmBridgeV21 impl
                 } catch (IOException e) {
                     Log.e(LOGTAG, "Exception during closing in ...", e);
                 }
             }
             return null;
         }
 
         @Override
-        protected void onPostExecute(final Void v) {
+        protected void onPostExecute(Void v) {
             onProvisionResponse(mPromiseId, mResponseBody);
         }
     }
 
-    private boolean provideProvisionResponse(final byte[] response) {
+    private boolean provideProvisionResponse(byte[] response) {
         if (response == null || response.length == 0) {
             if (DEBUG) Log.d(LOGTAG, "Invalid provision response.");
             return false;
         }
 
         try {
             mDrm.provideProvisionResponse(response);
             return true;
         } catch (android.media.DeniedByServerException e) {
             if (DEBUG) Log.d(LOGTAG, "Failed to provide provision response:" + e.getMessage());
         } catch (java.lang.IllegalStateException e) {
             if (DEBUG) Log.d(LOGTAG, "Failed to provide provision response:" + e.getMessage());
         }
         return false;
     }
 
-    private void savePendingCreateSessionData(final int token,
-                                              final int promiseId,
-                                              final byte[] initData,
-                                              final String mime) {
+    private void savePendingCreateSessionData(int token,
+                                              int promiseId,
+                                              byte[] initData,
+                                              String mime) {
         if (DEBUG) Log.d(LOGTAG, "savePendingCreateSessionData, promiseId : " + promiseId);
         mPendingCreateSessionDataQueue.offer(new PendingCreateSessionData(token, promiseId, initData, mime));
     }
 
     private void processPendingCreateSessionData() {
         if (DEBUG) Log.d(LOGTAG, "processPendingCreateSessionData ... ");
 
         assertTrue(mProvisioningPromiseId == 0);
@@ -599,17 +603,17 @@ public class GeckoMediaDrmBridgeV21 impl
             @Override
             public void run() {
                 processPendingCreateSessionData();
             }
         });
     }
 
     // Only triggered when failed on {openSession, getKeyRequest}
-    private void startProvisioning(final int promiseId) {
+    private void startProvisioning(int promiseId) {
         if (DEBUG) Log.d(LOGTAG, "startProvisioning()");
         if (mProvisioningPromiseId > 0) {
             // Already in provisioning.
             return;
         }
         try {
             mProvisioningPromiseId = promiseId;
             @SuppressLint("NewApi") MediaDrm.ProvisionRequest request = mDrm.getProvisionRequest();
@@ -617,17 +621,17 @@ public class GeckoMediaDrmBridgeV21 impl
                 new PostRequestTask(promiseId, request.getDefaultUrl(), request.getData());
             postTask.execute();
         } catch (Exception e) {
             onRejectPromise(promiseId, "Exception happened in startProvisioning !");
             mProvisioningPromiseId = 0;
         }
     }
 
-    private void onProvisionResponse(final int promiseId, final byte[] response) {
+    private void onProvisionResponse(int promiseId, byte[] response) {
         if (DEBUG) Log.d(LOGTAG, "onProvisionResponse()");
 
         mProvisioningPromiseId = 0;
         boolean success = provideProvisionResponse(response);
         if (success) {
             // Promise will either be resovled / rejected in createSession during
             // resuming operations.
             resumePendingOperations();
@@ -663,22 +667,22 @@ public class GeckoMediaDrmBridgeV21 impl
             release();
             return false;
         } catch (android.media.NotProvisionedException e) {
             if (DEBUG) Log.d(LOGTAG, "ensureMediaCryptoCreated::Device not provisioned:" + e.getMessage());
             throw e;
         }
     }
 
-    private UUID convertKeySystemToSchemeUUID(final String keySystem) {
-        if (WIDEVINE_KEY_SYSTEM.equals(keySystem)) {
-            return WIDEVINE_SCHEME_UUID;
-        }
-        if (DEBUG) Log.d(LOGTAG, "Cannot convert unsupported key system : " + keySystem);
-        return new UUID(0L, 0L);
+    private UUID convertKeySystemToSchemeUUID(String keySystem) {
+      if (WIDEVINE_KEY_SYSTEM.equals(keySystem)) {
+          return WIDEVINE_SCHEME_UUID;
+      }
+      if (DEBUG) Log.d(LOGTAG, "Cannot convert unsupported key system : " + keySystem);
+      return new UUID(0L, 0L);
     }
 
     private String getCDMUserAgent() {
         // This user agent is found and hard-coded in Android(L) source code and
         // Chromium project. Not sure if it's gonna change in the future.
         String ua = "Widevine CDM v1.0";
         return ua;
     }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV23.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoMediaDrmBridgeV23.java
@@ -1,50 +1,56 @@
 /* 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/. */
 
 package org.mozilla.gecko.media;
 
 import android.annotation.TargetApi;
+import android.media.DeniedByServerException;
+import android.media.NotProvisionedException;
 
 import static android.os.Build.VERSION_CODES.M;
 import android.media.MediaDrm;
 import android.util.Log;
+import java.lang.IllegalStateException;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
 import java.util.List;
 
 @TargetApi(M)
 public class GeckoMediaDrmBridgeV23 extends GeckoMediaDrmBridgeV21 {
     private static final boolean DEBUG = false;
 
-    GeckoMediaDrmBridgeV23(final String keySystem) throws Exception {
+    GeckoMediaDrmBridgeV23(String keySystem) throws Exception {
         super(keySystem);
         if (DEBUG) Log.d(LOGTAG, "GeckoMediaDrmBridgeV23 ctor");
         mDrm.setOnKeyStatusChangeListener(new KeyStatusChangeListener(), null);
     }
 
     private class KeyStatusChangeListener implements MediaDrm.OnKeyStatusChangeListener {
         @Override
-        public void onKeyStatusChange(final MediaDrm mediaDrm,
-                                      final byte[] sessionId,
-                                      final List<MediaDrm.KeyStatus> keyInformation,
-                                      final boolean hasNewUsableKey) {
+        public void onKeyStatusChange(MediaDrm mediaDrm,
+                                      byte[] sessionId,
+                                      List<MediaDrm.KeyStatus> keyInformation,
+                                      boolean hasNewUsableKey) {
             if (DEBUG) Log.d(LOGTAG, "[onKeyStatusChange] hasNewUsableKey = " + hasNewUsableKey);
             if (keyInformation.size() == 0) {
                 return;
             }
             SessionKeyInfo[] keyInfos = new SessionKeyInfo[keyInformation.size()];
             for (int i = 0; i < keyInformation.size(); i++) {
                 MediaDrm.KeyStatus keyStatus = keyInformation.get(i);
                 keyInfos[i] = new SessionKeyInfo(keyStatus.getKeyId(),
                                                  keyStatus.getStatusCode());
             }
             onSessionBatchedKeyChanged(sessionId, keyInfos);
             if (DEBUG) Log.d(LOGTAG, "Key successfully added for session " + new String(sessionId));
         }
     }
 
     @Override
-    protected void HandleKeyStatusChangeByDummyKey(final String sessionId) {
+    protected void HandleKeyStatusChangeByDummyKey(String sessionId)
+    {
         // MediaDrm.KeyStatus information listener is supported on M+, there is no need to use
         // dummy key id to report key status anymore.
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoPlayerFactory.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoPlayerFactory.java
@@ -19,26 +19,26 @@ public final class GeckoPlayerFactory {
             sPlayerList.add(player);
             return player;
         } catch (Exception e) {
             Log.e("GeckoPlayerFactory", "Class GeckoHlsPlayer not found or failed to create", e);
         }
         return null;
     }
 
-    synchronized static BaseHlsPlayer getPlayer(final int id) {
+    synchronized static BaseHlsPlayer getPlayer(int id) {
         for (BaseHlsPlayer player : sPlayerList) {
             if (player.getId() == id) {
                 return player;
             }
         }
         Log.w("GeckoPlayerFactory", "No player found with id : " + id);
         return null;
     }
 
-    synchronized static void removePlayer(final @NonNull BaseHlsPlayer player) {
+    synchronized static void removePlayer(@NonNull BaseHlsPlayer player) {
         int index = sPlayerList.indexOf(player);
         if (index >= 0) {
             sPlayerList.remove(player);
             Log.d("GeckoPlayerFactory", "HlsPlayer with id(" + player.getId() + ") is removed.");
         }
     }
-}
+}
\ No newline at end of file
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoVideoInfo.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoVideoInfo.java
@@ -1,34 +1,34 @@
 /* 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/. */
 
 package org.mozilla.gecko.media;
 
+import java.nio.ByteBuffer;
 import org.mozilla.gecko.annotation.WrapForJNI;
 
 //A subset of the class VideoInfo in dom/media/MediaInfo.h
 @WrapForJNI
 public final class GeckoVideoInfo {
     final public byte[] codecSpecificData;
     final public byte[] extraData;
     final public int displayWidth;
     final public int displayHeight;
     final public int pictureWidth;
     final public int pictureHeight;
     final public int rotation;
     final public int stereoMode;
     final public long duration;
     final public String mimeType;
-    public GeckoVideoInfo(final int displayWidth, final int displayHeight,
-                          final int pictureWidth, final int pictureHeight,
-                          final int rotation, final int stereoMode, final long duration,
-                          final String mimeType, final byte[] extraData,
-                          final byte[] codecSpecificData) {
+    public GeckoVideoInfo(int displayWidth, int displayHeight,
+                          int pictureWidth, int pictureHeight,
+                          int rotation, int stereoMode, long duration, String mimeType,
+                          byte[] extraData, byte[] codecSpecificData) {
         this.displayWidth = displayWidth;
         this.displayHeight = displayHeight;
         this.pictureWidth = pictureWidth;
         this.pictureHeight = pictureHeight;
         this.rotation = rotation;
         this.stereoMode = stereoMode;
         this.duration = duration;
         this.mimeType = mimeType;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
@@ -29,17 +29,17 @@ final class JellyBeanAsyncCodec implemen
     private static final String LOGTAG = "GeckoAsyncCodecAPIv16";
     private static final boolean DEBUG = false;
 
     private static final int ERROR_CODEC = -10000;
 
     private abstract class CancelableHandler extends Handler {
         private static final int MSG_CANCELLATION = 0x434E434C; // 'CNCL'
 
-        protected CancelableHandler(final Looper looper) {
+        protected CancelableHandler(Looper looper) {
             super(looper);
         }
 
         protected void cancel() {
             removeCallbacksAndMessages(null);
             sendEmptyMessage(MSG_CANCELLATION);
             // Wait until handleMessageLocked() is done.
             synchronized (this) { }
@@ -48,92 +48,90 @@ final class JellyBeanAsyncCodec implemen
         protected boolean isCanceled() {
             return hasMessages(MSG_CANCELLATION);
         }
 
         // Subclass should implement this and return true if it handles msg.
         // Warning: Never, ever call super.handleMessage() in this method!
         protected abstract boolean handleMessageLocked(Message msg);
 
-        public final void handleMessage(final Message msg) {
+        public final void handleMessage(Message msg) {
             // Block cancel() during handleMessageLocked().
             synchronized (this) {
                 if (isCanceled() || handleMessageLocked(msg)) {
                     return;
                 }
             }
 
             switch (msg.what) {
                 case MSG_CANCELLATION:
                     // Just a marker. Nothing to do here.
-                    if (DEBUG) {
-                        Log.d(LOGTAG, "handler " + this + " done cancellation, codec=" + JellyBeanAsyncCodec.this);
-                    }
+                    if (DEBUG) { Log.d(LOGTAG, "handler " + this + " done cancellation, codec=" + JellyBeanAsyncCodec.this); }
                     break;
                 default:
                     super.handleMessage(msg);
                     break;
             }
         }
-    }
+     }
 
     // A handler to invoke AsyncCodec.Callbacks methods.
     private final class CallbackSender extends CancelableHandler {
         private static final int MSG_INPUT_BUFFER_AVAILABLE = 1;
         private static final int MSG_OUTPUT_BUFFER_AVAILABLE = 2;
         private static final int MSG_OUTPUT_FORMAT_CHANGE = 3;
         private static final int MSG_ERROR = 4;
         private Callbacks mCallbacks;
 
-        private CallbackSender(final Looper looper, final Callbacks callbacks) {
-            super(looper);
-            mCallbacks = callbacks;
+        private CallbackSender(Looper looper, Callbacks callbacks) {
+          super(looper);
+          mCallbacks = callbacks;
         }
 
-        public void notifyInputBuffer(final int index) {
+        public void notifyInputBuffer(int index) {
             if (isCanceled()) {
                 return;
             }
 
             Message msg = obtainMessage(MSG_INPUT_BUFFER_AVAILABLE);
             msg.arg1 = index;
             processMessage(msg);
         }
 
-        private void processMessage(final Message msg) {
+        private void processMessage(Message msg) {
             if (Looper.myLooper() == getLooper()) {
                 handleMessage(msg);
             } else {
                 sendMessage(msg);
             }
         }
 
-        public void notifyOutputBuffer(final int index, final MediaCodec.BufferInfo info) {
+        public void notifyOutputBuffer(int index, MediaCodec.BufferInfo info) {
             if (isCanceled()) {
                 return;
             }
 
             Message msg = obtainMessage(MSG_OUTPUT_BUFFER_AVAILABLE, info);
             msg.arg1 = index;
             processMessage(msg);
         }
 
-        public void notifyOutputFormat(final MediaFormat format) {
+        public void notifyOutputFormat(MediaFormat format) {
             if (isCanceled()) {
                 return;
             }
             processMessage(obtainMessage(MSG_OUTPUT_FORMAT_CHANGE, format));
         }
 
-        public void notifyError(final int result) {
+        public void notifyError(int result) {
             Log.e(LOGTAG, "codec error:" + result);
             processMessage(obtainMessage(MSG_ERROR, result, 0));
         }
 
-        protected boolean handleMessageLocked(final Message msg) {
+        protected boolean handleMessageLocked(Message msg) {
             switch (msg.what) {
                 case MSG_INPUT_BUFFER_AVAILABLE: // arg1: buffer index.
                     mCallbacks.onInputBufferAvailable(JellyBeanAsyncCodec.this,
                                                       msg.arg1);
                     break;
                 case MSG_OUTPUT_BUFFER_AVAILABLE: // arg1: buffer index, obj: info.
                     mCallbacks.onOutputBufferAvailable(JellyBeanAsyncCodec.this,
                                                        msg.arg1,
@@ -160,47 +158,47 @@ final class JellyBeanAsyncCodec implemen
     // automatically polling more buffer, use cancel() it inherits from
     // CancelableHandler.
     private final class BufferPoller extends CancelableHandler {
         private static final int MSG_POLL_INPUT_BUFFERS = 1;
         private static final int MSG_POLL_OUTPUT_BUFFERS = 2;
 
         private static final long DEQUEUE_TIMEOUT_US = 10000;
 
-        public BufferPoller(final Looper looper) {
+        public BufferPoller(Looper looper) {
             super(looper);
         }
 
-        private void schedulePollingIfNotCanceled(final int what) {
+        private void schedulePollingIfNotCanceled(int what) {
             if (isCanceled()) {
                 return;
             }
 
             schedulePolling(what);
         }
 
-        private void schedulePolling(final int what) {
+        private void schedulePolling(int what) {
             if (needsBuffer(what)) {
                 sendEmptyMessage(what);
             }
         }
 
-        private boolean needsBuffer(final int what) {
+        private boolean needsBuffer(int what) {
             if (mOutputEnded && (what == MSG_POLL_OUTPUT_BUFFERS)) {
                 return false;
             }
 
             if (mInputEnded && (what == MSG_POLL_INPUT_BUFFERS)) {
                 return false;
             }
 
             return true;
         }
 
-        protected boolean handleMessageLocked(final Message msg) {
+        protected boolean handleMessageLocked(Message msg) {
             try {
                 switch (msg.what) {
                     case MSG_POLL_INPUT_BUFFERS:
                         pollInputBuffer();
                         break;
                     case MSG_POLL_OUTPUT_BUFFERS:
                         pollOutputBuffer();
                         break;
@@ -260,65 +258,60 @@ final class JellyBeanAsyncCodec implemen
     private AsyncCodec.Callbacks mCallbacks;
     private CallbackSender mCallbackSender;
 
     private BufferPoller mBufferPoller;
     private volatile boolean mInputEnded;
     private volatile boolean mOutputEnded;
 
     // Must be called on a thread with looper.
-    /* package */ JellyBeanAsyncCodec(final String name) throws IOException {
+    /* package */ JellyBeanAsyncCodec(String name) throws IOException {
         mCodec = MediaCodec.createByCodecName(name);
         initBufferPoller(name + " buffer poller");
     }
 
-    private void initBufferPoller(final String name) {
+    private void initBufferPoller(String name) {
         if (mBufferPoller != null) {
             Log.e(LOGTAG, "poller already initialized");
             return;
         }
         HandlerThread thread = new HandlerThread(name);
         thread.start();
         mBufferPoller = new BufferPoller(thread.getLooper());
-        if (DEBUG) {
-            Log.d(LOGTAG, "start poller for codec:" + this + ", thread=" + thread.getThreadId());
-        }
+        if (DEBUG) { Log.d(LOGTAG, "start poller for codec:" + this + ", thread=" + thread.getThreadId()); }
     }
 
     @Override
-    public void setCallbacks(final AsyncCodec.Callbacks callbacks, final Handler handler) {
+    public void setCallbacks(AsyncCodec.Callbacks callbacks, Handler handler) {
         if (callbacks == null) {
             return;
         }
 
         Looper looper = (handler == null) ? null : handler.getLooper();
         if (looper == null) {
             // Use this thread if no handler supplied.
             looper = Looper.myLooper();
         }
         if (looper == null) {
             // This thread has no looper. Use poller thread.
             looper = mBufferPoller.getLooper();
         }
         mCallbackSender = new CallbackSender(looper, callbacks);
-        if (DEBUG) {
-            Log.d(LOGTAG, "setCallbacks(): sender=" + mCallbackSender);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "setCallbacks(): sender=" + mCallbackSender); }
     }
 
     @Override
-    public void configure(final MediaFormat format, final Surface surface,
-                          final MediaCrypto crypto, final int flags) {
+    public void configure(MediaFormat format, Surface surface, MediaCrypto crypto, int flags) {
         assertCallbacks();
 
         mCodec.configure(format, surface, crypto, flags);
     }
 
     @Override
-    public boolean isAdaptivePlaybackSupported(final String mimeType) {
+    public boolean isAdaptivePlaybackSupported(String mimeType) {
         return HardwareCodecCapabilityUtils.checkSupportsAdaptivePlayback(mCodec, mimeType);
     }
 
     @Override
     public boolean isTunneledPlaybackSupported(final String mimeType) {
         try {
             return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP
                    && mCodec.getCodecInfo()
@@ -350,27 +343,26 @@ final class JellyBeanAsyncCodec implemen
     @Override
     public void resumeReceivingInputs() {
         for (int i = 0; i < mInputBuffers.length; i++) {
             mBufferPoller.schedulePolling(BufferPoller.MSG_POLL_INPUT_BUFFERS);
         }
     }
 
     @Override
-    public final void setRates(final int newBitRate) {
+    public final void setRates(int newBitRate) {
         if (android.os.Build.VERSION.SDK_INT >= 19) {
             Bundle params = new Bundle();
             params.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE, newBitRate * 1000);
             mCodec.setParameters(params);
         }
     }
 
     @Override
-    public final void queueInputBuffer(final int index, final int offset, final int size,
-                                       final long presentationTimeUs, final int flags) {
+    public final void queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags) {
         assertCallbacks();
 
         mInputEnded = (flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
 
         if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
                 && ((flags & MediaCodec.BUFFER_FLAG_KEY_FRAME) != 0)) {
             Bundle params = new Bundle();
             params.putInt(MediaCodec.PARAMETER_KEY_REQUEST_SYNC_FRAME, 0);
@@ -385,21 +377,21 @@ final class JellyBeanAsyncCodec implemen
             return;
         }
 
         mBufferPoller.schedulePolling(BufferPoller.MSG_POLL_OUTPUT_BUFFERS);
         mBufferPoller.schedulePolling(BufferPoller.MSG_POLL_INPUT_BUFFERS);
     }
 
     @Override
-    public final void queueSecureInputBuffer(final int index,
-                                             final int offset,
-                                             final MediaCodec.CryptoInfo cryptoInfo,
-                                             final long presentationTimeUs,
-                                             final int flags) {
+    public final void queueSecureInputBuffer(int index,
+                                             int offset,
+                                             MediaCodec.CryptoInfo cryptoInfo,
+                                             long presentationTimeUs,
+                                             int flags) {
         assertCallbacks();
 
         mInputEnded = (flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
 
         try {
             mCodec.queueSecureInputBuffer(index, offset, cryptoInfo, presentationTimeUs, flags);
         } catch (IllegalStateException e) {
             e.printStackTrace();
@@ -407,31 +399,31 @@ final class JellyBeanAsyncCodec implemen
             return;
         }
 
         mBufferPoller.schedulePolling(BufferPoller.MSG_POLL_INPUT_BUFFERS);
         mBufferPoller.schedulePolling(BufferPoller.MSG_POLL_OUTPUT_BUFFERS);
     }
 
     @Override
-    public final void releaseOutputBuffer(final int index, final boolean render) {
+    public final void releaseOutputBuffer(int index, boolean render) {
         assertCallbacks();
 
         mCodec.releaseOutputBuffer(index, render);
     }
 
     @Override
-    public final ByteBuffer getInputBuffer(final int index) {
+    public final ByteBuffer getInputBuffer(int index) {
         assertCallbacks();
 
         return mInputBuffers[index];
     }
 
     @Override
-    public final ByteBuffer getOutputBuffer(final int index) {
+    public final ByteBuffer getOutputBuffer(int index) {
         assertCallbacks();
 
         return mOutputBuffers[index];
     }
 
     @Override
     public void flush() {
         assertCallbacks();
@@ -469,13 +461,11 @@ final class JellyBeanAsyncCodec implemen
         if (mBufferPoller == null) {
             Log.e(LOGTAG, "no initialized poller.");
             return;
         }
 
         mBufferPoller.getLooper().quit();
         mBufferPoller = null;
 
-        if (DEBUG) {
-            Log.d(LOGTAG, "stop poller " + this);
-        }
+        if (DEBUG) { Log.d(LOGTAG, "stop poller " + this); }
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
@@ -12,16 +12,17 @@ import android.media.MediaCodecInfo.Code
 import android.media.MediaCrypto;
 import android.media.MediaFormat;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 import android.support.annotation.NonNull;
+import android.util.Log;
 import android.view.Surface;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
 /* package */ final class LollipopAsyncCodec implements AsyncCodec {
     private final MediaCodec mCodec;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java
@@ -7,16 +7,18 @@ package org.mozilla.gecko.media;
 
 import java.util.ArrayList;
 import java.util.UUID;
 
 import org.mozilla.gecko.mozglue.JNIObject;
 import org.mozilla.gecko.annotation.WrapForJNI;
 
 import android.annotation.SuppressLint;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecList;
 import android.media.MediaCrypto;
 import android.media.MediaDrm;
 import android.os.Build;
 import android.util.Log;
 
 public final class MediaDrmProxy {
     private static final String LOGTAG = "GeckoMediaDrmProxy";
     private static final boolean DEBUG = false;
@@ -52,32 +54,32 @@ public final class MediaDrmProxy {
             if (DEBUG) Log.d(LOGTAG, "System Not supported !!, current SDK version is " + Build.VERSION.SDK_INT);
             return false;
         }
         return true;
     }
 
     @SuppressLint("NewApi")
     @WrapForJNI
-    public static boolean isSchemeSupported(final String keySystem) {
+    public static boolean isSchemeSupported(String keySystem) {
         if (!isSystemSupported()) {
             return false;
         }
         if (keySystem.equals(WIDEVINE_KEY_SYSTEM)) {
             return MediaDrm.isCryptoSchemeSupported(WIDEVINE_SCHEME_UUID)
                     && MediaCrypto.isCryptoSchemeSupported(WIDEVINE_SCHEME_UUID);
         }
         if (DEBUG) Log.d(LOGTAG, "isSchemeSupported key sytem = " + keySystem);
         return false;
     }
 
     @SuppressLint("NewApi")
     @WrapForJNI
-    public static boolean IsCryptoSchemeSupported(final String keySystem,
-                                                  final String container) {
+    public static boolean IsCryptoSchemeSupported(String keySystem,
+                                                  String container) {
         if (!isSystemSupported()) {
             return false;
         }
         if (keySystem.equals(WIDEVINE_KEY_SYSTEM)) {
             return MediaDrm.isCryptoSchemeSupported(WIDEVINE_SCHEME_UUID, container);
         }
         if (DEBUG) Log.d(LOGTAG, "cannot decrypt key sytem = " + keySystem + ", container = " + container);
         return false;
@@ -93,18 +95,18 @@ public final class MediaDrmProxy {
         void onSessionUpdated(int promiseId, byte[] sessionId);
 
         void onSessionClosed(int promiseId, byte[] sessionId);
 
         void onSessionMessage(byte[] sessionId,
                               int sessionMessageType,
                               byte[] request);
 
-        void onSessionError(byte[] sessionId,
-                            String message);
+       void onSessionError(byte[] sessionId,
+                           String message);
 
         // MediaDrm.KeyStatus is available in API level 23(M)
         // https://developer.android.com/reference/android/media/MediaDrm.KeyStatus.html
         // For compatibility between L and M above, we'll unwrap the KeyStatus structure
         // and store the keyid and status into SessionKeyInfo and pass to native(MediaDrmCDMProxy).
         void onSessionBatchedKeyChanged(byte[] sessionId,
                                         SessionKeyInfo[] keyInfos);
 
@@ -158,127 +160,127 @@ public final class MediaDrmProxy {
         }
     } // NativeMediaDrmProxyCallbacks
 
     // A proxy to callback from LocalMediaDrmBridge to native instance.
     public static class MediaDrmProxyCallbacks implements GeckoMediaDrm.Callbacks {
         private final Callbacks mNativeCallbacks;
         private final MediaDrmProxy mProxy;
 
-        public MediaDrmProxyCallbacks(final MediaDrmProxy proxy, final Callbacks callbacks) {
+        public MediaDrmProxyCallbacks(MediaDrmProxy proxy, Callbacks callbacks) {
             mNativeCallbacks = callbacks;
             mProxy = proxy;
         }
 
         @Override
-        public void onSessionCreated(final int createSessionToken,
-                                     final int promiseId,
-                                     final byte[] sessionId,
-                                     final byte[] request) {
+        public void onSessionCreated(int createSessionToken,
+                                     int promiseId,
+                                     byte[] sessionId,
+                                     byte[] request) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onSessionCreated(createSessionToken,
                                                   promiseId,
                                                   sessionId,
                                                   request);
             }
         }
 
         @Override
-        public void onSessionUpdated(final int promiseId, final byte[] sessionId) {
+        public void onSessionUpdated(int promiseId, byte[] sessionId) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onSessionUpdated(promiseId, sessionId);
             }
         }
 
         @Override
-        public void onSessionClosed(final int promiseId, final byte[] sessionId) {
+        public void onSessionClosed(int promiseId, byte[] sessionId) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onSessionClosed(promiseId, sessionId);
             }
         }
 
         @Override
-        public void onSessionMessage(final byte[] sessionId,
-                                     final int sessionMessageType,
-                                     final byte[] request) {
+        public void onSessionMessage(byte[] sessionId,
+                                     int sessionMessageType,
+                                     byte[] request) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onSessionMessage(sessionId, sessionMessageType, request);
             }
         }
 
         @Override
-        public void onSessionError(final byte[] sessionId,
-                                   final String message) {
+        public void onSessionError(byte[] sessionId,
+                                   String message) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onSessionError(sessionId, message);
             }
         }
 
         @Override
-        public void onSessionBatchedKeyChanged(final byte[] sessionId,
-                                               final SessionKeyInfo[] keyInfos) {
+        public void onSessionBatchedKeyChanged(byte[] sessionId,
+                                               SessionKeyInfo[] keyInfos) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onSessionBatchedKeyChanged(sessionId, keyInfos);
             }
         }
 
         @Override
-        public void onRejectPromise(final int promiseId,
-                                    final String message) {
+        public void onRejectPromise(int promiseId,
+                                    String message) {
             if (!mProxy.isDestroyed()) {
                 mNativeCallbacks.onRejectPromise(promiseId, message);
             }
         }
     } // MediaDrmProxyCallbacks
 
     public boolean isDestroyed() {
         return mDestroyed;
     }
 
     @WrapForJNI(calledFrom = "gecko")
-    public static MediaDrmProxy create(final String keySystem,
-                                       final Callbacks nativeCallbacks) {
+    public static MediaDrmProxy create(String keySystem,
+                                       Callbacks nativeCallbacks) {
         MediaDrmProxy proxy = new MediaDrmProxy(keySystem, nativeCallbacks);
         return proxy;
     }
 
-    MediaDrmProxy(final String keySystem, final Callbacks nativeCallbacks) {
+    MediaDrmProxy(String keySystem, Callbacks nativeCallbacks) {
         if (DEBUG) Log.d(LOGTAG, "Constructing MediaDrmProxy");
         try {
             mDrmStubId = UUID.randomUUID().toString();
             IMediaDrmBridge remoteBridge =
                 RemoteManager.getInstance().createRemoteMediaDrmBridge(keySystem, mDrmStubId);
             mImpl = new RemoteMediaDrmBridge(remoteBridge);
             mImpl.setCallbacks(new MediaDrmProxyCallbacks(this, nativeCallbacks));
             sProxyList.add(this);
         } catch (Exception e) {
             Log.e(LOGTAG, "Constructing MediaDrmProxy ... error", e);
         }
     }
 
     @WrapForJNI
-    private void createSession(final int createSessionToken,
-                               final int promiseId,
-                               final String initDataType,
-                               final byte[] initData) {
+    private void createSession(int createSessionToken,
+                               int promiseId,
+                               String initDataType,
+                               byte[] initData) {
         if (DEBUG) Log.d(LOGTAG, "createSession, promiseId = " + promiseId);
         mImpl.createSession(createSessionToken,
                             promiseId,
                             initDataType,
                             initData);
     }
 
     @WrapForJNI
-    private void updateSession(final int promiseId, final String sessionId, final byte[] response) {
+    private void updateSession(int promiseId, String sessionId, byte[] response) {
         if (DEBUG) Log.d(LOGTAG, "updateSession, primiseId(" + promiseId  + "sessionId(" + sessionId + ")");
         mImpl.updateSession(promiseId, sessionId, response);
     }
 
     @WrapForJNI
-    private void closeSession(final int promiseId, final String sessionId) {
+    private void closeSession(int promiseId, String sessionId) {
         if (DEBUG) Log.d(LOGTAG, "closeSession, primiseId(" + promiseId  + "sessionId(" + sessionId + ")");
         mImpl.closeSession(promiseId, sessionId);
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private String getStubId() {
         return mDrmStubId;
     }
@@ -291,17 +293,17 @@ public final class MediaDrmProxy {
         } catch (RuntimeException e) {
             return false;
         }
     }
 
     // Get corresponding MediaCrypto object by a generated UUID for MediaCodec.
     // Will be called on MediaFormatReader's TaskQueue.
     @WrapForJNI
-    public static MediaCrypto getMediaCrypto(final String stubId) {
+    public static MediaCrypto getMediaCrypto(String stubId) {
         for (MediaDrmProxy proxy : sProxyList) {
             if (proxy.getStubId().equals(stubId)) {
                 return proxy.getMediaCryptoFromBridge();
             }
         }
         if (DEBUG) Log.d(LOGTAG, " NULL crytpo ");
         return null;
     }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaManager.java
@@ -10,47 +10,47 @@ import android.os.Binder;
 import android.os.IBinder;
 import android.os.Process;
 import android.os.RemoteException;
 import android.util.Log;
 
 import org.mozilla.gecko.mozglue.GeckoLoader;
 
 public final class MediaManager extends Service {
-    private static final String LOGTAG = "GeckoMediaManager";
+    private static String LOGTAG = "GeckoMediaManager";
     private static boolean sNativeLibLoaded;
 
     private Binder mBinder = new IMediaManager.Stub() {
         @Override
         public ICodec createCodec() throws RemoteException {
             return new Codec();
         }
 
         @Override
-        public IMediaDrmBridge createRemoteMediaDrmBridge(final String keySystem,
-                                                          final String stubId)