Merge "Add LayoutTest http/tests/appcache/foreign-fallback.html to the DRT ignore list"
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 507430d..0ae85cb 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -420,7 +420,14 @@
         } else {
           // bccReadBC returns a neagative value: Didn't read any script,
           // So, use cached binary instead
-          bccLoadBinary(s->mBccScript);
+          if (bccLoadBinary(s->mBccScript)) {  // LoadBinary fails ==> Recompile
+            bccReadBC(s->mBccScript,
+                      s->mEnviroment.mScriptText,
+                      s->mEnviroment.mScriptTextLength,
+                      NULL,
+                      cacheDir);
+            bccCompileBC(s->mBccScript);
+          }
         }
         bccGetScriptLabel(s->mBccScript, "root", (BCCvoid**) &s->mProgram.mRoot);
         bccGetScriptLabel(s->mBccScript, "init", (BCCvoid**) &s->mProgram.mInit);
diff --git a/media/java/android/media/ThumbnailUtils.java b/media/java/android/media/ThumbnailUtils.java
index 0edd449..b5a82e3 100644
--- a/media/java/android/media/ThumbnailUtils.java
+++ b/media/java/android/media/ThumbnailUtils.java
@@ -160,7 +160,21 @@
                 // Ignore failures while cleaning up.
             }
         }
-        if (kind == Images.Thumbnails.MICRO_KIND && bitmap != null) {
+
+        if (bitmap == null) return null;
+
+        if (kind == Images.Thumbnails.MINI_KIND) {
+            // Scale down the bitmap if it's too large.
+            int width = bitmap.getWidth();
+            int height = bitmap.getHeight();
+            int max = Math.max(width, height);
+            if (max > 512) {
+                float scale = 512f / max;
+                int w = Math.round(scale * width);
+                int h = Math.round(scale * height);
+                bitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
+            }
+        } else if (kind == Images.Thumbnails.MICRO_KIND) {
             bitmap = extractThumbnail(bitmap,
                     TARGET_SIZE_MICRO_THUMBNAIL,
                     TARGET_SIZE_MICRO_THUMBNAIL,
@@ -282,7 +296,7 @@
     private static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels,
             Uri uri, ContentResolver cr, ParcelFileDescriptor pfd,
             BitmapFactory.Options options) {
-            Bitmap b = null;
+        Bitmap b = null;
         try {
             if (pfd == null) pfd = makeInputStream(uri, cr);
             if (pfd == null) return null;