Merge "Improve external storage CTS tests." into jb-mr1-dev
diff --git a/tests/tests/holo/AndroidManifest.xml b/tests/tests/holo/AndroidManifest.xml
index ea53a73..7eb899c 100644
--- a/tests/tests/holo/AndroidManifest.xml
+++ b/tests/tests/holo/AndroidManifest.xml
@@ -41,12 +41,12 @@
                 android:label="@string/pick_layout" />
 
         <activity android:name="android.holo.cts.ThemeTestActivity"
-                android:configChanges="keyboardHidden|orientation|screenSize"
+                android:configChanges="keyboardHidden|orientation|screenSize|mcc|mnc"
                 android:screenOrientation="nosensor"
                 android:theme="@android:style/Theme.Translucent.NoTitleBar" />
 
         <activity android:name="android.holo.cts.LayoutTestActivity"
-                android:configChanges="keyboardHidden|orientation|screenSize"
+                android:configChanges="keyboardHidden|orientation|screenSize|mcc|mnc"
                 android:screenOrientation="nosensor" />
 
         <activity android:name="android.holo.cts.BitmapDeletionActivity"
diff --git a/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java b/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java
index e88f5e1..2b6c371 100644
--- a/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java
+++ b/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java
@@ -163,8 +163,6 @@
         protected void onPreExecute() {
             mBitmap = getBitmap();
             mReferenceBitmap = BitmapAssets.getBitmap(getApplicationContext(), mBitmapName);
-            final int threshold = 2;
-            mSame = compareTo(mBitmap, mReferenceBitmap, threshold);
         }
 
         /* Compares 2 bitmaps' width, height and pixels.
@@ -213,6 +211,8 @@
         @Override
         protected String[] doInBackground(Void... devoid) {
             try {
+                final int threshold = 2;
+                mSame = compareTo(mBitmap, mReferenceBitmap, threshold);
                 if (!mSame) {
                     String[] paths = new String[2];
                     paths[0] = saveDiffBitmap(mBitmap, mReferenceBitmap);
@@ -222,9 +222,6 @@
                     return null;
                 }
             } finally {
-                mReferenceBitmap.recycle();
-                mReferenceBitmap = null;
-
                 mBitmap.recycle();
                 mBitmap = null;
             }