Revert "Use FloatMath instead of Math."

This reverts commit 6bb8b2eb8695c042798f0eb798032cd30d642a65
diff --git a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
index 67aa6d7..2192cf8 100644
--- a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
+++ b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
@@ -23,7 +23,6 @@
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.os.Build;
-import android.util.FloatMath;
 import android.util.Log;
 
 import java.io.ByteArrayOutputStream;
@@ -72,7 +71,7 @@
                 && minSideLength == UNCONSTRAINED) return 1;
 
         int lowerBound = (maxNumOfPixels == UNCONSTRAINED) ? 1 :
-                (int) FloatMath.ceil(FloatMath.sqrt((float) (w * h) / maxNumOfPixels));
+                (int) Math.ceil(Math.sqrt((double) (w * h) / maxNumOfPixels));
 
         if (minSideLength == UNCONSTRAINED) {
             return lowerBound;
@@ -96,7 +95,7 @@
 
     // Fin the min x that 1 / x <= scale
     public static int computeSampleSizeLarger(float scale) {
-        int initialSize = (int) FloatMath.floor(1f / scale);
+        int initialSize = (int) Math.floor(1f / scale);
         if (initialSize <= 1) return 1;
 
         return initialSize <= 8
@@ -107,7 +106,7 @@
     // Find the max x that 1 / x >= scale.
     public static int computeSampleSize(float scale) {
         Utils.assertTrue(scale > 0);
-        int initialSize = Math.max(1, (int) FloatMath.ceil(1 / scale));
+        int initialSize = Math.max(1, (int) Math.ceil(1 / scale));
         return initialSize <= 8
                 ? Utils.nextPowerOf2(initialSize)
                 : (initialSize + 7) / 8 * 8;
@@ -117,7 +116,8 @@
             Bitmap bitmap, int targetPixels, boolean recycle) {
         int width = bitmap.getWidth();
         int height = bitmap.getHeight();
-        float scale = FloatMath.sqrt((float) targetPixels / (width * height));
+        float scale = (float) Math.sqrt(
+                (double) targetPixels / (width * height));
         if (scale >= 1.0f) return bitmap;
         return resizeBitmapByScale(bitmap, scale, recycle);
     }
diff --git a/src/com/android/gallery3d/app/CropImage.java b/src/com/android/gallery3d/app/CropImage.java
index 7e1572f..5ac9f02 100644
--- a/src/com/android/gallery3d/app/CropImage.java
+++ b/src/com/android/gallery3d/app/CropImage.java
@@ -38,7 +38,6 @@
 import android.os.Message;
 import android.provider.MediaStore;
 import android.provider.MediaStore.Images;
-import android.util.FloatMath;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.Window;
@@ -555,7 +554,8 @@
         }
 
         if (outputX * outputY > MAX_PIXEL_COUNT) {
-            float scale = FloatMath.sqrt((float) MAX_PIXEL_COUNT / outputX / outputY);
+            float scale = (float) Math.sqrt(
+                    (double) MAX_PIXEL_COUNT / outputX / outputY);
             Log.w(TAG, "scale down the cropped image: " + scale);
             outputX = Math.round(scale * outputX);
             outputY = Math.round(scale * outputY);
diff --git a/src/com/android/gallery3d/app/EyePosition.java b/src/com/android/gallery3d/app/EyePosition.java
index cb9299b..7b4495a 100644
--- a/src/com/android/gallery3d/app/EyePosition.java
+++ b/src/com/android/gallery3d/app/EyePosition.java
@@ -25,7 +25,6 @@
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
 import android.os.SystemClock;
-import android.util.FloatMath;
 import android.view.Display;
 import android.view.Surface;
 import android.view.WindowManager;
@@ -43,8 +42,8 @@
     private static final float GYROSCOPE_RESTORE_FACTOR = 0.995f;
 
     private static final double USER_ANGEL = Math.toRadians(10);
-    private static final float USER_ANGEL_COS = FloatMath.cos(USER_ANGEL);
-    private static final float USER_ANGEL_SIN = FloatMath.sin(USER_ANGEL);
+    private static final float USER_ANGEL_COS = (float) Math.cos(USER_ANGEL);
+    private static final float USER_ANGEL_SIN = (float) Math.sin(USER_ANGEL);
     private static final float MAX_VIEW_RANGE = (float) 0.5;
     private static final int NOT_STARTED = -1;
 
@@ -127,8 +126,8 @@
         float ty = -1 + t * y;
         float tz = t * z;
 
-        float length = FloatMath.sqrt(tx * tx + ty * ty + tz * tz);
-        float glength = FloatMath.sqrt(temp);
+        float length = (float) Math.sqrt(tx * tx + ty * ty + tz * tz);
+        float glength = (float) Math.sqrt(temp);
 
         mX = Utils.clamp((x * USER_ANGEL_COS / glength
                 + tx * USER_ANGEL_SIN / length) * mUserDistance,
@@ -136,7 +135,7 @@
         mY = -Utils.clamp((y * USER_ANGEL_COS / glength
                 + ty * USER_ANGEL_SIN / length) * mUserDistance,
                 -mLimit, mLimit);
-        mZ = -FloatMath.sqrt(
+        mZ = (float) -Math.sqrt(
                 mUserDistance * mUserDistance - mX * mX - mY * mY);
         mListener.onEyePositionChanged(mX, mY, mZ);
     }
@@ -174,7 +173,7 @@
         mY = Utils.clamp((float) (mY + y * t / Math.hypot(mZ, mY)),
                 -mLimit, mLimit) * GYROSCOPE_RESTORE_FACTOR;
 
-        mZ = -FloatMath.sqrt(
+        mZ = (float) -Math.sqrt(
                 mUserDistance * mUserDistance - mX * mX - mY * mY);
         mListener.onEyePositionChanged(mX, mY, mZ);
     }
diff --git a/src/com/android/gallery3d/data/LocationClustering.java b/src/com/android/gallery3d/data/LocationClustering.java
index 9f3a358..788060c 100644
--- a/src/com/android/gallery3d/data/LocationClustering.java
+++ b/src/com/android/gallery3d/data/LocationClustering.java
@@ -23,7 +23,6 @@
 import android.content.Context;
 import android.os.Handler;
 import android.os.Looper;
-import android.util.FloatMath;
 import android.widget.Toast;
 
 import java.util.ArrayList;
@@ -295,7 +294,7 @@
             }
 
             // step 5: calculate the final score
-            float score = totalDistance * FloatMath.sqrt(realK);
+            float score = totalDistance * (float) Math.sqrt(realK);
 
             if (score < bestScore) {
                 bestScore = score;
diff --git a/src/com/android/gallery3d/photoeditor/RendererUtils.java b/src/com/android/gallery3d/photoeditor/RendererUtils.java
index 3edcff5..b92907d 100644
--- a/src/com/android/gallery3d/photoeditor/RendererUtils.java
+++ b/src/com/android/gallery3d/photoeditor/RendererUtils.java
@@ -19,7 +19,6 @@
 import android.graphics.Bitmap;
 import android.opengl.GLES20;
 import android.opengl.GLUtils;
-import android.util.FloatMath;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
@@ -154,8 +153,8 @@
     public static void setRenderToRotate(RenderContext context, int srcWidth, int srcHeight,
             int dstWidth, int dstHeight, float degrees) {
         float radian = -degrees * DEGREE_TO_RADIAN;
-        float cosTheta = FloatMath.cos(radian);
-        float sinTheta = FloatMath.sin(radian);
+        float cosTheta = (float) Math.cos(radian);
+        float sinTheta = (float) Math.sin(radian);
         float cosWidth = cosTheta * srcWidth;
         float sinWidth = sinTheta * srcWidth;
         float cosHeight = cosTheta * srcHeight;
@@ -206,8 +205,8 @@
         System.arraycopy(base, 0, vertices, 0, vertices.length);
         if (horizontalDegrees % 180f != 0) {
             float radian = (horizontalDegrees - horizontalRounds * 180) * DEGREE_TO_RADIAN;
-            float cosTheta = FloatMath.cos(radian);
-            float sinTheta = FloatMath.sin(radian);
+            float cosTheta = (float) Math.cos(radian);
+            float sinTheta = (float) Math.sin(radian);
 
             float scale = length / (length + sinTheta * base[0]);
             vertices[0] = cosTheta * base[0] * scale;
@@ -224,8 +223,8 @@
 
         if (verticalDegrees % 180f != 0) {
             float radian = (verticalDegrees - verticalRounds * 180) * DEGREE_TO_RADIAN;
-            float cosTheta = FloatMath.cos(radian);
-            float sinTheta = FloatMath.sin(radian);
+            float cosTheta = (float) Math.cos(radian);
+            float sinTheta = (float) Math.sin(radian);
 
             float scale = length / (length + sinTheta * base[1]);
             vertices[0] = base[0] * scale;
diff --git a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
index 0f03da8..87ff557 100644
--- a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
+++ b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
@@ -19,7 +19,6 @@
 import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.os.Message;
-import android.util.FloatMath;
 
 import com.android.gallery3d.R;
 import com.android.gallery3d.app.GalleryActivity;
@@ -382,8 +381,8 @@
             float scaley = mBoxHeight / (float) height;
             float scale = Math.min(scalex, scaley);
 
-            width = (int) FloatMath.floor(width * scale);
-            height = (int) FloatMath.floor(height * scale);
+            width = (int) Math.floor(width * scale);
+            height = (int) Math.floor(height * scale);
 
             // Now draw it
             int sourceType = SelectionDrawer.DATASOURCE_TYPE_NOT_CATEGORIZED;
diff --git a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
index 6947d7f..b40d72c 100644
--- a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
+++ b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
@@ -18,7 +18,6 @@
 
 import android.graphics.Bitmap;
 import android.os.Message;
-import android.util.FloatMath;
 
 import com.android.gallery3d.app.GalleryActivity;
 import com.android.gallery3d.common.BitmapUtils;
@@ -330,8 +329,8 @@
             float scaley = mBoxHeight / (float) height;
             float scale = Math.min(scalex, scaley);
 
-            width = (int) FloatMath.floor(width * scale);
-            height = (int) FloatMath.floor(height * scale);
+            width = (int) Math.floor(width * scale);
+            height = (int) Math.floor(height * scale);
 
             // Now draw it
             if (pass == 0) {
diff --git a/src/com/android/gallery3d/ui/CropView.java b/src/com/android/gallery3d/ui/CropView.java
index 227e67e..71fdaab 100644
--- a/src/com/android/gallery3d/ui/CropView.java
+++ b/src/com/android/gallery3d/ui/CropView.java
@@ -31,7 +31,6 @@
 import android.media.FaceDetector;
 import android.os.Handler;
 import android.os.Message;
-import android.util.FloatMath;
 import android.view.MotionEvent;
 import android.view.animation.DecelerateInterpolator;
 import android.widget.Toast;
@@ -757,7 +756,8 @@
         int rotation = mImageRotation;
         int width = bitmap.getWidth();
         int height = bitmap.getHeight();
-        float scale = FloatMath.sqrt((float) FACE_PIXEL_COUNT / (width * height));
+        float scale = (float) Math.sqrt(
+                (double) FACE_PIXEL_COUNT / (width * height));
 
         // faceBitmap is a correctly rotated bitmap, as viewed by a user.
         Bitmap faceBitmap;
diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java
index 68cbbee..b4dac97 100644
--- a/src/com/android/gallery3d/ui/PositionController.java
+++ b/src/com/android/gallery3d/ui/PositionController.java
@@ -406,7 +406,7 @@
         // force it to be in the center.
         // (We do for height only, not width, because the user may
         // want to scroll to the previous/next image.)
-        if (FloatMath.floor(mImageH * mToScale) <= mViewH) {
+        if (Math.floor(mImageH * mToScale) <= mViewH) {
             mToY = mImageH / 2;
         }
 
@@ -582,19 +582,19 @@
     private void calculateStableBound(float scale, float horizontalSlack) {
         // The number of pixels between the center of the view
         // and the edge when the edge is aligned.
-        mBoundLeft = (int) FloatMath.ceil((mViewW - horizontalSlack) / (2 * scale));
+        mBoundLeft = (int) Math.ceil((mViewW - horizontalSlack) / (2 * scale));
         mBoundRight = mImageW - mBoundLeft;
-        mBoundTop = (int) FloatMath.ceil(mViewH / (2 * scale));
+        mBoundTop = (int) Math.ceil(mViewH / (2 * scale));
         mBoundBottom = mImageH - mBoundTop;
 
         // If the scaled height is smaller than the view height,
         // force it to be in the center.
-        if (FloatMath.floor(mImageH * scale) <= mViewH) {
+        if (Math.floor(mImageH * scale) <= mViewH) {
             mBoundTop = mBoundBottom = mImageH / 2;
         }
 
         // Same for width
-        if (FloatMath.floor(mImageW * scale) <= mViewW) {
+        if (Math.floor(mImageW * scale) <= mViewW) {
             mBoundLeft = mBoundRight = mImageW / 2;
         }
     }
diff --git a/src/com/android/gallery3d/ui/StringTexture.java b/src/com/android/gallery3d/ui/StringTexture.java
index 8d47bfd..f576c01 100644
--- a/src/com/android/gallery3d/ui/StringTexture.java
+++ b/src/com/android/gallery3d/ui/StringTexture.java
@@ -69,7 +69,7 @@
 
     private static StringTexture newInstance(String text, TextPaint paint) {
         FontMetricsInt metrics = paint.getFontMetricsInt();
-        int width = (int) FloatMath.ceil(paint.measureText(text));
+        int width = (int) Math.ceil(paint.measureText(text));
         int height = metrics.bottom - metrics.top;
         // The texture size needs to be at least 1x1.
         if (width <= 0) width = 1;
diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java
index 05d09f5..980f7b2 100644
--- a/src/com/android/gallery3d/ui/TileImageView.java
+++ b/src/com/android/gallery3d/ui/TileImageView.java
@@ -19,7 +19,6 @@
 import android.graphics.Bitmap;
 import android.graphics.Rect;
 import android.graphics.RectF;
-import android.util.FloatMath;
 
 import com.android.gallery3d.app.GalleryContext;
 import com.android.gallery3d.common.Utils;
@@ -294,10 +293,10 @@
         int height = (int) Math.ceil(Math.max(
                 Math.abs(sin * w + cos * h), Math.abs(sin * w - cos * h)));
 
-        int left = (int) FloatMath.floor(cX - width / (2f * scale));
-        int top = (int) FloatMath.floor(cY - height / (2f * scale));
-        int right = (int) FloatMath.ceil(left + width / scale);
-        int bottom = (int) FloatMath.ceil(top + height / scale);
+        int left = (int) Math.floor(cX - width / (2f * scale));
+        int top = (int) Math.floor(cY - height / (2f * scale));
+        int right = (int) Math.ceil(left + width / scale);
+        int bottom = (int) Math.ceil(top + height / scale);
 
         // align the rectangle to tile boundary
         int size = TILE_SIZE << level;