Add AppCompatDrawableManager

Refactored from TintManager, AppCompatDrawableManager
is now architectured differently. It is now a singleton
which keeps multi-map of cached tints.

This is to enable the new InflateDelegate extension point,
which will allows libraries (and eventually apps) to hook
into the compat drawable inflation.

While this CL looks large, it's mostly just updating method
calls to match the new parameters.

BUG: 24852773

Change-Id: Ic9f5ecc6fd0208d2f7a8a686f077f16588020516
diff --git a/design/src/android/support/design/widget/TabLayout.java b/design/src/android/support/design/widget/TabLayout.java
index 2410a32..89ca383 100755
--- a/design/src/android/support/design/widget/TabLayout.java
+++ b/design/src/android/support/design/widget/TabLayout.java
@@ -39,7 +39,7 @@
 import android.support.v4.view.ViewPager;
 import android.support.v4.widget.TextViewCompat;
 import android.support.v7.app.ActionBar;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.text.Layout;
 import android.text.TextUtils;
 import android.util.AttributeSet;
@@ -1071,7 +1071,7 @@
          */
         @NonNull
         public Tab setIcon(@DrawableRes int resId) {
-            return setIcon(TintManager.getDrawable(mParent.getContext(), resId));
+            return setIcon(AppCompatDrawableManager.get().getDrawable(mParent.getContext(), resId));
         }
 
         /**
@@ -1176,7 +1176,8 @@
             super(context);
             mTab = tab;
             if (mTabBackgroundResId != 0) {
-                setBackgroundDrawable(TintManager.getDrawable(context, mTabBackgroundResId));
+                setBackgroundDrawable(
+                        AppCompatDrawableManager.get().getDrawable(context, mTabBackgroundResId));
             }
             ViewCompat.setPaddingRelative(this, mTabPaddingStart, mTabPaddingTop,
                     mTabPaddingEnd, mTabPaddingBottom);
diff --git a/design/src/android/support/design/widget/TextInputLayout.java b/design/src/android/support/design/widget/TextInputLayout.java
index 404bb32..6b6d426 100644
--- a/design/src/android/support/design/widget/TextInputLayout.java
+++ b/design/src/android/support/design/widget/TextInputLayout.java
@@ -32,7 +32,7 @@
 import android.support.v4.view.ViewCompat;
 import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
 import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.text.TextWatcher;
@@ -536,9 +536,9 @@
             ViewCompat.setBackgroundTintList(mEditText,
                     ColorStateList.valueOf(mCounterView.getCurrentTextColor()));
         } else {
-            final TintManager tintManager = TintManager.get(getContext());
             ViewCompat.setBackgroundTintList(mEditText,
-                    tintManager.getTintList(R.drawable.abc_edit_text_material));
+                    AppCompatDrawableManager.get()
+                            .getTintList(getContext(), R.drawable.abc_edit_text_material));
         }
     }
 
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java
index c61f979..72f2af7 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDelegateImplV7.java
@@ -54,10 +54,10 @@
 import android.support.v7.internal.view.menu.MenuPresenter;
 import android.support.v7.internal.view.menu.MenuView;
 import android.support.v7.internal.widget.ActionBarContextView;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.ContentFrameLayout;
 import android.support.v7.internal.widget.DecorContentParent;
 import android.support.v7.internal.widget.FitWindowsViewGroup;
-import android.support.v7.internal.widget.TintManager;
 import android.support.v7.internal.widget.ViewStubCompat;
 import android.support.v7.internal.widget.ViewUtils;
 import android.support.v7.view.ActionMode;
@@ -2013,7 +2013,7 @@
 
         @Override
         public void setBackgroundResource(int resid) {
-            setBackgroundDrawable(TintManager.getDrawable(getContext(), resid));
+            setBackgroundDrawable(AppCompatDrawableManager.get().getDrawable(getContext(), resid));
         }
 
         private boolean isOutOfBounds(int x, int y) {
diff --git a/v7/appcompat/src/android/support/v7/internal/app/WindowDecorActionBar.java b/v7/appcompat/src/android/support/v7/internal/app/WindowDecorActionBar.java
index 968c781..341217d 100644
--- a/v7/appcompat/src/android/support/v7/internal/app/WindowDecorActionBar.java
+++ b/v7/appcompat/src/android/support/v7/internal/app/WindowDecorActionBar.java
@@ -42,9 +42,9 @@
 import android.support.v7.internal.widget.ActionBarContainer;
 import android.support.v7.internal.widget.ActionBarContextView;
 import android.support.v7.internal.widget.ActionBarOverlayLayout;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.DecorToolbar;
 import android.support.v7.internal.widget.ScrollingTabContainerView;
-import android.support.v7.internal.widget.TintManager;
 import android.support.v7.view.ActionMode;
 import android.support.v7.widget.Toolbar;
 import android.util.TypedValue;
@@ -58,7 +58,6 @@
 import android.view.Window;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.animation.AccelerateInterpolator;
-import android.view.animation.AnimationUtils;
 import android.view.animation.DecelerateInterpolator;
 import android.view.animation.Interpolator;
 import android.widget.SpinnerAdapter;
@@ -132,8 +131,6 @@
     private boolean mShowHideAnimationEnabled;
     boolean mHideOnContentScroll;
 
-    private TintManager mTintManager;
-
     final ViewPropertyAnimatorListener mHideListener = new ViewPropertyAnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(View view) {
@@ -1184,7 +1181,7 @@
 
         @Override
         public Tab setIcon(int resId) {
-            return setIcon(getTintManager().getDrawable(resId));
+            return setIcon(AppCompatDrawableManager.get().getDrawable(mContext, resId));
         }
 
         @Override
@@ -1340,12 +1337,4 @@
             setDisplayHomeAsUpEnabled(enable);
         }
     }
-
-    TintManager getTintManager() {
-        if (mTintManager == null) {
-            mTintManager = TintManager.get(mContext);
-        }
-        return mTintManager;
-    }
-
 }
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemImpl.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemImpl.java
index ed2afc0..ccf3c49 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemImpl.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemImpl.java
@@ -21,11 +21,10 @@
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.os.Build;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ActionProvider;
 import android.support.v4.internal.view.SupportMenuItem;
+import android.support.v4.view.ActionProvider;
 import android.support.v4.view.MenuItemCompat;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.Log;
 import android.view.ContextMenu.ContextMenuInfo;
 import android.view.LayoutInflater;
@@ -419,7 +418,8 @@
         }
 
         if (mIconResId != NO_ICON) {
-            Drawable icon = TintManager.getDrawable(mMenu.getContext(), mIconResId);
+            Drawable icon = AppCompatDrawableManager.get()
+                    .getDrawable(mMenu.getContext(), mIconResId);
             mIconResId = NO_ICON;
             mIconDrawable = icon;
             return icon;
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/TintManager.java b/v7/appcompat/src/android/support/v7/internal/widget/AppCompatDrawableManager.java
similarity index 80%
rename from v7/appcompat/src/android/support/v7/internal/widget/TintManager.java
rename to v7/appcompat/src/android/support/v7/internal/widget/AppCompatDrawableManager.java
index bfaa570..8f0b84c 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/TintManager.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/AppCompatDrawableManager.java
@@ -25,8 +25,10 @@
 import android.graphics.drawable.DrawableContainer;
 import android.graphics.drawable.InsetDrawable;
 import android.graphics.drawable.LayerDrawable;
-import android.graphics.drawable.StateListDrawable;
 import android.os.Build;
+import android.support.annotation.DrawableRes;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.graphics.ColorUtils;
 import android.support.v4.graphics.drawable.DrawableCompat;
@@ -34,9 +36,8 @@
 import android.support.v7.appcompat.R;
 import android.util.Log;
 import android.util.SparseArray;
-import android.view.View;
 
-import java.lang.ref.WeakReference;
+import java.util.ArrayList;
 import java.util.WeakHashMap;
 
 import static android.support.v7.internal.widget.ThemeUtils.getDisabledThemeAttrColor;
@@ -46,15 +47,34 @@
 /**
  * @hide
  */
-public final class TintManager {
+public final class AppCompatDrawableManager {
 
-    public static final boolean SHOULD_BE_USED = Build.VERSION.SDK_INT < 21;
+    public interface InflateDelegate {
+        /**
+         * Allows custom inflation of a drawable resource.
+         *
+         * @param context Context to inflate/create with
+         * @param resId Resource ID of the drawable
+         * @return the created drawable, or {@code null} to leave inflation to
+         * AppCompatDrawableManager.
+         */
+        @Nullable
+        Drawable onInflateDrawable(@NonNull Context context, @DrawableRes int resId);
+    }
 
     private static final String TAG = "TintManager";
     private static final boolean DEBUG = false;
     private static final PorterDuff.Mode DEFAULT_MODE = PorterDuff.Mode.SRC_IN;
 
-    private static final WeakHashMap<Context, TintManager> INSTANCE_CACHE = new WeakHashMap<>();
+    private static AppCompatDrawableManager INSTANCE;
+
+    public static AppCompatDrawableManager get() {
+        if (INSTANCE == null) {
+            INSTANCE = new AppCompatDrawableManager();
+        }
+        return INSTANCE;
+    }
+
     private static final ColorFilterLruCache COLOR_FILTER_CACHE = new ColorFilterLruCache(6);
 
     /**
@@ -134,46 +154,27 @@
             R.drawable.abc_btn_radio_material
     };
 
-    private final WeakReference<Context> mContextRef;
-    private SparseArray<ColorStateList> mTintLists;
-    private ColorStateList mDefaultColorStateList;
+    private WeakHashMap<Context, SparseArray<ColorStateList>> mTintLists;
+    private ArrayList<InflateDelegate> mDelegates;
 
-    /**
-     * A helper method to get a {@link TintManager} and then call {@link #getDrawable(int)}.
-     * This method should not be used routinely.
-     */
-    public static Drawable getDrawable(Context context, int resId) {
-        if (isInTintList(resId)) {
-            return TintManager.get(context).getDrawable(resId);
-        } else {
-            return ContextCompat.getDrawable(context, resId);
+    public Drawable getDrawable(@NonNull Context context, @DrawableRes int resId) {
+        return getDrawable(context, resId, false);
+    }
+
+    public Drawable getDrawable(@NonNull Context context, @DrawableRes int resId,
+            boolean failIfNotKnown) {
+        // Let the InflateDelegates have a go first
+        if (mDelegates != null) {
+            for (int i = 0, count = mDelegates.size(); i < count; i++) {
+                final InflateDelegate delegate = mDelegates.get(i);
+                final Drawable result = delegate.onInflateDrawable(context, resId);
+                if (result != null) {
+                    return result;
+                }
+            }
         }
-    }
 
-    /**
-     * Get a {@link android.support.v7.internal.widget.TintManager} instance.
-     */
-    public static TintManager get(Context context) {
-        TintManager tm = INSTANCE_CACHE.get(context);
-        if (tm == null) {
-            tm = new TintManager(context);
-            INSTANCE_CACHE.put(context, tm);
-        }
-        return tm;
-    }
-
-    private TintManager(Context context) {
-        mContextRef = new WeakReference<>(context);
-    }
-
-    public Drawable getDrawable(int resId) {
-        return getDrawable(resId, false);
-    }
-
-    public Drawable getDrawable(int resId, boolean failIfNotKnown) {
-        final Context context = mContextRef.get();
-        if (context == null) return null;
-
+        // The delegates failed so we'll carry on
         Drawable drawable = ContextCompat.getDrawable(context, resId);
 
         if (drawable != null) {
@@ -182,7 +183,7 @@
                 drawable = drawable.mutate();
             }
 
-            final ColorStateList tintList = getTintList(resId);
+            final ColorStateList tintList = getTintList(context, resId);
             if (tintList != null) {
                 // First wrap the Drawable and set the tint list
                 drawable = DrawableCompat.wrap(drawable);
@@ -195,8 +196,8 @@
                 }
             } else if (resId == R.drawable.abc_cab_background_top_material) {
                 return new LayerDrawable(new Drawable[]{
-                        getDrawable(R.drawable.abc_cab_background_internal_bg),
-                        getDrawable(R.drawable.abc_cab_background_top_mtrl_alpha)
+                        getDrawable(context, R.drawable.abc_cab_background_internal_bg),
+                        getDrawable(context, R.drawable.abc_cab_background_top_mtrl_alpha)
                 });
             } else if (resId == R.drawable.abc_seekbar_track_material) {
                 LayerDrawable ld = (LayerDrawable) drawable;
@@ -207,8 +208,8 @@
                 setPorterDuffColorFilter(ld.findDrawableByLayerId(android.R.id.progress),
                         getThemeAttrColor(context, R.attr.colorControlActivated), DEFAULT_MODE);
             } else {
-                final boolean usedColorFilter = tintDrawableUsingColorFilter(resId, drawable);
-                if (!usedColorFilter && failIfNotKnown) {
+                final boolean tinted = tintDrawableUsingColorFilter(context, resId, drawable);
+                if (!tinted && failIfNotKnown) {
                     // If we didn't tint using a ColorFilter, and we're set to fail if we don't
                     // know the id, return null
                     drawable = null;
@@ -218,10 +219,8 @@
         return drawable;
     }
 
-    public final boolean tintDrawableUsingColorFilter(final int resId, Drawable drawable) {
-        final Context context = mContextRef.get();
-        if (context == null) return false;
-
+    public final boolean tintDrawableUsingColorFilter(@NonNull Context context,
+            @DrawableRes final int resId, @NonNull Drawable drawable) {
         PorterDuff.Mode tintMode = DEFAULT_MODE;
         boolean colorAttrSet = false;
         int colorAttr = 0;
@@ -260,6 +259,21 @@
         return false;
     }
 
+    public void addDelegate(@NonNull InflateDelegate delegate) {
+        if (mDelegates == null) {
+            mDelegates = new ArrayList<>();
+        }
+        if (!mDelegates.contains(delegate)) {
+            mDelegates.add(delegate);
+        }
+    }
+
+    public void removeDelegate(@NonNull InflateDelegate delegate) {
+        if (mDelegates != null) {
+            mDelegates.remove(delegate);
+        }
+    }
+
     private static boolean arrayContains(int[] array, int value) {
         for (int id : array) {
             if (id == value) {
@@ -269,16 +283,6 @@
         return false;
     }
 
-    private static boolean isInTintList(int drawableId) {
-        return arrayContains(TINT_COLOR_CONTROL_NORMAL, drawableId) ||
-                arrayContains(COLORFILTER_TINT_COLOR_CONTROL_NORMAL, drawableId) ||
-                arrayContains(COLORFILTER_COLOR_CONTROL_ACTIVATED, drawableId) ||
-                arrayContains(TINT_COLOR_CONTROL_STATE_LIST, drawableId) ||
-                arrayContains(COLORFILTER_COLOR_BACKGROUND_MULTIPLY, drawableId) ||
-                arrayContains(TINT_CHECKABLE_BUTTON_LIST, drawableId) ||
-                drawableId == R.drawable.abc_cab_background_top_material;
-    }
-
     final PorterDuff.Mode getTintMode(final int resId) {
         PorterDuff.Mode mode = null;
 
@@ -289,12 +293,9 @@
         return mode;
     }
 
-    public final ColorStateList getTintList(int resId) {
-        final Context context = mContextRef.get();
-        if (context == null) return null;
-
+    public final ColorStateList getTintList(@NonNull Context context, @DrawableRes int resId) {
         // Try the cache first (if it exists)
-        ColorStateList tint = mTintLists != null ? mTintLists.get(resId) : null;
+        ColorStateList tint = getTintListFromCache(context, resId);
 
         if (tint == null) {
             // ...if the cache did not contain a color state list, try and create one
@@ -315,7 +316,7 @@
             } else if (arrayContains(TINT_COLOR_CONTROL_NORMAL, resId)) {
                 tint = getThemeAttrColorStateList(context, R.attr.colorControlNormal);
             } else if (arrayContains(TINT_COLOR_CONTROL_STATE_LIST, resId)) {
-                tint = getDefaultColorStateList(context);
+                tint = createDefaultColorStateList(context);
             } else if (arrayContains(TINT_CHECKABLE_BUTTON_LIST, resId)) {
                 tint = createCheckableButtonColorStateList(context);
             } else if (resId == R.drawable.abc_seekbar_thumb_material) {
@@ -323,65 +324,78 @@
             }
 
             if (tint != null) {
-                if (mTintLists == null) {
-                    // If our tint list cache hasn't been set up yet, create it
-                    mTintLists = new SparseArray<>();
-                }
-                // Add any newly created ColorStateList to the cache
-                mTintLists.append(resId, tint);
+                addTintListToCache(context, resId, tint);
             }
         }
         return tint;
     }
 
-    private ColorStateList getDefaultColorStateList(Context context) {
-        if (mDefaultColorStateList == null) {
-            /**
-             * Generate the default color state list which uses the colorControl attributes.
-             * Order is important here. The default enabled state needs to go at the bottom.
-             */
-
-            final int colorControlNormal = getThemeAttrColor(context, R.attr.colorControlNormal);
-            final int colorControlActivated = getThemeAttrColor(context,
-                    R.attr.colorControlActivated);
-
-            final int[][] states = new int[7][];
-            final int[] colors = new int[7];
-            int i = 0;
-
-            // Disabled state
-            states[i] = ThemeUtils.DISABLED_STATE_SET;
-            colors[i] = getDisabledThemeAttrColor(context, R.attr.colorControlNormal);
-            i++;
-
-            states[i] = ThemeUtils.FOCUSED_STATE_SET;
-            colors[i] = colorControlActivated;
-            i++;
-
-            states[i] = ThemeUtils.ACTIVATED_STATE_SET;
-            colors[i] = colorControlActivated;
-            i++;
-
-            states[i] = ThemeUtils.PRESSED_STATE_SET;
-            colors[i] = colorControlActivated;
-            i++;
-
-            states[i] = ThemeUtils.CHECKED_STATE_SET;
-            colors[i] = colorControlActivated;
-            i++;
-
-            states[i] = ThemeUtils.SELECTED_STATE_SET;
-            colors[i] = colorControlActivated;
-            i++;
-
-            // Default enabled state
-            states[i] = ThemeUtils.EMPTY_STATE_SET;
-            colors[i] = colorControlNormal;
-            i++;
-
-            mDefaultColorStateList = new ColorStateList(states, colors);
+    private ColorStateList getTintListFromCache(@NonNull Context context, @DrawableRes int resId) {
+        if (mTintLists != null) {
+            final SparseArray<ColorStateList> tints = mTintLists.get(context);
+            return tints != null ? tints.get(resId) : null;
         }
-        return mDefaultColorStateList;
+        return null;
+    }
+
+    private void addTintListToCache(@NonNull Context context, @DrawableRes int resId,
+            @NonNull ColorStateList tintList) {
+        if (mTintLists == null) {
+            mTintLists = new WeakHashMap<>();
+        }
+        SparseArray<ColorStateList> themeTints = mTintLists.get(context);
+        if (themeTints == null) {
+            themeTints = new SparseArray<>();
+            mTintLists.put(context, themeTints);
+        }
+        themeTints.append(resId, tintList);
+    }
+
+    private ColorStateList createDefaultColorStateList(Context context) {
+        /**
+         * Generate the default color state list which uses the colorControl attributes.
+         * Order is important here. The default enabled state needs to go at the bottom.
+         */
+
+        final int colorControlNormal = getThemeAttrColor(context, R.attr.colorControlNormal);
+        final int colorControlActivated = getThemeAttrColor(context,
+                R.attr.colorControlActivated);
+
+        final int[][] states = new int[7][];
+        final int[] colors = new int[7];
+        int i = 0;
+
+        // Disabled state
+        states[i] = ThemeUtils.DISABLED_STATE_SET;
+        colors[i] = getDisabledThemeAttrColor(context, R.attr.colorControlNormal);
+        i++;
+
+        states[i] = ThemeUtils.FOCUSED_STATE_SET;
+        colors[i] = colorControlActivated;
+        i++;
+
+        states[i] = ThemeUtils.ACTIVATED_STATE_SET;
+        colors[i] = colorControlActivated;
+        i++;
+
+        states[i] = ThemeUtils.PRESSED_STATE_SET;
+        colors[i] = colorControlActivated;
+        i++;
+
+        states[i] = ThemeUtils.CHECKED_STATE_SET;
+        colors[i] = colorControlActivated;
+        i++;
+
+        states[i] = ThemeUtils.SELECTED_STATE_SET;
+        colors[i] = colorControlActivated;
+        i++;
+
+        // Default enabled state
+        states[i] = ThemeUtils.EMPTY_STATE_SET;
+        colors[i] = colorControlNormal;
+        i++;
+
+        return new ColorStateList(states, colors);
     }
 
     private ColorStateList createCheckableButtonColorStateList(Context context) {
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/TintContextWrapper.java b/v7/appcompat/src/android/support/v7/internal/widget/TintContextWrapper.java
index 3fdd971..f9bc275 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/TintContextWrapper.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/TintContextWrapper.java
@@ -45,7 +45,7 @@
     @Override
     public Resources getResources() {
         if (mResources == null) {
-            mResources = new TintResources(super.getResources(), TintManager.get(this));
+            mResources = new TintResources(super.getResources());
         }
         return mResources;
     }
@@ -53,13 +53,9 @@
     /**
      * This class allows us to intercept calls so that we can tint resources (if applicable).
      */
-    static class TintResources extends ResourcesWrapper {
-
-        private final TintManager mTintManager;
-
-        public TintResources(Resources resources, TintManager tintManager) {
+    class TintResources extends ResourcesWrapper {
+        public TintResources(Resources resources) {
             super(resources);
-            mTintManager = tintManager;
         }
 
         /**
@@ -71,7 +67,8 @@
         public Drawable getDrawable(int id) throws NotFoundException {
             Drawable d = super.getDrawable(id);
             if (d != null) {
-                mTintManager.tintDrawableUsingColorFilter(id, d);
+                AppCompatDrawableManager.get().tintDrawableUsingColorFilter(
+                        TintContextWrapper.this, id, d);
             }
             return d;
         }
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/TintTypedArray.java b/v7/appcompat/src/android/support/v7/internal/widget/TintTypedArray.java
index 09e2b56..eae72d6 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/TintTypedArray.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/TintTypedArray.java
@@ -36,8 +36,6 @@
     private final Context mContext;
     private final TypedArray mWrapped;
 
-    private TintManager mTintManager;
-
     public static TintTypedArray obtainStyledAttributes(Context context, AttributeSet set,
             int[] attrs) {
         TypedArray array = context.obtainStyledAttributes(set, attrs);
@@ -59,7 +57,7 @@
         if (mWrapped.hasValue(index)) {
             final int resourceId = mWrapped.getResourceId(index, 0);
             if (resourceId != 0) {
-                return getTintManager().getDrawable(resourceId);
+                return AppCompatDrawableManager.get().getDrawable(mContext, resourceId);
             }
         }
         return mWrapped.getDrawable(index);
@@ -69,7 +67,7 @@
         if (mWrapped.hasValue(index)) {
             final int resourceId = mWrapped.getResourceId(index, 0);
             if (resourceId != 0) {
-                return getTintManager().getDrawable(resourceId, true);
+                return AppCompatDrawableManager.get().getDrawable(mContext, resourceId, true);
             }
         }
         return null;
@@ -187,11 +185,4 @@
         return mWrapped.getChangingConfigurations();
     }
 
-    public TintManager getTintManager() {
-        if (mTintManager == null) {
-            mTintManager = TintManager.get(mContext);
-        }
-        return mTintManager;
-    }
-
 }
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/ToolbarWidgetWrapper.java b/v7/appcompat/src/android/support/v7/internal/widget/ToolbarWidgetWrapper.java
index 59b52c5..8828769 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/ToolbarWidgetWrapper.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/ToolbarWidgetWrapper.java
@@ -85,7 +85,7 @@
 
     private int mNavigationMode = ActionBar.NAVIGATION_MODE_STANDARD;
 
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
     private int mDefaultNavigationContentDescription = 0;
     private Drawable mDefaultNavigationIcon;
 
@@ -174,18 +174,16 @@
             }
 
             a.recycle();
-            // Keep the TintManager in case we need it later
-            mTintManager = a.getTintManager();
         } else {
             mDisplayOpts = detectDisplayOptions();
-            // Create a TintManager in case we need it later
-            mTintManager = TintManager.get(toolbar.getContext());
         }
 
+        mDrawableManager = AppCompatDrawableManager.get();
+
         setDefaultNavigationContentDescription(defaultNavigationContentDescription);
         mHomeDescription = mToolbar.getNavigationContentDescription();
 
-        setDefaultNavigationIcon(mTintManager.getDrawable(defaultNavigationIcon));
+        setDefaultNavigationIcon(mDrawableManager.getDrawable(getContext(), defaultNavigationIcon));
 
         mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
             final ActionMenuItem mNavItem = new ActionMenuItem(mToolbar.getContext(),
@@ -322,7 +320,7 @@
 
     @Override
     public void setIcon(int resId) {
-        setIcon(resId != 0 ? mTintManager.getDrawable(resId) : null);
+        setIcon(resId != 0 ? mDrawableManager.getDrawable(getContext(), resId) : null);
     }
 
     @Override
@@ -333,7 +331,7 @@
 
     @Override
     public void setLogo(int resId) {
-        setLogo(resId != 0 ? mTintManager.getDrawable(resId) : null);
+        setLogo(resId != 0 ? mDrawableManager.getDrawable(getContext(), resId) : null);
     }
 
     @Override
@@ -623,8 +621,7 @@
     @Override
     public void setNavigationIcon(int resId) {
         setNavigationIcon(resId != 0
-                ? mTintManager.getDrawable(resId)
-                : null);
+                ? AppCompatDrawableManager.get().getDrawable(getContext(), resId) : null);
     }
 
     @Override
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java
index 7d8746d..2cbf14f 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java
@@ -24,8 +24,8 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintContextWrapper;
-import android.support.v7.internal.widget.TintManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.widget.AutoCompleteTextView;
@@ -52,7 +52,7 @@
             android.R.attr.popupBackground
     };
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatBackgroundHelper mBackgroundTintHelper;
     private AppCompatTextHelper mTextHelper;
 
@@ -67,15 +67,16 @@
     public AppCompatAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(TintContextWrapper.wrap(context), attrs, defStyleAttr);
 
+        mDrawableManager = AppCompatDrawableManager.get();
+
         TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
                 TINT_ATTRS, defStyleAttr, 0);
-        mTintManager = a.getTintManager();
         if (a.hasValue(0)) {
             setDropDownBackgroundDrawable(a.getDrawable(0));
         }
         a.recycle();
 
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mTintManager);
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mDrawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
         mTextHelper = AppCompatTextHelper.create(this);
@@ -85,8 +86,8 @@
 
     @Override
     public void setDropDownBackgroundResource(@DrawableRes int resId) {
-        if (mTintManager != null) {
-            setDropDownBackgroundDrawable(mTintManager.getDrawable(resId));
+        if (mDrawableManager != null) {
+            setDropDownBackgroundDrawable(mDrawableManager.getDrawable(getContext(), resId));
         } else {
             super.setDropDownBackgroundResource(resId);
         }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java
index 6022e55..a6218f9 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java
@@ -23,22 +23,22 @@
 import android.support.v4.view.ViewCompat;
 import android.support.v7.appcompat.R;
 import android.support.v7.graphics.drawable.DrawableUtils;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintInfo;
-import android.support.v7.internal.widget.TintManager;
 import android.util.AttributeSet;
 import android.view.View;
 
 class AppCompatBackgroundHelper {
 
     private final View mView;
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
 
     private TintInfo mInternalBackgroundTint;
     private TintInfo mBackgroundTint;
 
-    AppCompatBackgroundHelper(View view, TintManager tintManager) {
+    AppCompatBackgroundHelper(View view, AppCompatDrawableManager drawableManager) {
         mView = view;
-        mTintManager = tintManager;
+        mDrawableManager = drawableManager;
     }
 
     void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
@@ -46,7 +46,7 @@
                 R.styleable.ViewBackgroundHelper, defStyleAttr, 0);
         try {
             if (a.hasValue(R.styleable.ViewBackgroundHelper_android_background)) {
-                ColorStateList tint = mTintManager.getTintList(
+                ColorStateList tint = mDrawableManager.getTintList(mView.getContext(),
                         a.getResourceId(R.styleable.ViewBackgroundHelper_android_background, -1));
                 if (tint != null) {
                     setInternalBackgroundTint(tint);
@@ -69,7 +69,9 @@
 
     void onSetBackgroundResource(int resId) {
         // Update the default background tint
-        setInternalBackgroundTint(mTintManager != null ? mTintManager.getTintList(resId) : null);
+        setInternalBackgroundTint(mDrawableManager != null
+                ? mDrawableManager.getTintList(mView.getContext(), resId)
+                : null);
     }
 
     void onSetBackgroundDrawable(Drawable background) {
@@ -109,9 +111,10 @@
         final Drawable background = mView.getBackground();
         if (background != null) {
             if (mBackgroundTint != null) {
-                TintManager.tintDrawable(background, mBackgroundTint, mView.getDrawableState());
+                AppCompatDrawableManager
+                        .tintDrawable(background, mBackgroundTint, mView.getDrawableState());
             } else if (mInternalBackgroundTint != null) {
-                TintManager.tintDrawable(background, mInternalBackgroundTint,
+                AppCompatDrawableManager.tintDrawable(background, mInternalBackgroundTint,
                         mView.getDrawableState());
             }
         }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java b/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java
index 3f51d6e..545c0f9 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java
@@ -24,8 +24,7 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.text.AllCapsTransformationMethod;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
@@ -48,7 +47,7 @@
  */
 public class AppCompatButton extends Button implements TintableBackgroundView {
 
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
     private final AppCompatBackgroundHelper mBackgroundTintHelper;
     private final AppCompatTextHelper mTextHelper;
 
@@ -63,8 +62,8 @@
     public AppCompatButton(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
-        mTintManager = TintManager.get(getContext());
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mTintManager);
+        mDrawableManager = AppCompatDrawableManager.get();
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mDrawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
         mTextHelper = AppCompatTextHelper.create(this);
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java b/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java
index 1ad2c77..cb7d2f4 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java
@@ -25,7 +25,7 @@
 import android.support.v4.content.ContextCompat;
 import android.support.v4.widget.TintableCompoundButton;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.widget.CheckBox;
 
@@ -44,7 +44,7 @@
  */
 public class AppCompatCheckBox extends CheckBox implements TintableCompoundButton {
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatCompoundButtonHelper mCompoundButtonHelper;
 
     public AppCompatCheckBox(Context context) {
@@ -57,8 +57,8 @@
 
     public AppCompatCheckBox(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
-        mTintManager = TintManager.get(context);
-        mCompoundButtonHelper = new AppCompatCompoundButtonHelper(this, mTintManager);
+        mDrawableManager = AppCompatDrawableManager.get();
+        mCompoundButtonHelper = new AppCompatCompoundButtonHelper(this, mDrawableManager);
         mCompoundButtonHelper.loadFromAttributes(attrs, defStyleAttr);
     }
 
@@ -72,8 +72,8 @@
 
     @Override
     public void setButtonDrawable(@DrawableRes int resId) {
-        setButtonDrawable(mTintManager != null
-                ? mTintManager.getDrawable(resId)
+        setButtonDrawable(mDrawableManager != null
+                ? mDrawableManager.getDrawable(getContext(), resId)
                 : ContextCompat.getDrawable(getContext(), resId));
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatCheckedTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatCheckedTextView.java
index a892ae5..35e146e 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatCheckedTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatCheckedTextView.java
@@ -18,7 +18,7 @@
 
 import android.content.Context;
 import android.support.annotation.DrawableRes;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.widget.CheckedTextView;
@@ -35,7 +35,7 @@
             android.R.attr.checkMark
     };
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatTextHelper mTextHelper;
 
     public AppCompatCheckedTextView(Context context) {
@@ -53,20 +53,18 @@
         mTextHelper.loadFromAttributes(attrs, defStyleAttr);
         mTextHelper.applyCompoundDrawablesTints();
 
-        if (TintManager.SHOULD_BE_USED) {
-            TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
-                    TINT_ATTRS, defStyleAttr, 0);
-            setCheckMarkDrawable(a.getDrawable(0));
-            a.recycle();
+        mDrawableManager = AppCompatDrawableManager.get();
 
-            mTintManager = a.getTintManager();
-        }
+        TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
+                TINT_ATTRS, defStyleAttr, 0);
+        setCheckMarkDrawable(a.getDrawable(0));
+        a.recycle();
     }
 
     @Override
     public void setCheckMarkDrawable(@DrawableRes int resId) {
-        if (mTintManager != null) {
-            setCheckMarkDrawable(mTintManager.getDrawable(resId));
+        if (mDrawableManager != null) {
+            setCheckMarkDrawable(mDrawableManager.getDrawable(getContext(), resId));
         } else {
             super.setCheckMarkDrawable(resId);
         }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatCompoundButtonHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatCompoundButtonHelper.java
index 20c3667..0711210 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatCompoundButtonHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatCompoundButtonHelper.java
@@ -26,14 +26,14 @@
 import android.support.v4.widget.CompoundButtonCompat;
 import android.support.v7.appcompat.R;
 import android.support.v7.graphics.drawable.DrawableUtils;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.widget.CompoundButton;
 
 class AppCompatCompoundButtonHelper {
 
     private final CompoundButton mView;
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
 
     private ColorStateList mButtonTintList = null;
     private PorterDuff.Mode mButtonTintMode = null;
@@ -49,9 +49,9 @@
         void setButtonDrawable(Drawable buttonDrawable);
     }
 
-    AppCompatCompoundButtonHelper(CompoundButton view, TintManager tintManager) {
+    AppCompatCompoundButtonHelper(CompoundButton view, AppCompatDrawableManager drawableManager) {
         mView = view;
-        mTintManager = tintManager;
+        mDrawableManager = drawableManager;
     }
 
     void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
@@ -62,7 +62,8 @@
                 final int resourceId = a.getResourceId(
                         R.styleable.CompoundButton_android_button, 0);
                 if (resourceId != 0) {
-                    mView.setButtonDrawable(mTintManager.getDrawable(resourceId));
+                    mView.setButtonDrawable(
+                            mDrawableManager.getDrawable(mView.getContext(), resourceId));
                 }
             }
             if (a.hasValue(R.styleable.CompoundButton_buttonTint)) {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java b/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java
index 7845388..151e4f3 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java
@@ -24,8 +24,8 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintContextWrapper;
-import android.support.v7.internal.widget.TintManager;
 import android.util.AttributeSet;
 import android.widget.EditText;
 
@@ -46,7 +46,7 @@
  */
 public class AppCompatEditText extends EditText implements TintableBackgroundView {
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatBackgroundHelper mBackgroundTintHelper;
     private AppCompatTextHelper mTextHelper;
 
@@ -61,8 +61,8 @@
     public AppCompatEditText(Context context, AttributeSet attrs, int defStyleAttr) {
         super(TintContextWrapper.wrap(context), attrs, defStyleAttr);
 
-        mTintManager = TintManager.get(getContext());
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mTintManager);
+        mDrawableManager = AppCompatDrawableManager.get();
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mDrawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
         mTextHelper = AppCompatTextHelper.create(this);
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java b/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java
index 20c5402..84b225d 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java
@@ -24,11 +24,9 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
-import android.widget.Button;
 import android.widget.ImageButton;
-import android.widget.ImageView;
 
 /**
  * A {@link ImageButton} which supports compatible features on older version of the platform,
@@ -59,12 +57,12 @@
     public AppCompatImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
-        final TintManager tintManager = TintManager.get(context);
+        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
 
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, tintManager);
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, drawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
-        mImageHelper = new AppCompatImageHelper(this, tintManager);
+        mImageHelper = new AppCompatImageHelper(this, drawableManager);
         mImageHelper.loadFromAttributes(attrs, defStyleAttr);
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java
index 41bda8b..bcbca2b 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java
@@ -16,11 +16,8 @@
 
 package android.support.v7.widget;
 
-import android.content.res.ColorStateList;
-import android.graphics.PorterDuff;
 import android.support.v4.content.ContextCompat;
-import android.support.v7.internal.widget.TintInfo;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.widget.ImageView;
@@ -30,11 +27,11 @@
     private static final int[] VIEW_ATTRS = {android.R.attr.src};
 
     private final ImageView mView;
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
 
-    AppCompatImageHelper(ImageView view, TintManager tintManager) {
+    AppCompatImageHelper(ImageView view, AppCompatDrawableManager drawableManager) {
         mView = view;
-        mTintManager = tintManager;
+        mDrawableManager = drawableManager;
     }
 
     void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
@@ -50,8 +47,8 @@
     }
 
     void setImageResource(int resId) {
-        mView.setImageDrawable(mTintManager != null
-                ? mTintManager.getDrawable(resId)
+        mView.setImageDrawable(mDrawableManager != null
+                ? mDrawableManager.getDrawable(mView.getContext(), resId)
                 : ContextCompat.getDrawable(mView.getContext(), resId));
     }
 }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java
index c289028..4bad773 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java
@@ -24,10 +24,8 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
-import android.support.v7.internal.widget.TintTypedArray;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
-import android.widget.ImageButton;
 import android.widget.ImageView;
 
 /**
@@ -59,12 +57,12 @@
     public AppCompatImageView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
-        final TintManager tintManager = TintManager.get(context);
+        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
 
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, tintManager);
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, drawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
-        mImageHelper = new AppCompatImageHelper(this, tintManager);
+        mImageHelper = new AppCompatImageHelper(this, drawableManager);
         mImageHelper.loadFromAttributes(attrs, defStyleAttr);
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java
index fae720a..dae7557 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java
@@ -24,8 +24,8 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintContextWrapper;
-import android.support.v7.internal.widget.TintManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.widget.MultiAutoCompleteTextView;
@@ -52,7 +52,7 @@
             android.R.attr.popupBackground
     };
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatBackgroundHelper mBackgroundTintHelper;
     private AppCompatTextHelper mTextHelper;
 
@@ -67,15 +67,16 @@
     public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(TintContextWrapper.wrap(context), attrs, defStyleAttr);
 
+        mDrawableManager = AppCompatDrawableManager.get();
+
         TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
                 TINT_ATTRS, defStyleAttr, 0);
-        mTintManager = a.getTintManager();
         if (a.hasValue(0)) {
             setDropDownBackgroundDrawable(a.getDrawable(0));
         }
         a.recycle();
 
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mTintManager);
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mDrawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
         mTextHelper = AppCompatTextHelper.create(this);
@@ -85,8 +86,8 @@
 
     @Override
     public void setDropDownBackgroundResource(@DrawableRes int resId) {
-        if (mTintManager != null) {
-            setDropDownBackgroundDrawable(mTintManager.getDrawable(resId));
+        if (mDrawableManager != null) {
+            setDropDownBackgroundDrawable(mDrawableManager.getDrawable(getContext(), resId));
         } else {
             super.setDropDownBackgroundResource(resId);
         }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatProgressBarHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatProgressBarHelper.java
index 7fd8f05..34f00fa 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatProgressBarHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatProgressBarHelper.java
@@ -28,12 +28,10 @@
 import android.graphics.drawable.shapes.RoundRectShape;
 import android.graphics.drawable.shapes.Shape;
 import android.support.v4.graphics.drawable.DrawableWrapper;
-import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.view.Gravity;
-import android.widget.CompoundButton;
 import android.widget.ProgressBar;
 
 class AppCompatProgressBarHelper {
@@ -44,13 +42,13 @@
     };
 
     private final ProgressBar mView;
-    final TintManager mTintManager;
+    final AppCompatDrawableManager mDrawableManager;
 
     private Bitmap mSampleTile;
 
-    AppCompatProgressBarHelper(ProgressBar view, TintManager tintManager) {
+    AppCompatProgressBarHelper(ProgressBar view, AppCompatDrawableManager drawableManager) {
         mView = view;
-        mTintManager = tintManager;
+        mDrawableManager = drawableManager;
     }
 
     void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java b/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java
index 0d928fc..1c36fd9 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java
@@ -25,7 +25,7 @@
 import android.support.v4.content.ContextCompat;
 import android.support.v4.widget.TintableCompoundButton;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.widget.RadioButton;
 
@@ -44,7 +44,7 @@
  */
 public class AppCompatRadioButton extends RadioButton implements TintableCompoundButton {
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatCompoundButtonHelper mCompoundButtonHelper;
 
     public AppCompatRadioButton(Context context) {
@@ -57,8 +57,8 @@
 
     public AppCompatRadioButton(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
-        mTintManager = TintManager.get(context);
-        mCompoundButtonHelper = new AppCompatCompoundButtonHelper(this, mTintManager);
+        mDrawableManager = AppCompatDrawableManager.get();
+        mCompoundButtonHelper = new AppCompatCompoundButtonHelper(this, mDrawableManager);
         mCompoundButtonHelper.loadFromAttributes(attrs, defStyleAttr);
     }
 
@@ -72,8 +72,8 @@
 
     @Override
     public void setButtonDrawable(@DrawableRes int resId) {
-        setButtonDrawable(mTintManager != null
-                ? mTintManager.getDrawable(resId)
+        setButtonDrawable(mDrawableManager != null
+                ? mDrawableManager.getDrawable(getContext(), resId)
                 : ContextCompat.getDrawable(getContext(), resId));
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatRatingBar.java b/v7/appcompat/src/android/support/v7/widget/AppCompatRatingBar.java
index 0bc14ab..bb26c6d 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatRatingBar.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatRatingBar.java
@@ -20,7 +20,7 @@
 import android.graphics.Bitmap;
 import android.support.v4.view.ViewCompat;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.widget.RatingBar;
 
@@ -33,7 +33,7 @@
 public class AppCompatRatingBar extends RatingBar {
 
     private AppCompatProgressBarHelper mAppCompatProgressBarHelper;
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
 
     public AppCompatRatingBar(Context context) {
         this(context, null);
@@ -46,9 +46,9 @@
     public AppCompatRatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
-        mTintManager = TintManager.get(context);
+        mDrawableManager = AppCompatDrawableManager.get();
 
-        mAppCompatProgressBarHelper = new AppCompatProgressBarHelper(this, mTintManager);
+        mAppCompatProgressBarHelper = new AppCompatProgressBarHelper(this, mDrawableManager);
         mAppCompatProgressBarHelper.loadFromAttributes(attrs, defStyleAttr);
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBar.java b/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBar.java
index 86ec881..a6d7fcf 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBar.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBar.java
@@ -18,7 +18,7 @@
 
 import android.content.Context;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.widget.SeekBar;
 
@@ -31,7 +31,7 @@
 public class AppCompatSeekBar extends SeekBar {
 
     private AppCompatSeekBarHelper mAppCompatSeekBarHelper;
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
 
     public AppCompatSeekBar(Context context) {
         this(context, null);
@@ -44,9 +44,9 @@
     public AppCompatSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
-        mTintManager = TintManager.get(context);
+        mDrawableManager = AppCompatDrawableManager.get();
 
-        mAppCompatSeekBarHelper = new AppCompatSeekBarHelper(this, mTintManager);
+        mAppCompatSeekBarHelper = new AppCompatSeekBarHelper(this, mDrawableManager);
         mAppCompatSeekBarHelper.loadFromAttributes(attrs, defStyleAttr);
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBarHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBarHelper.java
index 3211942..0312921 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBarHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatSeekBarHelper.java
@@ -17,7 +17,7 @@
 package android.support.v7.widget;
 
 import android.graphics.drawable.Drawable;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.util.AttributeSet;
 import android.widget.SeekBar;
@@ -30,8 +30,8 @@
 
     private final SeekBar mView;
 
-    AppCompatSeekBarHelper(SeekBar view, TintManager tintManager) {
-        super(view, tintManager);
+    AppCompatSeekBarHelper(SeekBar view, AppCompatDrawableManager drawableManager) {
+        super(view, drawableManager);
         mView = view;
     }
 
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java b/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
index 90985cd..fa0ef54 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
@@ -31,7 +31,7 @@
 import android.support.v4.view.ViewCompat;
 import android.support.v7.appcompat.R;
 import android.support.v7.internal.view.ContextThemeWrapper;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.support.v7.internal.widget.ViewUtils;
 import android.util.AttributeSet;
@@ -77,7 +77,7 @@
     private static final int MODE_DROPDOWN = 1;
     private static final int MODE_THEME = -1;
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
 
     private AppCompatBackgroundHelper mBackgroundTintHelper;
 
@@ -199,8 +199,8 @@
         TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs,
                 R.styleable.Spinner, defStyleAttr, 0);
 
-        mTintManager = a.getTintManager();
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mTintManager);
+        mDrawableManager = AppCompatDrawableManager.get();
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mDrawableManager);
 
         if (popupTheme != null) {
             mPopupContext = new ContextThemeWrapper(context, popupTheme);
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelper.java
index 036ce70..2a1d02c 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelper.java
@@ -22,8 +22,8 @@
 import android.os.Build;
 import android.support.v7.appcompat.R;
 import android.support.v7.internal.text.AllCapsTransformationMethod;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintInfo;
-import android.support.v7.internal.widget.TintManager;
 import android.util.AttributeSet;
 import android.widget.TextView;
 
@@ -54,7 +54,7 @@
 
     void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
         final Context context = mView.getContext();
-        final TintManager tintManager = TintManager.get(context);
+        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
 
         // First read the TextAppearance style id
         TypedArray a = context.obtainStyledAttributes(attrs, VIEW_ATTRS, defStyleAttr, 0);
@@ -64,22 +64,26 @@
         if (a.hasValue(1)) {
             mDrawableLeftTint = new TintInfo();
             mDrawableLeftTint.mHasTintList = true;
-            mDrawableLeftTint.mTintList = tintManager.getTintList(a.getResourceId(1, 0));
+            mDrawableLeftTint.mTintList = drawableManager.getTintList(
+                    context, a.getResourceId(1, 0));
         }
         if (a.hasValue(2)) {
             mDrawableTopTint = new TintInfo();
             mDrawableTopTint.mHasTintList = true;
-            mDrawableTopTint.mTintList = tintManager.getTintList(a.getResourceId(2, 0));
+            mDrawableTopTint.mTintList = drawableManager.getTintList(
+                    context, a.getResourceId(2, 0));
         }
         if (a.hasValue(3)) {
             mDrawableRightTint = new TintInfo();
             mDrawableRightTint.mHasTintList = true;
-            mDrawableRightTint.mTintList = tintManager.getTintList(a.getResourceId(3, 0));
+            mDrawableRightTint.mTintList = drawableManager.getTintList(
+                    context, a.getResourceId(3, 0));
         }
         if (a.hasValue(4)) {
             mDrawableBottomTint = new TintInfo();
             mDrawableBottomTint.mHasTintList = true;
-            mDrawableBottomTint.mTintList = tintManager.getTintList(a.getResourceId(4, 0));
+            mDrawableBottomTint.mTintList = drawableManager.getTintList(
+                    context, a.getResourceId(4, 0));
         }
         a.recycle();
 
@@ -127,7 +131,7 @@
 
     final void applyCompoundDrawableTint(Drawable drawable, TintInfo info) {
         if (drawable != null && info != null) {
-            TintManager.tintDrawable(drawable, info, mView.getDrawableState());
+            AppCompatDrawableManager.tintDrawable(drawable, info, mView.getDrawableState());
         }
     }
 }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelperV17.java b/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelperV17.java
index f0337ab..fe53c74 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelperV17.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatTextHelperV17.java
@@ -19,8 +19,8 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintInfo;
-import android.support.v7.internal.widget.TintManager;
 import android.util.AttributeSet;
 import android.widget.TextView;
 
@@ -40,19 +40,21 @@
         super.loadFromAttributes(attrs, defStyleAttr);
 
         final Context context = mView.getContext();
-        final TintManager tintManager = TintManager.get(context);
+        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
 
         // First read the TextAppearance style id
         TypedArray a = context.obtainStyledAttributes(attrs, VIEW_ATTRS_v17, defStyleAttr, 0);
         if (a.hasValue(0)) {
             mDrawableStartTint = new TintInfo();
             mDrawableStartTint.mHasTintList = true;
-            mDrawableStartTint.mTintList = tintManager.getTintList(a.getResourceId(0, 0));
+            mDrawableStartTint.mTintList = drawableManager.getTintList(
+                    context, a.getResourceId(0, 0));
         }
         if (a.hasValue(1)) {
             mDrawableEndTint = new TintInfo();
             mDrawableEndTint.mHasTintList = true;
-            mDrawableEndTint.mTintList = tintManager.getTintList(a.getResourceId(1, 0));
+            mDrawableEndTint.mTintList = drawableManager.getTintList(
+                    context, a.getResourceId(1, 0));
         }
         a.recycle();
     }
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java
index cf99f3b..a990600 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java
@@ -24,7 +24,7 @@
 import android.support.annotation.Nullable;
 import android.support.v4.view.TintableBackgroundView;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.AttributeSet;
 import android.widget.TextView;
 
@@ -45,7 +45,7 @@
  */
 public class AppCompatTextView extends TextView implements TintableBackgroundView {
 
-    private TintManager mTintManager;
+    private AppCompatDrawableManager mDrawableManager;
     private AppCompatBackgroundHelper mBackgroundTintHelper;
     private AppCompatTextHelper mTextHelper;
 
@@ -60,8 +60,8 @@
     public AppCompatTextView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
-        mTintManager = TintManager.get(getContext());
-        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mTintManager);
+        mDrawableManager = AppCompatDrawableManager.get();
+        mBackgroundTintHelper = new AppCompatBackgroundHelper(this, mDrawableManager);
         mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
 
         mTextHelper = AppCompatTextHelper.create(this);
diff --git a/v7/appcompat/src/android/support/v7/widget/SearchView.java b/v7/appcompat/src/android/support/v7/widget/SearchView.java
index 65d1078..985c1f7 100644
--- a/v7/appcompat/src/android/support/v7/widget/SearchView.java
+++ b/v7/appcompat/src/android/support/v7/widget/SearchView.java
@@ -39,7 +39,7 @@
 import android.support.v4.view.KeyEventCompat;
 import android.support.v4.widget.CursorAdapter;
 import android.support.v7.appcompat.R;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.support.v7.internal.widget.ViewUtils;
 import android.support.v7.view.CollapsibleActionView;
@@ -162,7 +162,7 @@
     private SearchableInfo mSearchable;
     private Bundle mAppSearchData;
 
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
 
     static final AutoCompleteTextViewReflector HIDDEN_METHOD_INVOKER = new AutoCompleteTextViewReflector();
 
@@ -278,10 +278,10 @@
     public SearchView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
+        mDrawableManager = AppCompatDrawableManager.get();
+
         final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context,
                 attrs, R.styleable.SearchView, defStyleAttr, 0);
-        // Keep the TintManager in case we need it later
-        mTintManager = a.getTintManager();
 
         final LayoutInflater inflater = LayoutInflater.from(context);
         final int layoutResId = a.getResourceId(
diff --git a/v7/appcompat/src/android/support/v7/widget/ShareActionProvider.java b/v7/appcompat/src/android/support/v7/widget/ShareActionProvider.java
index a840f95..7b8b8e8 100644
--- a/v7/appcompat/src/android/support/v7/widget/ShareActionProvider.java
+++ b/v7/appcompat/src/android/support/v7/widget/ShareActionProvider.java
@@ -25,15 +25,15 @@
 import android.support.v4.view.ActionProvider;
 import android.support.v7.appcompat.R;
 import android.support.v7.internal.widget.ActivityChooserModel;
+import android.support.v7.internal.widget.ActivityChooserModel.OnChooseActivityListener;
 import android.support.v7.internal.widget.ActivityChooserView;
-import android.support.v7.internal.widget.TintManager;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.util.TypedValue;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.MenuItem.OnMenuItemClickListener;
 import android.view.SubMenu;
 import android.view.View;
-import android.support.v7.internal.widget.ActivityChooserModel.OnChooseActivityListener;
 
 /**
  * This is a provider for a share action. It is responsible for creating views
@@ -188,7 +188,8 @@
         // Lookup and set the expand action icon.
         TypedValue outTypedValue = new TypedValue();
         mContext.getTheme().resolveAttribute(R.attr.actionModeShareDrawable, outTypedValue, true);
-        Drawable drawable = TintManager.getDrawable(mContext, outTypedValue.resourceId);
+        Drawable drawable = AppCompatDrawableManager.get()
+                .getDrawable(mContext, outTypedValue.resourceId);
         activityChooserView.setExpandActivityOverflowButtonDrawable(drawable);
         activityChooserView.setProvider(this);
 
diff --git a/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java b/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
index 60dd4b0..4a99ed6 100644
--- a/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
+++ b/v7/appcompat/src/android/support/v7/widget/SwitchCompat.java
@@ -33,8 +33,8 @@
 import android.support.v4.view.ViewCompat;
 import android.support.v7.appcompat.R;
 import android.support.v7.internal.text.AllCapsTransformationMethod;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.DrawableUtils;
-import android.support.v7.internal.widget.TintManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.support.v7.internal.widget.ViewUtils;
 import android.text.Layout;
@@ -145,7 +145,7 @@
     @SuppressWarnings("hiding")
     private final Rect mTempRect = new Rect();
 
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
 
     private static final int[] CHECKED_STATE_SET = {
             android.R.attr.state_checked
@@ -216,7 +216,7 @@
             setSwitchTextAppearance(context, appearance);
         }
 
-        mTintManager = a.getTintManager();
+        mDrawableManager = AppCompatDrawableManager.get();
 
         a.recycle();
 
@@ -408,7 +408,7 @@
      * @param resId Resource ID of a track drawable
      */
     public void setTrackResource(int resId) {
-        setTrackDrawable(mTintManager.getDrawable(resId));
+        setTrackDrawable(mDrawableManager.getDrawable(getContext(), resId));
     }
 
     /**
@@ -438,7 +438,7 @@
      * @param resId Resource ID of a thumb drawable
      */
     public void setThumbResource(int resId) {
-        setThumbDrawable(mTintManager.getDrawable(resId));
+        setThumbDrawable(mDrawableManager.getDrawable(getContext(), resId));
     }
 
     /**
diff --git a/v7/appcompat/src/android/support/v7/widget/Toolbar.java b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
index 0e8e318..5e6221b 100644
--- a/v7/appcompat/src/android/support/v7/widget/Toolbar.java
+++ b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
@@ -17,9 +17,6 @@
 package android.support.v7.widget;
 
 import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.TypedArray;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.os.Build;
 import android.os.Parcel;
@@ -38,17 +35,15 @@
 import android.support.v4.view.ViewCompat;
 import android.support.v7.app.ActionBar;
 import android.support.v7.appcompat.R;
-import android.support.v7.graphics.drawable.DrawableUtils;
 import android.support.v7.internal.view.SupportMenuInflater;
 import android.support.v7.internal.view.menu.MenuBuilder;
 import android.support.v7.internal.view.menu.MenuItemImpl;
 import android.support.v7.internal.view.menu.MenuPresenter;
 import android.support.v7.internal.view.menu.MenuView;
 import android.support.v7.internal.view.menu.SubMenuBuilder;
+import android.support.v7.internal.widget.AppCompatDrawableManager;
 import android.support.v7.internal.widget.DecorToolbar;
 import android.support.v7.internal.widget.RtlSpacingHelper;
-import android.support.v7.internal.widget.TintInfo;
-import android.support.v7.internal.widget.TintManager;
 import android.support.v7.internal.widget.TintTypedArray;
 import android.support.v7.internal.widget.ToolbarWidgetWrapper;
 import android.support.v7.internal.widget.ViewUtils;
@@ -197,7 +192,7 @@
         }
     };
 
-    private final TintManager mTintManager;
+    private final AppCompatDrawableManager mDrawableManager;
 
     public Toolbar(Context context) {
         this(context, null);
@@ -306,8 +301,7 @@
         }
         a.recycle();
 
-        // Keep the TintManager in case we need it later
-        mTintManager = a.getTintManager();
+        mDrawableManager = AppCompatDrawableManager.get();
     }
 
     /**
@@ -354,7 +348,7 @@
      * @param resId ID of a drawable resource
      */
     public void setLogo(@DrawableRes int resId) {
-        setLogo(mTintManager.getDrawable(resId));
+        setLogo(mDrawableManager.getDrawable(getContext(), resId));
     }
 
     /** @hide */
@@ -781,7 +775,7 @@
      * @param resId Resource ID of a drawable to set
      */
     public void setNavigationIcon(@DrawableRes int resId) {
-        setNavigationIcon(mTintManager.getDrawable(resId));
+        setNavigationIcon(mDrawableManager.getDrawable(getContext(), resId));
     }
 
     /**