From c2a5d5d71739039822ddd6ef6293ddacb4d2a81c Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Fri, 18 Jul 2014 16:47:08 -0700 Subject: [PATCH] Bug 1017242 - Part 4: remove API 8 code from GeckoAppShell. r=kats --- mobile/android/base/GeckoAppShell.java | 126 ++----------------------- 1 file changed, 7 insertions(+), 119 deletions(-) diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 433d06b6548..ac9015d79e1 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -8,18 +8,17 @@ package org.mozilla.gecko; import java.io.BufferedReader; import java.io.Closeable; import java.io.File; -import java.io.FileReader; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; -import java.net.URLConnection; -import java.net.MalformedURLException; import java.net.Proxy; import java.net.URL; +import java.net.URLConnection; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Iterator; @@ -44,7 +43,6 @@ import org.mozilla.gecko.mozglue.RobocopTarget; import org.mozilla.gecko.mozglue.generatorannotations.OptionalGeneratedParameter; import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI; import org.mozilla.gecko.prompts.PromptService; -import org.mozilla.gecko.util.GeckoEventListener; import org.mozilla.gecko.util.HardwareUtils; import org.mozilla.gecko.util.NativeJSContainer; import org.mozilla.gecko.util.ProxySelector; @@ -718,9 +716,6 @@ public class GeckoAppShell @WrapElementForJNI public static void startMonitoringGamepad() { - if (Build.VERSION.SDK_INT < 9) { - return; - } ThreadUtils.postToUiThread(new Runnable() { @Override public void run() { @@ -731,10 +726,6 @@ public class GeckoAppShell @WrapElementForJNI public static void stopMonitoringGamepad() { - if (Build.VERSION.SDK_INT < 9) { - return; - } - ThreadUtils.postToUiThread(new Runnable() { @Override public void run() { @@ -2177,17 +2168,12 @@ public class GeckoAppShell int[] result = new int[4]; result[0] = 0; - if (Build.VERSION.SDK_INT >= 9) { - if (android.hardware.Camera.getNumberOfCameras() == 0) - return result; + if (android.hardware.Camera.getNumberOfCameras() == 0) { + return result; } try { - // no front/back camera before API level 9 - if (Build.VERSION.SDK_INT >= 9) - sCamera = android.hardware.Camera.open(aCamera); - else - sCamera = android.hardware.Camera.open(); + sCamera = android.hardware.Camera.open(aCamera); android.hardware.Camera.Parameters params = sCamera.getParameters(); params.setPreviewFormat(ImageFormat.NV21); @@ -2419,113 +2405,15 @@ public class GeckoAppShell GeckoNetworkManager.getInstance().disableNotifications(); } - // values taken from android's Base64 - public static final int BASE64_DEFAULT = 0; - public static final int BASE64_URL_SAFE = 8; - - /** - * taken from http://www.source-code.biz/base64coder/java/Base64Coder.java.txt and modified (MIT License) - */ - // Mapping table from 6-bit nibbles to Base64 characters. - private static final byte[] map1 = new byte[64]; - private static final byte[] map1_urlsafe; - static { - int i=0; - for (byte c='A'; c<='Z'; c++) map1[i++] = c; - for (byte c='a'; c<='z'; c++) map1[i++] = c; - for (byte c='0'; c<='9'; c++) map1[i++] = c; - map1[i++] = '+'; map1[i++] = '/'; - map1_urlsafe = map1.clone(); - map1_urlsafe[62] = '-'; map1_urlsafe[63] = '_'; - } - - // Mapping table from Base64 characters to 6-bit nibbles. - private static final byte[] map2 = new byte[128]; - static { - for (int i=0; i 127 || i1 > 127 || i2 > 127 || i3 > 127) - throw new IllegalArgumentException ("Illegal character in Base64 encoded data."); - int b0 = map2[i0]; - int b1 = map2[i1]; - int b2 = map2[i2]; - int b3 = map2[i3]; - if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) - throw new IllegalArgumentException ("Illegal character in Base64 encoded data."); - int o0 = ( b0 <<2) | (b1>>>4); - int o1 = ((b1 & 0xf)<<4) | (b2>>>2); - int o2 = ((b2 & 3)<<6) | b3; - out[op++] = (byte)o0; - if (op