Fix problems where we were allocating TypedArray when not needed.

Fixes up some recycling of TypedArray objects to reduce the
number we need to allocate during inflation etc.

Change-Id: I948dccc052997779001eaa99db2a710b04be01ae
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1463e09..1cc428b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -27,7 +27,6 @@
 import android.graphics.Interpolator;
 import android.graphics.LinearGradient;
 import android.graphics.Matrix;
-import android.graphics.Matrix.ScaleToFit;
 import android.graphics.Paint;
 import android.graphics.PixelFormat;
 import android.graphics.Point;
@@ -2272,8 +2271,6 @@
      */
     int mOldHeightMeasureSpec = Integer.MIN_VALUE;
 
-    private Resources mResources = null;
-
     private Drawable mBGDrawable;
 
     private int mBackgroundResource;
@@ -2336,6 +2333,8 @@
      */
     protected Context mContext;
 
+    private final Resources mResources;
+
     private ScrollabilityCache mScrollCache;
 
     private int[] mDrawableState = null;
@@ -3017,6 +3016,8 @@
             }
         }
 
+        a.recycle();
+
         setOverScrollMode(overScrollMode);
 
         if (background != null) {
@@ -3074,14 +3075,13 @@
         }
 
         computeOpaqueFlags();
-
-        a.recycle();
     }
 
     /**
      * Non-public constructor for use in testing
      */
     View() {
+        mResources = null;
     }
 
     /**