--- a/mobile/android/base/java/org/mozilla/gecko/Tab.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tab.java
@@ -30,17 +30,16 @@ import org.mozilla.gecko.util.ThreadUtil
import org.mozilla.gecko.webapps.WebAppIndexer;
import org.mozilla.gecko.widget.SiteLogins;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
-import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
public class Tab {
private static final String LOGTAG = "GeckoTab";
@@ -244,23 +243,19 @@ public class Tab {
}
public void setMostRecentHomePanelData(Bundle data) {
mMostRecentHomePanelData = data;
}
public Bitmap getThumbnailBitmap(int width, int height) {
if (mThumbnailBitmap != null) {
- // Bug 787318 - Honeycomb has a bug with bitmap caching, we can't
- // reuse the bitmap there.
- boolean honeycomb = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
- && Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2);
boolean sizeChange = mThumbnailBitmap.getWidth() != width
|| mThumbnailBitmap.getHeight() != height;
- if (honeycomb || sizeChange) {
+ if (sizeChange) {
mThumbnailBitmap = null;
}
}
if (mThumbnailBitmap == null) {
Bitmap.Config config = (GeckoAppShell.getScreenDepth() == 24) ?
Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
mThumbnailBitmap = Bitmap.createBitmap(width, height, config);
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
@@ -2182,33 +2182,22 @@ public final class BrowserDatabaseHelper
cursor = db.rawQuery("PRAGMA synchronous=NORMAL", null);
} finally {
if (cursor != null)
cursor.close();
}
// From Honeycomb on, it's possible to run several db
// commands in parallel using multiple connections.
- if (Build.VERSION.SDK_INT >= 11) {
- // Modern Android allows WAL to be enabled through a mode flag.
- if (Build.VERSION.SDK_INT < 16) {
- db.enableWriteAheadLogging();
+ // Modern Android allows WAL to be enabled through a mode flag.
+ if (Build.VERSION.SDK_INT < 16) {
+ db.enableWriteAheadLogging();
- // This does nothing on 16+.
- db.setLockingEnabled(false);
- }
- } else {
- // Pre-Honeycomb, we can do some lesser optimizations.
- cursor = null;
- try {
- cursor = db.rawQuery("PRAGMA journal_mode=PERSIST", null);
- } finally {
- if (cursor != null)
- cursor.close();
- }
+ // This does nothing on 16+.
+ db.setLockingEnabled(false);
}
}
// Calculate these once, at initialization. isLoggable is too expensive to
// have in-line in each log call.
private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
private static final boolean logVerbose = Log.isLoggable(LOGTAG, Log.VERBOSE);
protected static void trace(String message) {
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -381,23 +381,16 @@ public class GeckoPreferences
// likely other strange devices (other Asus devices, some Samsungs) could do the same.
super.onCreate(savedInstanceState);
if (onIsMultiPane()) {
// So that Android doesn't put the fragment title (or nothing at
// all) in the action bar.
updateActionBarTitle(R.string.settings_title);
- if (Build.VERSION.SDK_INT < 13) {
- // Affected by Bug 1015209 -- no detach/attach.
- // If we try rejigging fragments, we'll crash, so don't
- // enable locale switching at all.
- localeSwitchingIsEnabled = false;
- throw new IllegalStateException("foobar");
- }
}
// Use setResourceToOpen to specify these extras.
Bundle intentExtras = getIntent().getExtras();
EventDispatcher.getInstance().registerUiThreadListener(this, "Sanitize:Finished");
// Add handling for long-press click.
--- a/mobile/android/docs/localeswitching.rst
+++ b/mobile/android/docs/localeswitching.rst
@@ -32,26 +32,22 @@ Ideally, we also need to perform some am
``GeckoApp`` itself does some additional work, because it has particular performance constraints, and also is the typical root of the preferences activity.
Here's an example of the work that a typical activity should do::
// This is cribbed from o.m.g.sync.setup.activities.LocaleAware.
public static void initializeLocale(Context context) {
final LocaleManager localeManager = BrowserLocaleManager.getInstance();
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
- localeManager.getAndApplyPersistedLocale(context);
- } else {
- final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
- StrictMode.allowThreadDiskWrites();
- try {
+ final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
+ StrictMode.allowThreadDiskWrites();
+ try {
localeManager.getAndApplyPersistedLocale(context);
- } finally {
+ } finally {
StrictMode.setThreadPolicy(savedPolicy);
- }
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
final LocaleManager localeManager = BrowserLocaleManager.getInstance();
final Locale changed = localeManager.onSystemConfigurationChanged(this, getResources(), newConfig, mLastLocale);
if (changed != null) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java
@@ -368,27 +368,23 @@ public final class GeckoLoader {
final boolean dashTwoExists = new File(dashTwo).exists();
message.append(", -1x=" + dashOneExists);
message.append(", -2x=" + dashTwoExists);
} catch (Throwable e) {
message.append(", dash fail, ");
}
try {
- if (Build.VERSION.SDK_INT >= 9) {
- final String nativeLibPath = context.getApplicationInfo().nativeLibraryDir;
- final boolean nativeLibDirExists = new File(nativeLibPath).exists();
- final boolean nativeLibLibExists = new File(nativeLibPath + "/lib" + lib + ".so").exists();
+ final String nativeLibPath = context.getApplicationInfo().nativeLibraryDir;
+ final boolean nativeLibDirExists = new File(nativeLibPath).exists();
+ final boolean nativeLibLibExists = new File(nativeLibPath + "/lib" + lib + ".so").exists();
- message.append(", nativeLib: " + nativeLibPath);
- message.append(", dirx=" + nativeLibDirExists);
- message.append(", libx=" + nativeLibLibExists);
- } else {
- message.append(", <pre-9>");
- }
+ message.append(", nativeLib: " + nativeLibPath);
+ message.append(", dirx=" + nativeLibDirExists);
+ message.append(", libx=" + nativeLibLibExists);
} catch (Throwable e) {
message.append(", nativeLib fail.");
}
return message.toString();
}
private static final boolean attemptLoad(final String path) {
@@ -411,21 +407,16 @@ public final class GeckoLoader {
private static final Throwable doLoadLibraryExpected(final Context context, final String lib) {
try {
// Attempt 1: the way that should work.
System.loadLibrary(lib);
return null;
} catch (Throwable e) {
Log.wtf(LOGTAG, "Couldn't load " + lib + ". Trying native library dir.");
- if (Build.VERSION.SDK_INT < 9) {
- // We can't use nativeLibraryDir.
- return e;
- }
-
// Attempt 2: use nativeLibraryDir, which should also work.
final String libDir = context.getApplicationInfo().nativeLibraryDir;
final String libPath = libDir + "/lib" + lib + ".so";
// Does it even exist?
if (new File(libPath).exists()) {
if (attemptLoad(libPath)) {
// Success!
@@ -445,21 +436,19 @@ public final class GeckoLoader {
final Throwable e = doLoadLibraryExpected(context, lib);
if (e == null) {
// Success.
return;
}
// If we're in a mismatched UID state (Bug 1042935 Comment 16) there's really
// nothing we can do.
- if (Build.VERSION.SDK_INT >= 9) {
- final String nativeLibPath = context.getApplicationInfo().nativeLibraryDir;
- if (nativeLibPath.contains("mismatched_uid")) {
- throw new RuntimeException("Fatal: mismatched UID: cannot load.");
- }
+ final String nativeLibPath = context.getApplicationInfo().nativeLibraryDir;
+ if (nativeLibPath.contains("mismatched_uid")) {
+ throw new RuntimeException("Fatal: mismatched UID: cannot load.");
}
// Attempt 3: try finding the path the pseudo-supported way using .dataDir.
final String dataLibPath = context.getApplicationInfo().dataDir + "/lib/lib" + lib + ".so";
if (attemptLoad(dataLibPath)) {
return;
}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GamepadUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GamepadUtils.java
@@ -19,19 +19,16 @@ public final class GamepadUtils {
private static View.OnKeyListener sClickDispatcher;
private static float sDeadZoneThresholdOverride = 1e-2f;
private GamepadUtils() {
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
private static boolean isGamepadKey(KeyEvent event) {
- if (Build.VERSION.SDK_INT < 12) {
- return false;
- }
return (event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD;
}
public static boolean isActionKey(KeyEvent event) {
return (isGamepadKey(event) && (event.getKeyCode() == KeyEvent.KEYCODE_BUTTON_A));
}
public static boolean isActionKeyDown(KeyEvent event) {
@@ -54,19 +51,16 @@ public final class GamepadUtils {
InputDevice.MotionRange range = event.getDevice().getMotionRange(axis);
threshold = range.getFlat() + range.getFuzz();
}
float value = event.getAxisValue(axis);
return (Math.abs(value) < threshold);
}
public static boolean isPanningControl(MotionEvent event) {
- if (Build.VERSION.SDK_INT < 12) {
- return false;
- }
if ((event.getSource() & InputDevice.SOURCE_CLASS_MASK) != InputDevice.SOURCE_CLASS_JOYSTICK) {
return false;
}
if (isValueInDeadZone(event, MotionEvent.AXIS_X)
&& isValueInDeadZone(event, MotionEvent.AXIS_Y)
&& isValueInDeadZone(event, MotionEvent.AXIS_Z)
&& isValueInDeadZone(event, MotionEvent.AXIS_RZ)) {
return false;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
@@ -40,26 +40,24 @@ public final class HardwareUtils {
if (sInited) {
// This is unavoidable, given that HardwareUtils is called from background services.
Log.d(LOGTAG, "HardwareUtils already inited.");
return;
}
// Pre-populate common flags from the context.
final int screenLayoutSize = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
- if (Build.VERSION.SDK_INT >= 11) {
- if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
- sIsLargeTablet = true;
- } else if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_LARGE) {
- sIsSmallTablet = true;
- }
- if (Build.VERSION.SDK_INT >= 16) {
- if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
- sIsTelevision = true;
- }
+ if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
+ sIsLargeTablet = true;
+ } else if (screenLayoutSize == Configuration.SCREENLAYOUT_SIZE_LARGE) {
+ sIsSmallTablet = true;
+ }
+ if (Build.VERSION.SDK_INT >= 16) {
+ if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
+ sIsTelevision = true;
}
}
sInited = true;
}
public static boolean isTablet() {
return sIsLargeTablet || sIsSmallTablet;
--- a/mobile/android/search/java/org/mozilla/search/SearchPreferenceActivity.java
+++ b/mobile/android/search/java/org/mozilla/search/SearchPreferenceActivity.java
@@ -9,17 +9,16 @@ import org.mozilla.gecko.Locales;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserContract;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
-import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;
/**
@@ -41,20 +40,18 @@ public class SearchPreferenceActivity ex
@Override
@SuppressWarnings("deprecation")
protected void onCreate(Bundle savedInstanceState) {
Locales.initializeLocale(getApplicationContext());
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName(GeckoSharedPrefs.APP_PREFS_NAME);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- if (getActionBar() != null) {
- getActionBar().setDisplayHomeAsUpEnabled(true);
- }
+ if (getActionBar() != null) {
+ getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
setupPrefsScreen();
}
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusActivity.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusActivity.java
@@ -4,23 +4,21 @@
package org.mozilla.gecko.fxa.activities;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
-import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
@@ -59,22 +57,17 @@ public class FxAccountStatusActivity ext
}
/**
* Sufficiently recent Android versions need additional code to receive taps
* on the status bar to go "up". See <a
* href="http://stackoverflow.com/a/8953148">this stackoverflow answer</a> for
* more information.
*/
- @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
protected void maybeSetHomeButtonEnabled() {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- Logger.debug(LOG_TAG, "Not enabling home button; version too low.");
- return;
- }
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
Logger.debug(LOG_TAG, "Enabling home button.");
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
return;
}
Logger.debug(LOG_TAG, "Not enabling home button.");
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/Prefs.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/Prefs.java
@@ -1,19 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.mozstumbler.service;
-import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.location.Location;
-import android.os.Build.VERSION;
import android.text.TextUtils;
import android.util.Log;
public final class Prefs {
private static final String LOG_TAG = AppGlobals.makeLogTag(Prefs.class.getSimpleName());
private static final String NICKNAME_PREF = "nickname";
private static final String USER_AGENT_PREF = "user-agent";
private static final String VALUES_VERSION_PREF = "values_version";
@@ -77,17 +75,17 @@ public final class Prefs {
public synchronized void setGeofenceHere(boolean flag) {
setBoolPref(GEOFENCE_HERE, flag);
}
public synchronized void setGeofenceLocation(Location location) {
SharedPreferences.Editor editor = getPrefs().edit();
editor.putFloat(LAT_PREF, (float) location.getLatitude());
editor.putFloat(LON_PREF, (float) location.getLongitude());
- apply(editor);
+ editor.apply();
}
public synchronized void setMozApiKey(String s) {
setStringPref(MOZ_API_KEY, s);
}
///
/// Getters
@@ -137,17 +135,17 @@ public final class Prefs {
public synchronized void setFirefoxScanEnabled(boolean on) {
setBoolPref(FIREFOX_SCAN_ENABLED, on);
}
public synchronized void setLastAttemptedUploadTime(long time) {
SharedPreferences.Editor editor = getPrefs().edit();
editor.putLong(LAST_ATTEMPTED_UPLOAD_TIME, time);
- apply(editor);
+ editor.apply();
}
public synchronized void setNickname(String nick) {
if (nick != null) {
nick = nick.trim();
if (nick.length() > 0) {
setStringPref(NICKNAME_PREF, nick);
}
@@ -176,30 +174,21 @@ public final class Prefs {
private boolean getBoolPrefWithDefault(String key, boolean def) {
return getPrefs().getBoolean(key, def);
}
private void setBoolPref(String key, Boolean state) {
SharedPreferences.Editor editor = getPrefs().edit();
editor.putBoolean(key,state);
- apply(editor);
+ editor.apply();
}
private void setStringPref(String key, String value) {
SharedPreferences.Editor editor = getPrefs().edit();
editor.putString(key, value);
- apply(editor);
- }
-
- @TargetApi(9)
- private static void apply(SharedPreferences.Editor editor) {
- if (VERSION.SDK_INT >= 9) {
- editor.apply();
- } else if (!editor.commit()) {
- Log.e(LOG_TAG, "", new IllegalStateException("commit() failed?!"));
- }
+ editor.apply();
}
private SharedPreferences getPrefs() {
return mSharedPrefs;
}
}
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellInfo.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellInfo.java
@@ -187,20 +187,18 @@ public class CellInfo implements Parcela
mCellRadio = getCellRadioTypeName(networkType);
setNetworkOperator(networkOperator);
lac = gcl.getLac();
cid = gcl.getCid();
if (lac >= 0) mLac = lac;
if (cid >= 0) mCid = cid;
- if (Build.VERSION.SDK_INT >= 9) {
- final int psc = gcl.getPsc();
- if (psc >= 0) mPsc = psc;
- }
+ final int psc = gcl.getPsc();
+ if (psc >= 0) mPsc = psc;
if (gsmSignalStrength != null) {
mAsu = gsmSignalStrength;
}
} else if (cl instanceof CdmaCellLocation) {
final CdmaCellLocation cdl = (CdmaCellLocation) cl;
reset();
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java
@@ -81,17 +81,17 @@ public abstract class AbstractCommunicat
Log.e(LOG_TAG, "Couldn't open a connection: " + e);
}
mHttpURLConnection.setDoOutput(true);
mHttpURLConnection.setRequestProperty(USER_AGENT_HEADER, mUserAgent);
mHttpURLConnection.setRequestProperty("Content-Type", "application/json");
// Workaround for a bug in Android mHttpURLConnection. When the library
// reuses a stale connection, the connection may fail with an EOFException
- if (Build.VERSION.SDK_INT > 13 && Build.VERSION.SDK_INT < 19) {
+ if (Build.VERSION.SDK_INT < 19) {
mHttpURLConnection.setRequestProperty("Connection", "Close");
}
String nickname = getNickname();
if (nickname != null) {
mHttpURLConnection.setRequestProperty(NICKNAME_HEADER, nickname);
}
}
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/ContentProviderTest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/ContentProviderTest.java
@@ -233,19 +233,17 @@ abstract class ContentProviderTest exten
mProviderAuthority = authority;
setUpContentProvider(contentProviderFactory.call());
}
@Override
public void tearDown() throws Exception {
- if (Build.VERSION.SDK_INT >= 11) {
- mProvider.shutdown();
- }
+ mProvider.shutdown();
if (mDatabaseName != null) {
mProviderContext.deleteDatabase(mDatabaseName);
}
super.tearDown();
}
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/MotionEventReplayer.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/MotionEventReplayer.java
@@ -12,17 +12,16 @@ import java.lang.reflect.InvocationTarge
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.Instrumentation;
-import android.os.Build;
import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;
class MotionEventReplayer {
private static final String LOGTAG = "RobocopMotionEventReplayer";
// the inner dimensions of the window on which the motion event capture was taken from
@@ -139,41 +138,24 @@ class MotionEventReplayer {
int deviceId = 0;
int edgeFlags = parseInt(eventProperties.get("edgeFlags"));
int source = parseInt(eventProperties.get("source"));
int flags = parseInt(eventProperties.get("flags"));
int pointerCount = parseInt(eventProperties.get("pointerCount"));
int[] pointerIds = new int[pointerCount];
Object pointerData;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
- MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[pointerCount];
- for (int i = 0; i < pointerCount; i++) {
- pointerIds[i] = Integer.parseInt(eventProperties.get("id[" + i + "]"));
- pointerCoords[i] = new MotionEvent.PointerCoords();
- pointerCoords[i].x = mSurfaceOffsetX + scaleX(Float.parseFloat(eventProperties.get("x[" + i + "]")));
- pointerCoords[i].y = mSurfaceOffsetY + scaleY(Float.parseFloat(eventProperties.get("y[" + i + "]")));
- }
- pointerData = pointerCoords;
- } else {
- // pre-gingerbread we have to use a hidden API to create the motion event, and we have
- // to create a flattened list of floats rather than an array of PointerCoords
- final int NUM_SAMPLE_DATA = 4; // MotionEvent.NUM_SAMPLE_DATA
- final int SAMPLE_X = 0; // MotionEvent.SAMPLE_X
- final int SAMPLE_Y = 1; // MotionEvent.SAMPLE_Y
- float[] sampleData = new float[pointerCount * NUM_SAMPLE_DATA];
- for (int i = 0; i < pointerCount; i++) {
- pointerIds[i] = Integer.parseInt(eventProperties.get("id[" + i + "]"));
- sampleData[(i * NUM_SAMPLE_DATA) + SAMPLE_X] =
- mSurfaceOffsetX + scaleX(Float.parseFloat(eventProperties.get("x[" + i + "]")));
- sampleData[(i * NUM_SAMPLE_DATA) + SAMPLE_Y] =
- mSurfaceOffsetY + scaleY(Float.parseFloat(eventProperties.get("y[" + i + "]")));
- }
- pointerData = sampleData;
+ MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[pointerCount];
+ for (int i = 0; i < pointerCount; i++) {
+ pointerIds[i] = Integer.parseInt(eventProperties.get("id[" + i + "]"));
+ pointerCoords[i] = new MotionEvent.PointerCoords();
+ pointerCoords[i].x = mSurfaceOffsetX + scaleX(Float.parseFloat(eventProperties.get("x[" + i + "]")));
+ pointerCoords[i].y = mSurfaceOffsetY + scaleY(Float.parseFloat(eventProperties.get("y[" + i + "]")));
}
+ pointerData = pointerCoords;
// we want to adjust the timestamps on all the generated events so that they line up with
// the time that this function is executing on-device.
long now = SystemClock.uptimeMillis();
if (firstEvent) {
timeDelta = now - eventTime;
firstEvent = false;
}
@@ -186,32 +168,19 @@ class MotionEventReplayer {
try {
Thread.sleep(eventTime - now);
} catch (InterruptedException ie) {
}
}
// and finally we dispatch the event
MotionEvent event;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
- event = MotionEvent.obtain(downTime, eventTime, action, pointerCount,
- pointerIds, (MotionEvent.PointerCoords[])pointerData, metaState,
- xPrecision, yPrecision, deviceId, edgeFlags, source, flags);
- } else {
- // pre-gingerbread we have to use a hidden API to accomplish this
- if (mObtainNanoMethod == null) {
- mObtainNanoMethod = MotionEvent.class.getMethod("obtainNano", long.class,
- long.class, long.class, int.class, int.class, pointerIds.getClass(),
- pointerData.getClass(), int.class, float.class, float.class,
- int.class, int.class);
- }
- event = (MotionEvent)mObtainNanoMethod.invoke(null, downTime, eventTime,
- eventTime * 1000000, action, pointerCount, pointerIds, (float[])pointerData,
- metaState, xPrecision, yPrecision, deviceId, edgeFlags);
- }
+ event = MotionEvent.obtain(downTime, eventTime, action, pointerCount,
+ pointerIds, (MotionEvent.PointerCoords[])pointerData, metaState,
+ xPrecision, yPrecision, deviceId, edgeFlags, source, flags);
try {
Log.v(LOGTAG, "Injecting " + event.toString());
mInstrumentation.sendPointerSync(event);
} finally {
event.recycle();
event = null;
}
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AboutHomeComponent.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AboutHomeComponent.java
@@ -80,30 +80,21 @@ public class AboutHomeComponent extends
fAssertTrue("The HomePager is visible",
getHomePagerContainer().getVisibility() == View.VISIBLE &&
getHomePagerView().getVisibility() == View.VISIBLE);
return this;
}
public AboutHomeComponent assertBannerNotVisible() {
View banner = getHomeBannerView();
- if (Build.VERSION.SDK_INT >= 11) {
- fAssertTrue("The HomeBanner is not visible",
- getHomePagerContainer().getVisibility() != View.VISIBLE ||
- banner == null ||
- banner.getVisibility() != View.VISIBLE ||
- banner.getTranslationY() == banner.getHeight());
- } else {
- // getTranslationY is not available before api 11.
- // This check is a little less specific.
- fAssertTrue("The HomeBanner is not visible",
- getHomePagerContainer().getVisibility() != View.VISIBLE ||
- banner == null ||
- banner.isShown() == false);
- }
+ fAssertTrue("The HomeBanner is not visible",
+ getHomePagerContainer().getVisibility() != View.VISIBLE ||
+ banner == null ||
+ banner.getVisibility() != View.VISIBLE ||
+ banner.getTranslationY() == banner.getHeight());
return this;
}
public AboutHomeComponent assertBannerVisible() {
fAssertTrue("The HomeBanner is visible",
getHomePagerContainer().getVisibility() == View.VISIBLE &&
getHomeBannerView().getVisibility() == View.VISIBLE);
return this;
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAdobeFlash.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAdobeFlash.java
@@ -11,22 +11,16 @@ import android.os.Build;
/**
* Tests that Flash is working
* - loads a page containing a Flash plugin
* - verifies it rendered properly
*/
public class testAdobeFlash extends PixelTest {
public void testLoad() {
- // This test only works on ICS and higher
- if (Build.VERSION.SDK_INT < 15) {
- blockForGeckoReady();
- return;
- }
-
// Enable plugins
setPreferenceAndWaitForChange("plugin.enable", "1");
blockForGeckoReady();
String url = getAbsoluteUrl(mStringHelper.ROBOCOP_ADOBE_FLASH_URL);
PaintedSurface painted = loadAndGetPainted(url);
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testBrowserProvider.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testBrowserProvider.java
@@ -575,18 +575,17 @@ public class testBrowserProvider extends
id = insertWithNullCol(BrowserContract.Bookmarks.POSITION);
mAsserter.is(id, -1L,
"Should not be able to insert bookmark with null position");
id = insertWithNullCol(BrowserContract.Bookmarks.TYPE);
mAsserter.is(id, -1L,
"Should not be able to insert bookmark with null type");
- if (Build.VERSION.SDK_INT >= 8 &&
- Build.VERSION.SDK_INT < 16) {
+ if (Build.VERSION.SDK_INT < 16) {
b = createOneBookmark();
b.put(BrowserContract.Bookmarks.PARENT, -1);
id = -1;
try {
id = ContentUris.parseId(mProvider.insert(BrowserContract.Bookmarks.CONTENT_URI, b));
} catch (Exception e) {}
@@ -703,18 +702,17 @@ public class testBrowserProvider extends
mAsserter.is((deleted == 1), true,
"Inserted bookmark was deleted using URI with id");
c = getBookmarkById(id);
mAsserter.is(c.moveToFirst(), false,
"Inserted bookmark can't be found after deletion using URI with ID");
c.close();
- if (Build.VERSION.SDK_INT >= 8 &&
- Build.VERSION.SDK_INT < 16) {
+ if (Build.VERSION.SDK_INT < 16) {
ContentValues b = createBookmark("Folder", null, mMobileFolderId,
BrowserContract.Bookmarks.TYPE_FOLDER, 0, "folderTags", "folderDescription", "folderKeyword");
long parentId = ContentUris.parseId(mProvider.insert(BrowserContract.Bookmarks.CONTENT_URI, b));
c = getBookmarkById(parentId);
mAsserter.is(c.moveToFirst(), true, "Inserted bookmarks folder found");
c.close();
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testGetUserMedia.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testGetUserMedia.java
@@ -7,17 +7,16 @@ package org.mozilla.gecko.tests;
import org.mozilla.gecko.AppConstants;
import android.widget.Spinner;
import android.view.View;
import com.robotium.solo.Condition;
import android.hardware.Camera;
-import android.os.Build;
public class testGetUserMedia extends BaseTest {
private static final String LOGTAG = testGetUserMedia.class.getSimpleName();
private static final String GUM_MESSAGE = "Would you like to share your camera and microphone with";
private static final String GUM_ALLOW = "^Share$";
private static final String GUM_DENY = "^Don't Share$";
@@ -85,23 +84,16 @@ public class testGetUserMedia extends Ba
mAsserter.is(mSolo.searchText(GUM_MESSAGE), false, "getUserMedia doorhanger hidden after dismissal");
waitForText(GUM_SELECT_TAB);
mAsserter.is(mSolo.searchText(GUM_SELECT_TAB), true, "Tab selection dialog displayed");
mSolo.clickOnText(GUM_PAGE_TITLE);
waitForTextDismissed(GUM_SELECT_TAB);
mAsserter.is(mSolo.searchText(GUM_SELECT_TAB), false, "Tab selection dialog hidden");
verifyUrlBarTitle(GUM_TAB_HTTPS_URL);
- // Android 2.3 testers fail because of audio issues:
- // E/AudioRecord( 650): Unsupported configuration: sampleRate 44100, format 1, channelCount 1
- // E/libOpenSLES( 650): android_audioRecorder_realize(0x26d7d8) error creating AudioRecord object
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- return;
- }
-
loadUrlAndWait(GUM_TAB_HTTPS_URL);
waitForText(GUM_MESSAGE);
mAsserter.is(mSolo.searchText(GUM_MESSAGE), true, "getUserMedia doorhanger has been displayed");
waitForSpinner();
mAsserter.is(mSolo.searchText(GUM_SELECT_TAB), true, "Video source selection available");
mSolo.clickOnButton(GUM_ALLOW);
waitForTextDismissed(GUM_MESSAGE);
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testShareLink.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testShareLink.java
@@ -35,22 +35,18 @@ public class testShareLink extends About
// FIXME: This is a temporary hack workaround for a permissions problem.
openAboutHomeTab(AboutHomeTabs.HISTORY);
inputAndLoadUrl(url);
verifyUrlBarTitle(url); // Waiting for page title to ensure the page is loaded
selectMenuItem(mStringHelper.SHARE_LABEL);
- if (Build.VERSION.SDK_INT >= 14) {
- // Check for our own sync in the submenu.
- waitForText("Sync$");
- } else {
- waitForText("Share via");
- }
+ // Check for our own sync in the submenu.
+ waitForText("Sync$");
// Get list of current available share activities and verify them
shareOptions = getShareOptions();
ArrayList<String> displayedOptions = getShareOptionsList();
for (String option:shareOptions) {
// Verify if the option is present in the list of displayed share options
mAsserter.ok(optionDisplayed(option, displayedOptions), "Share option found", option);
}
@@ -218,21 +214,17 @@ public class testShareLink extends About
public ArrayList<String> getShareSubMenuOption() {
ArrayList<String> displayedOptions = new ArrayList<>();
AbsListView shareMenu = getDisplayedShareList();
getGroupTextViews(shareMenu, displayedOptions);
return displayedOptions;
}
public ArrayList<String> getShareOptionsList() {
- if (Build.VERSION.SDK_INT >= 14) {
- return getShareSubMenuOption();
- } else {
- return getSharePopupOption();
- }
+ return getShareSubMenuOption();
}
private boolean optionDisplayed(String shareOption, ArrayList<String> displayedOptions) {
for (String displayedOption: displayedOptions) {
if (shareOption.equals(displayedOption)) {
return true;
}
}