diff --git a/mobile/android/base/CrashReporter.java b/mobile/android/base/CrashReporter.java index 10c01ef76d8..8c8c97ef8e5 100644 --- a/mobile/android/base/CrashReporter.java +++ b/mobile/android/base/CrashReporter.java @@ -282,8 +282,8 @@ public class CrashReporter extends Activity private String generateBoundary() { // Generate some random numbers to fill out the boundary - int r0 = (int)((double)Integer.MAX_VALUE * Math.random()); - int r1 = (int)((double)Integer.MAX_VALUE * Math.random()); + int r0 = (int)(Integer.MAX_VALUE * Math.random()); + int r1 = (int)(Integer.MAX_VALUE * Math.random()); return String.format("---------------------------%08X%08X", r0, r1); } diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index d765687675a..188129ffe1d 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -1016,9 +1016,9 @@ public abstract class GeckoApp int inSampleSize = 1; if (height > idealHeight || width > idealWidth) { if (width > height) { - inSampleSize = Math.round((float)height / (float)idealHeight); + inSampleSize = Math.round((float)height / idealHeight); } else { - inSampleSize = Math.round((float)width / (float)idealWidth); + inSampleSize = Math.round((float)width / idealWidth); } } return inSampleSize; diff --git a/mobile/android/base/GeckoBatteryManager.java b/mobile/android/base/GeckoBatteryManager.java index 303ee0fb983..97f4715a8ab 100644 --- a/mobile/android/base/GeckoBatteryManager.java +++ b/mobile/android/base/GeckoBatteryManager.java @@ -107,8 +107,8 @@ public class GeckoBatteryManager extends BroadcastReceiver { } // We need two doubles because sLevel is a double. - double current = (double)intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); - double max = (double)intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); + double current = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); + double max = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); if (current == -1 || max == -1) { Log.e(LOGTAG, "Failed to get battery level!"); sLevel = kDefaultLevel; diff --git a/mobile/android/base/GeckoJavaSampler.java b/mobile/android/base/GeckoJavaSampler.java index f8bde6f4b41..9c133d7bc54 100644 --- a/mobile/android/base/GeckoJavaSampler.java +++ b/mobile/android/base/GeckoJavaSampler.java @@ -142,7 +142,7 @@ public class GeckoJavaSampler { Sample sample = getSample(aThreadId, aSampleId); if (sample != null) { if (sample.mJavaTime != 0) { - return (double)(sample.mJavaTime - + return (sample.mJavaTime - SystemClock.elapsedRealtime()) + getProfilerTime(); } System.out.println("Sample: " + sample.mTime); diff --git a/mobile/android/base/animation/PropertyAnimator.java b/mobile/android/base/animation/PropertyAnimator.java index 000bae5ac75..8e82fd161d7 100644 --- a/mobile/android/base/animation/PropertyAnimator.java +++ b/mobile/android/base/animation/PropertyAnimator.java @@ -61,7 +61,7 @@ public class PropertyAnimator implements Runnable { public PropertyAnimator(long duration, Interpolator interpolator) { mDuration = duration; - mDurationReciprocal = 1.0f / (float) mDuration; + mDurationReciprocal = 1.0f / mDuration; mInterpolator = interpolator; mElementsList = new ArrayList(); mFramePoster = FramePoster.create(this); diff --git a/mobile/android/base/favicons/decoders/ICODecoder.java b/mobile/android/base/favicons/decoders/ICODecoder.java index 18078b95439..1c3f6720696 100644 --- a/mobile/android/base/favicons/decoders/ICODecoder.java +++ b/mobile/android/base/favicons/decoders/ICODecoder.java @@ -293,10 +293,10 @@ public class ICODecoder implements Iterable { System.arraycopy(decodand, offset + iconDirEntry.payloadOffset, decodeTarget, singlePayloadOffset, iconDirEntry.payloadSize); // Update the offset field of the ICONDIRENTRY to make the new ICO valid. - decodeTarget[ICO_HEADER_LENGTH_BYTES + 12] = (byte) singlePayloadOffset; - decodeTarget[ICO_HEADER_LENGTH_BYTES + 13] = (byte) (singlePayloadOffset >>> 8); - decodeTarget[ICO_HEADER_LENGTH_BYTES + 14] = (byte) (singlePayloadOffset >>> 16); - decodeTarget[ICO_HEADER_LENGTH_BYTES + 15] = (byte) (singlePayloadOffset >>> 24); + decodeTarget[ICO_HEADER_LENGTH_BYTES + 12] = singlePayloadOffset; + decodeTarget[ICO_HEADER_LENGTH_BYTES + 13] = (singlePayloadOffset >>> 8); + decodeTarget[ICO_HEADER_LENGTH_BYTES + 14] = (singlePayloadOffset >>> 16); + decodeTarget[ICO_HEADER_LENGTH_BYTES + 15] = (singlePayloadOffset >>> 24); // Decode the newly-constructed singleton-ICO. return BitmapUtils.decodeByteArray(decodeTarget); diff --git a/mobile/android/base/gfx/Axis.java b/mobile/android/base/gfx/Axis.java index 500e7811458..e0c6469d377 100644 --- a/mobile/android/base/gfx/Axis.java +++ b/mobile/android/base/gfx/Axis.java @@ -53,7 +53,7 @@ abstract class Axis { private static float getFloatPref(Map prefs, String prefName, int defaultValue) { Integer value = (prefs == null ? null : prefs.get(prefName)); - return (float)(value == null || value < 0 ? defaultValue : value) / 1000f; + return (value == null || value < 0 ? defaultValue : value) / 1000f; } private static int getIntPref(Map prefs, String prefName, int defaultValue) { diff --git a/mobile/android/base/gfx/DisplayPortCalculator.java b/mobile/android/base/gfx/DisplayPortCalculator.java index a977694114b..a46ed5cf37d 100644 --- a/mobile/android/base/gfx/DisplayPortCalculator.java +++ b/mobile/android/base/gfx/DisplayPortCalculator.java @@ -124,7 +124,7 @@ final class DisplayPortCalculator { private static float getFloatPref(Map prefs, String prefName, int defaultValue) { Integer value = (prefs == null ? null : prefs.get(prefName)); - return (float)(value == null || value < 0 ? defaultValue : value) / 1000f; + return (value == null || value < 0 ? defaultValue : value) / 1000f; } private static abstract class DisplayPortStrategy { @@ -746,7 +746,7 @@ final class DisplayPortCalculator { @Override public boolean drawTimeUpdate(long millis, int pixels) { // calculate the number of frames it took to draw a viewport-sized area - float normalizedTime = (float)mPixelArea * (float)millis / (float)pixels; + float normalizedTime = (float)mPixelArea * millis / pixels; int normalizedFrames = (int)FloatMath.ceil(normalizedTime * 60f / 1000f); // broaden our range on how long it takes to draw if the draw falls outside // the range. this allows it to grow gradually. this heuristic may need to diff --git a/mobile/android/base/gfx/JavaPanZoomController.java b/mobile/android/base/gfx/JavaPanZoomController.java index a9de6a1d0ff..5fcc82e727f 100644 --- a/mobile/android/base/gfx/JavaPanZoomController.java +++ b/mobile/android/base/gfx/JavaPanZoomController.java @@ -170,7 +170,7 @@ class JavaPanZoomController @Override public void prefValue(String pref, int value) { if (pref.equals("ui.scrolling.gamepad_dead_zone")) { - GamepadUtils.overrideDeadZoneThreshold((float)value / 1000f); + GamepadUtils.overrideDeadZoneThreshold(value / 1000f); } } @@ -660,7 +660,7 @@ class JavaPanZoomController } private void track(float x, float y, long time) { - float timeDelta = (float)(time - mLastEventTime); + float timeDelta = (time - mLastEventTime); if (FloatUtils.fuzzyEquals(timeDelta, 0)) { // probably a duplicate event, ignore it. using a zero timeDelta will mess // up our velocity diff --git a/mobile/android/base/gfx/LayerMarginsAnimator.java b/mobile/android/base/gfx/LayerMarginsAnimator.java index 4ff88b638a6..6d0321fb3b3 100644 --- a/mobile/android/base/gfx/LayerMarginsAnimator.java +++ b/mobile/android/base/gfx/LayerMarginsAnimator.java @@ -61,7 +61,7 @@ public class LayerMarginsAnimator { mPrefObserverId = PrefsHelper.getPref(PREF_SHOW_MARGINS_THRESHOLD, new PrefsHelper.PrefHandlerBase() { @Override public void prefValue(String pref, int value) { - SHOW_MARGINS_THRESHOLD = (float)value / 100.0f; + SHOW_MARGINS_THRESHOLD = value / 100.0f; } @Override diff --git a/mobile/android/base/gfx/PluginLayer.java b/mobile/android/base/gfx/PluginLayer.java index 843465d86af..2923072fae8 100644 --- a/mobile/android/base/gfx/PluginLayer.java +++ b/mobile/android/base/gfx/PluginLayer.java @@ -136,10 +136,10 @@ public class PluginLayer extends TileLayer { private void clampToMaxSize() { if (width > mMaxDimension || height > mMaxDimension) { if (width > height) { - height = Math.round(((float)height/(float)width) * mMaxDimension); + height = Math.round(((float)height/ width) * mMaxDimension); width = mMaxDimension; } else { - width = Math.round(((float)width/(float)height) * mMaxDimension); + width = Math.round(((float)width/ height) * mMaxDimension); height = mMaxDimension; } } diff --git a/mobile/android/base/sync/SharedPreferencesClientsDataDelegate.java b/mobile/android/base/sync/SharedPreferencesClientsDataDelegate.java index da825ebc18a..5abdd67f6f4 100644 --- a/mobile/android/base/sync/SharedPreferencesClientsDataDelegate.java +++ b/mobile/android/base/sync/SharedPreferencesClientsDataDelegate.java @@ -75,7 +75,7 @@ public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate @Override public synchronized void setClientsCount(int clientsCount) { - sharedPreferences.edit().putLong(SyncConfiguration.PREF_NUM_CLIENTS, (long) clientsCount).commit(); + sharedPreferences.edit().putLong(SyncConfiguration.PREF_NUM_CLIENTS, clientsCount).commit(); } @Override diff --git a/mobile/android/base/sync/Utils.java b/mobile/android/base/sync/Utils.java index e6de63d6ddd..94f722ce23a 100644 --- a/mobile/android/base/sync/Utils.java +++ b/mobile/android/base/sync/Utils.java @@ -200,7 +200,7 @@ public class Utils { } public static long decimalSecondsToMilliseconds(Integer decimal) { - return (long)(decimal * 1000); + return (decimal * 1000); } public static byte[] sha256(byte[] in) diff --git a/mobile/android/base/sync/crypto/HKDF.java b/mobile/android/base/sync/crypto/HKDF.java index a12efbeb616..16c0d8147da 100644 --- a/mobile/android/base/sync/crypto/HKDF.java +++ b/mobile/android/base/sync/crypto/HKDF.java @@ -56,7 +56,7 @@ public class HKDF { byte[] T = {}; byte[] Tn = {}; - int iterations = (int) Math.ceil(((double)len) / ((double)BLOCKSIZE)); + int iterations = (int) Math.ceil(((double)len) / (BLOCKSIZE)); for (int i = 0; i < iterations; i++) { Tn = digestBytes(Utils.concatAll(Tn, info, Utils.hex2Byte(Integer.toHexString(i + 1))), hmacHasher); diff --git a/mobile/android/base/sync/syncadapter/SyncAdapter.java b/mobile/android/base/sync/syncadapter/SyncAdapter.java index 4e88bb7c56e..7e7b36e63b9 100644 --- a/mobile/android/base/sync/syncadapter/SyncAdapter.java +++ b/mobile/android/base/sync/syncadapter/SyncAdapter.java @@ -198,7 +198,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements BaseGlob } if (backoff > 0) { // Fuzz the backoff time (up to 25% more) to prevent client lock-stepping; agrees with desktop. - final long fuzzedBackoff = backoff + Math.round((double) backoff * 0.25d * Math.random()); + final long fuzzedBackoff = backoff + Math.round(backoff * 0.25d * Math.random()); this.backoffHandler.extendEarliestNextRequest(System.currentTimeMillis() + fuzzedBackoff); } } diff --git a/mobile/android/base/tests/MotionEventReplayer.java b/mobile/android/base/tests/MotionEventReplayer.java index db7c4d88020..ba29e65b7e2 100644 --- a/mobile/android/base/tests/MotionEventReplayer.java +++ b/mobile/android/base/tests/MotionEventReplayer.java @@ -76,11 +76,11 @@ class MotionEventReplayer { } private float scaleX(float value) { - return value * (float)mSurfaceWidth / (float)CAPTURE_WINDOW_WIDTH; + return value * mSurfaceWidth / CAPTURE_WINDOW_WIDTH; } private float scaleY(float value) { - return value * (float)mSurfaceHeight / (float)CAPTURE_WINDOW_HEIGHT; + return value * mSurfaceHeight / CAPTURE_WINDOW_HEIGHT; } public void replayEvents(InputStream eventDescriptions) diff --git a/mobile/android/base/widget/FadedTextView.java b/mobile/android/base/widget/FadedTextView.java index 38f2f05b29a..f0f2b762025 100644 --- a/mobile/android/base/widget/FadedTextView.java +++ b/mobile/android/base/widget/FadedTextView.java @@ -87,7 +87,7 @@ public class FadedTextView extends ThemedTextView { public FadedTextGradient(int width, int fadeWidth, int color) { super(0, 0, width, 0, new int[] { color, color, 0x0 }, - new float[] { 0, ((float) (width - fadeWidth) / (float) width), 1.0f }, + new float[] { 0, ((float) (width - fadeWidth) / width), 1.0f }, Shader.TileMode.CLAMP); mWidth = width;