API council review feedback for ActionMenuView

Reverts "MenuItem, navigation and overflow icon tinting" CL,
and adds getter and setter for the overflow icon to ActionMenuView
and Toolbar.

BUG: 21571899

Change-Id: I591f43650356443fa3256e4d74e28b6ddd8c2b33
diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java
index dc8cadf..1c67ba7 100644
--- a/core/java/android/view/MenuInflater.java
+++ b/core/java/android/view/MenuInflater.java
@@ -25,11 +25,8 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.ContextWrapper;
-import android.content.res.ColorStateList;
 import android.content.res.TypedArray;
 import android.content.res.XmlResourceParser;
-import android.graphics.PorterDuff;
-import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.Xml;
@@ -337,11 +334,6 @@
         
         private ActionProvider itemActionProvider;
 
-        private ColorStateList itemIconTintList;
-        private boolean itemIconTintListSet;
-        private PorterDuff.Mode itemIconTintMode;
-        private boolean itemIconTintModeSet;
-
         private static final int defaultGroupId = NO_ID;
         private static final int defaultItemId = NO_ID;
         private static final int defaultItemCategory = 0;
@@ -432,23 +424,6 @@
                 itemActionProvider = null;
             }
 
-            if (a.hasValueOrEmpty(com.android.internal.R.styleable.MenuItem_iconTint)) {
-                itemIconTintList = a.getColorStateList(
-                        com.android.internal.R.styleable.MenuItem_iconTint);
-                itemIconTintListSet = true;
-            } else {
-                itemIconTintList = null;
-                itemIconTintListSet = false;
-            }
-            if (a.hasValueOrEmpty(com.android.internal.R.styleable.MenuItem_iconTintMode)) {
-                itemIconTintMode = Drawable.parseTintMode(
-                        a.getInt(com.android.internal.R.styleable.MenuItem_iconTintMode, -1), null);
-                itemIconTintModeSet = true;
-            } else {
-                itemIconTintMode = null;
-                itemIconTintModeSet = false;
-            }
-
             a.recycle();
 
             itemAdded = false;
@@ -511,13 +486,6 @@
             if (itemActionProvider != null) {
                 item.setActionProvider(itemActionProvider);
             }
-
-            if (itemIconTintListSet) {
-                item.setIconTintList(itemIconTintList);
-            }
-            if (itemIconTintModeSet) {
-                item.setIconTintMode(itemIconTintMode);
-            }
         }
 
         public MenuItem addItem() {
diff --git a/core/java/android/view/MenuItem.java b/core/java/android/view/MenuItem.java
index 2948007..9e8b97e 100644
--- a/core/java/android/view/MenuItem.java
+++ b/core/java/android/view/MenuItem.java
@@ -21,8 +21,6 @@
 import android.annotation.StringRes;
 import android.app.Activity;
 import android.content.Intent;
-import android.content.res.ColorStateList;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.view.ContextMenu.ContextMenuInfo;
 import android.view.View.OnCreateContextMenuListener;
@@ -601,26 +599,4 @@
      * @return This menu item instance for call chaining
      */
     public MenuItem setOnActionExpandListener(OnActionExpandListener listener);
-
-    /**
-     * Applies a tint to the icon drawable. Does not modify the current tint
-     * mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
-     * <p>
-     * Subsequent calls to {@link android.view.MenuItem#setIcon(android.graphics.drawable.Drawable)}
-     * will automatically mutate the drawable and apply the specified tint and tint mode.
-     *
-     * @param tint the tint to apply, may be {@code null} to clear tint
-     * @return This menu item instance for call chaining
-     */
-    public MenuItem setIconTintList(ColorStateList tint);
-
-    /**
-     * Specifies the blending mode used to apply the tint specified by {@link
-     * #setIconTintList(ColorStateList)} to the icon drawable. The default mode is {@link
-     * PorterDuff.Mode#SRC_IN}.
-     *
-     * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
-     * @return This menu item instance for call chaining
-     */
-    public MenuItem setIconTintMode(PorterDuff.Mode tintMode);
 }
diff --git a/core/java/android/widget/ActionMenuPresenter.java b/core/java/android/widget/ActionMenuPresenter.java
index f08141c..a5696ee 100644
--- a/core/java/android/widget/ActionMenuPresenter.java
+++ b/core/java/android/widget/ActionMenuPresenter.java
@@ -21,10 +21,8 @@
 import android.animation.ObjectAnimator;
 import android.animation.PropertyValuesHolder;
 import android.content.Context;
-import android.content.res.ColorStateList;
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -64,6 +62,8 @@
     private static final boolean ACTIONBAR_ANIMATIONS_ENABLED = false;
 
     private OverflowMenuButton mOverflowButton;
+    private Drawable mPendingOverflowIcon;
+    private boolean mPendingOverflowIconSet;
     private boolean mReserveOverflow;
     private boolean mReserveOverflowSet;
     private int mWidthLimit;
@@ -85,8 +85,6 @@
     private OpenOverflowRunnable mPostedOpenRunnable;
     private ActionMenuPopupCallback mPopupCallback;
 
-    private TintInfo mOverflowTintInfo;
-
     final PopupPresenterCallback mPopupPresenterCallback = new PopupPresenterCallback();
     int mOpenSubMenuId;
 
@@ -154,9 +152,13 @@
         if (mReserveOverflow) {
             if (mOverflowButton == null) {
                 mOverflowButton = new OverflowMenuButton(mSystemContext);
+                if (mPendingOverflowIconSet) {
+                    mOverflowButton.setImageDrawable(mPendingOverflowIcon);
+                    mPendingOverflowIcon = null;
+                    mPendingOverflowIconSet = false;
+                }
                 final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
                 mOverflowButton.measure(spec, spec);
-                applyOverflowTint();
             }
             width -= mOverflowButton.getMeasuredWidth();
         } else {
@@ -198,6 +200,24 @@
         mExpandedActionViewsExclusive = isExclusive;
     }
 
+    public void setOverflowIcon(Drawable icon) {
+        if (mOverflowButton != null) {
+            mOverflowButton.setImageDrawable(icon);
+        } else {
+            mPendingOverflowIconSet = true;
+            mPendingOverflowIcon = icon;
+        }
+    }
+
+    public Drawable getOverflowIcon() {
+        if (mOverflowButton != null) {
+            return mOverflowButton.getDrawable();
+        } else if (mPendingOverflowIconSet) {
+            return mPendingOverflowIcon;
+        }
+        return null;
+    }
+
     @Override
     public MenuView getMenuView(ViewGroup root) {
         MenuView oldMenuView = mMenuView;
@@ -449,7 +469,6 @@
         if (hasOverflow) {
             if (mOverflowButton == null) {
                 mOverflowButton = new OverflowMenuButton(mSystemContext);
-                applyOverflowTint();
             }
             ViewGroup parent = (ViewGroup) mOverflowButton.getParent();
             if (parent != mMenuView) {
@@ -764,40 +783,6 @@
         }
     }
 
-    public void setOverflowTintList(ColorStateList tint) {
-        if (mOverflowTintInfo == null) {
-            mOverflowTintInfo = new TintInfo();
-        }
-        mOverflowTintInfo.mTintList = tint;
-        mOverflowTintInfo.mHasTintList = true;
-
-        applyOverflowTint();
-    }
-
-    public void setOverflowTintMode(PorterDuff.Mode tintMode) {
-        if (mOverflowTintInfo == null) {
-            mOverflowTintInfo = new TintInfo();
-        }
-        mOverflowTintInfo.mTintMode = tintMode;
-        mOverflowTintInfo.mHasTintMode = true;
-
-        applyOverflowTint();
-    }
-
-    private void applyOverflowTint() {
-        final TintInfo tintInfo = mOverflowTintInfo;
-        if (tintInfo != null && (tintInfo.mHasTintList || tintInfo.mHasTintMode)) {
-            if (mOverflowButton != null) {
-                if (tintInfo.mHasTintList) {
-                    mOverflowButton.setImageTintList(tintInfo.mTintList);
-                }
-                if (tintInfo.mHasTintMode) {
-                    mOverflowButton.setImageTintMode(tintInfo.mTintMode);
-                }
-            }
-        }
-    }
-
     private static class SavedState implements Parcelable {
         public int openSubMenuId;
 
@@ -1023,13 +1008,6 @@
         }
     }
 
-    private static class TintInfo {
-        ColorStateList mTintList;
-        PorterDuff.Mode mTintMode;
-        boolean mHasTintMode;
-        boolean mHasTintList;
-    }
-
     /**
      * This class holds layout information for a menu item. This is used to determine
      * pre- and post-layout information about menu items, which will then be used to
@@ -1077,5 +1055,4 @@
             this.animType = animType;
         }
     }
-
 }
diff --git a/core/java/android/widget/ActionMenuView.java b/core/java/android/widget/ActionMenuView.java
index 278a8fb..1f02c3b 100644
--- a/core/java/android/widget/ActionMenuView.java
+++ b/core/java/android/widget/ActionMenuView.java
@@ -16,11 +16,11 @@
 package android.widget;
 
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.annotation.StyleRes;
 import android.content.Context;
-import android.content.res.ColorStateList;
 import android.content.res.Configuration;
-import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.ContextThemeWrapper;
 import android.view.Gravity;
@@ -541,6 +541,27 @@
         dismissPopupMenus();
     }
 
+    /**
+     * Set the icon to use for the overflow button.
+     *
+     * @param icon Drawable to set, may be null to clear the icon
+     */
+    public void setOverflowIcon(@Nullable Drawable icon) {
+        getMenu();
+        mPresenter.setOverflowIcon(icon);
+    }
+
+    /**
+     * Return the current drawable used as the overflow icon.
+     *
+     * @return The overflow icon drawable
+     */
+    @Nullable
+    public Drawable getOverflowIcon() {
+        getMenu();
+        return mPresenter.getOverflowIcon();
+    }
+
     /** @hide */
     public boolean isOverflowReserved() {
         return mReserveOverflow;
@@ -551,31 +572,6 @@
         mReserveOverflow = reserveOverflow;
     }
 
-    /**
-     * Applies a tint to the overflow drawable. Does not modify the current tint
-     * mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
-     *
-     * @param tint the tint to apply, may be {@code null} to clear tint
-     */
-    public void setOverflowTintList(ColorStateList tint) {
-        if (mPresenter != null) {
-            mPresenter.setOverflowTintList(tint);
-        }
-    }
-
-    /**
-     * Specifies the blending mode used to apply the tint specified by {@link
-     * #setOverflowTintList(ColorStateList)} to the overflow drawable.
-     * The default mode is {@link PorterDuff.Mode#SRC_IN}.
-     *
-     * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
-     */
-    public void setOverflowTintMode(PorterDuff.Mode tintMode) {
-        if (mPresenter != null) {
-            mPresenter.setOverflowTintMode(tintMode);
-        }
-    }
-
     @Override
     protected LayoutParams generateDefaultLayoutParams() {
         LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,
diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java
index 62d948d..8ace0f3 100644
--- a/core/java/android/widget/Toolbar.java
+++ b/core/java/android/widget/Toolbar.java
@@ -25,9 +25,8 @@
 import android.annotation.StyleRes;
 import android.app.ActionBar;
 import android.content.Context;
-import android.content.res.ColorStateList;
 import android.content.res.TypedArray;
-import android.graphics.PorterDuff;
+import android.graphics.RectF;
 import android.graphics.drawable.Drawable;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -110,9 +109,6 @@
     private ImageButton mNavButtonView;
     private ImageView mLogoView;
 
-    private TintInfo mOverflowTintInfo;
-    private TintInfo mNavTintInfo;
-
     private Drawable mCollapseIcon;
     private CharSequence mCollapseDescription;
     private ImageButton mCollapseButtonView;
@@ -275,21 +271,6 @@
         if (!TextUtils.isEmpty(navDesc)) {
             setNavigationContentDescription(navDesc);
         }
-
-        if (a.hasValue(R.styleable.Toolbar_overflowTint)) {
-            setOverflowTintList(a.getColorStateList(R.styleable.Toolbar_overflowTint));
-        }
-        if (a.hasValue(R.styleable.Toolbar_overflowTintMode)) {
-            setOverflowTintMode(Drawable.parseTintMode(
-                    a.getInt(R.styleable.Toolbar_overflowTintMode, -1), null));
-        }
-        if (a.hasValue(R.styleable.Toolbar_navigationTint)) {
-            setNavigationTintList(a.getColorStateList(R.styleable.Toolbar_navigationTint));
-        }
-        if (a.hasValue(R.styleable.Toolbar_navigationTintMode)) {
-            setNavigationTintMode(Drawable.parseTintMode(
-                    a.getInt(R.styleable.Toolbar_navigationTintMode, -1), null));
-        }
         a.recycle();
     }
 
@@ -830,91 +811,6 @@
     }
 
     /**
-     * Applies a tint to the icon drawable. Does not modify the current tint
-     * mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
-     * <p>
-     * Subsequent calls to {@link #setNavigationIcon(Drawable)} will automatically mutate
-     * the drawable and apply the specified tint and tint mode.
-     *
-     * @param tint the tint to apply, may be {@code null} to clear tint
-     *
-     * @attr ref android.R.styleable#Toolbar_navigationTint
-     */
-    public void setNavigationTintList(ColorStateList tint) {
-        if (mNavTintInfo == null) {
-            mNavTintInfo = new TintInfo();
-        }
-        mNavTintInfo.mTintList = tint;
-        mNavTintInfo.mHasTintList = true;
-
-        applyNavigationTint();
-    }
-
-    /**
-     * Specifies the blending mode used to apply the tint specified by {@link
-     * #setNavigationTintList(ColorStateList)} to the navigation drawable.
-     * The default mode is {@link PorterDuff.Mode#SRC_IN}.
-     *
-     * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
-     *
-     * @attr ref android.R.styleable#Toolbar_navigationTintMode
-     */
-    public void setNavigationTintMode(PorterDuff.Mode tintMode) {
-        if (mNavTintInfo == null) {
-            mNavTintInfo = new TintInfo();
-        }
-        mNavTintInfo.mTintMode = tintMode;
-        mNavTintInfo.mHasTintMode = true;
-
-        applyNavigationTint();
-    }
-
-    /**
-     * Applies a tint to the overflow drawable. Does not modify the current tint
-     * mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
-     *
-     * @param tint the tint to apply, may be {@code null} to clear tint
-     *
-     * @attr ref android.R.styleable#Toolbar_overflowTint
-     */
-    public void setOverflowTintList(ColorStateList tint) {
-        if (mMenuView != null) {
-            // If the menu view is available, directly set the tint
-            mMenuView.setOverflowTintList(tint);
-        } else {
-            // Otherwise we will record the value
-            if (mOverflowTintInfo == null) {
-                mOverflowTintInfo = new TintInfo();
-            }
-            mOverflowTintInfo.mTintList = tint;
-            mOverflowTintInfo.mHasTintList = true;
-        }
-    }
-
-    /**
-     * Specifies the blending mode used to apply the tint specified by {@link
-     * #setOverflowTintList(ColorStateList)} to the overflow drawable.
-     * The default mode is {@link PorterDuff.Mode#SRC_IN}.
-     *
-     * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint
-     *
-     * @attr ref android.R.styleable#Toolbar_overflowTintMode
-     */
-    public void setOverflowTintMode(PorterDuff.Mode tintMode) {
-        if (mMenuView != null) {
-            // If the menu view is available, directly set the tint mode
-            mMenuView.setOverflowTintMode(tintMode);
-        } else {
-            // Otherwise we will record the value
-            if (mOverflowTintInfo == null) {
-                mOverflowTintInfo = new TintInfo();
-            }
-            mOverflowTintInfo.mTintMode = tintMode;
-            mOverflowTintInfo.mHasTintMode = true;
-        }
-    }
-
-    /**
      * Return the Menu shown in the toolbar.
      *
      * <p>Applications that wish to populate the toolbar's menu can do so from here. To use
@@ -927,6 +823,27 @@
         return mMenuView.getMenu();
     }
 
+    /**
+     * Set the icon to use for the overflow button.
+     *
+     * @param icon Drawable to set, may be null to clear the icon
+     */
+    public void setOverflowIcon(@Nullable Drawable icon) {
+        ensureMenu();
+        mMenuView.setOverflowIcon(icon);
+    }
+
+    /**
+     * Return the current drawable used as the overflow icon.
+     *
+     * @return The overflow icon drawable
+     */
+    @Nullable
+    public Drawable getOverflowIcon() {
+        ensureMenu();
+        return mMenuView.getOverflowIcon();
+    }
+
     private void ensureMenu() {
         ensureMenuView();
         if (mMenuView.peekMenu() == null) {
@@ -950,17 +867,6 @@
             lp.gravity = Gravity.END | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK);
             mMenuView.setLayoutParams(lp);
             addSystemView(mMenuView);
-
-            if (mOverflowTintInfo != null) {
-                // If we have tint info for the overflow, set it on the menu view now
-                if (mOverflowTintInfo.mHasTintList) {
-                    mMenuView.setOverflowTintList(mOverflowTintInfo.mTintList);
-                }
-                if (mOverflowTintInfo.mHasTintMode) {
-                    mMenuView.setOverflowTintMode(mOverflowTintInfo.mTintMode);
-                }
-                mOverflowTintInfo = null;
-            }
         }
     }
 
@@ -1114,7 +1020,6 @@
             final LayoutParams lp = generateDefaultLayoutParams();
             lp.gravity = Gravity.START | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK);
             mNavButtonView.setLayoutParams(lp);
-            applyNavigationTint();
         }
     }
 
@@ -1133,7 +1038,6 @@
                     collapseActionView();
                 }
             });
-            applyNavigationTint();
         }
     }
 
@@ -1885,30 +1789,6 @@
         return mPopupContext;
     }
 
-    private void applyNavigationTint() {
-        final TintInfo tintInfo = mNavTintInfo;
-        if (tintInfo != null && (tintInfo.mHasTintList || tintInfo.mHasTintMode)) {
-            if (mNavButtonView != null) {
-                if (tintInfo.mHasTintList) {
-                    mNavButtonView.setImageTintList(tintInfo.mTintList);
-                }
-                if (tintInfo.mHasTintMode) {
-                    mNavButtonView.setImageTintMode(tintInfo.mTintMode);
-                }
-            }
-
-            if (mCollapseButtonView != null) {
-                // We will use the same tint for the collapse button
-                if (tintInfo.mHasTintList) {
-                    mCollapseButtonView.setImageTintList(tintInfo.mTintList);
-                }
-                if (tintInfo.mHasTintMode) {
-                    mCollapseButtonView.setImageTintMode(tintInfo.mTintMode);
-                }
-            }
-        }
-    }
-
     /**
      * Interface responsible for receiving menu item click events if the items themselves
      * do not have individual item click listeners.
@@ -2136,11 +2016,4 @@
         public void onRestoreInstanceState(Parcelable state) {
         }
     }
-
-    private static class TintInfo {
-        ColorStateList mTintList;
-        PorterDuff.Mode mTintMode;
-        boolean mHasTintMode;
-        boolean mHasTintList;
-    }
 }
diff --git a/core/java/com/android/internal/view/menu/ActionMenuItem.java b/core/java/com/android/internal/view/menu/ActionMenuItem.java
index 00af401..ed676bb 100644
--- a/core/java/com/android/internal/view/menu/ActionMenuItem.java
+++ b/core/java/com/android/internal/view/menu/ActionMenuItem.java
@@ -18,8 +18,6 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.ColorStateList;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.view.ActionProvider;
 import android.view.ContextMenu.ContextMenuInfo;
@@ -44,7 +42,6 @@
     
     private Drawable mIconDrawable;
     private int mIconResId = NO_ICON;
-    private TintInfo mIconTintInfo;
     
     private Context mContext;
     
@@ -161,14 +158,12 @@
     public MenuItem setIcon(Drawable icon) {
         mIconDrawable = icon;
         mIconResId = NO_ICON;
-        applyIconTint();
         return this;
     }
 
     public MenuItem setIcon(int iconRes) {
         mIconResId = iconRes;
         mIconDrawable = mContext.getDrawable(iconRes);
-        applyIconTint();
         return this;
     }
 
@@ -279,48 +274,4 @@
         // No need to save the listener; ActionMenuItem does not support collapsing items.
         return this;
     }
-
-    @Override
-    public MenuItem setIconTintList(ColorStateList tintList) {
-        if (mIconTintInfo == null) {
-            mIconTintInfo = new TintInfo();
-        }
-        mIconTintInfo.mTintList = tintList;
-        mIconTintInfo.mHasTintList = true;
-        applyIconTint();
-        return this;
-    }
-
-    @Override
-    public MenuItem setIconTintMode(PorterDuff.Mode tintMode) {
-        if (mIconTintInfo == null) {
-            mIconTintInfo = new TintInfo();
-        }
-        mIconTintInfo.mTintMode = tintMode;
-        mIconTintInfo.mHasTintMode = true;
-        applyIconTint();
-        return this;
-    }
-
-    private void applyIconTint() {
-        final TintInfo tintInfo = mIconTintInfo;
-        if (mIconDrawable != null && tintInfo != null) {
-            if (tintInfo.mHasTintList || tintInfo.mHasTintMode) {
-                mIconDrawable = mIconDrawable.mutate();
-                if (tintInfo.mHasTintList) {
-                    mIconDrawable.setTintList(tintInfo.mTintList);
-                }
-                if (tintInfo.mHasTintMode) {
-                    mIconDrawable.setTintMode(tintInfo.mTintMode);
-                }
-            }
-        }
-    }
-
-    private static class TintInfo {
-        ColorStateList mTintList;
-        PorterDuff.Mode mTintMode;
-        boolean mHasTintMode;
-        boolean mHasTintList;
-    }
 }
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index ef4e546..3b1f20d 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -21,8 +21,6 @@
 import android.content.ActivityNotFoundException;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.ColorStateList;
-import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.util.Log;
 import android.view.ActionProvider;
@@ -62,11 +60,6 @@
      * needed).
      */ 
     private int mIconResId = NO_ICON;
-
-    /**
-     * Tint info for the icon
-     */
-    private TintInfo mIconTintInfo;
     
     /** The menu to which this item belongs */
     private MenuBuilder mMenu;
@@ -392,10 +385,10 @@
         }
 
         if (mIconResId != NO_ICON) {
-            mIconDrawable = mMenu.getContext().getDrawable(mIconResId);
+            Drawable icon =  mMenu.getContext().getDrawable(mIconResId);
             mIconResId = NO_ICON;
-            applyIconTint();
-            return mIconDrawable;
+            mIconDrawable = icon;
+            return icon;
         }
         
         return null;
@@ -404,7 +397,6 @@
     public MenuItem setIcon(Drawable icon) {
         mIconResId = NO_ICON;
         mIconDrawable = icon;
-        applyIconTint();
         mMenu.onItemsChanged(false);
         
         return this;
@@ -678,48 +670,4 @@
     public boolean isActionViewExpanded() {
         return mIsActionViewExpanded;
     }
-
-    @Override
-    public MenuItem setIconTintList(ColorStateList tintList) {
-        if (mIconTintInfo == null) {
-            mIconTintInfo = new TintInfo();
-        }
-        mIconTintInfo.mTintList = tintList;
-        mIconTintInfo.mHasTintList = true;
-        applyIconTint();
-        return this;
-    }
-
-    @Override
-    public MenuItem setIconTintMode(PorterDuff.Mode tintMode) {
-        if (mIconTintInfo == null) {
-            mIconTintInfo = new TintInfo();
-        }
-        mIconTintInfo.mTintMode = tintMode;
-        mIconTintInfo.mHasTintMode = true;
-        applyIconTint();
-        return this;
-    }
-
-    private void applyIconTint() {
-        final TintInfo tintInfo = mIconTintInfo;
-        if (mIconDrawable != null && tintInfo != null) {
-            if (tintInfo.mHasTintList || tintInfo.mHasTintMode) {
-                mIconDrawable = mIconDrawable.mutate();
-                if (tintInfo.mHasTintList) {
-                    mIconDrawable.setTintList(tintInfo.mTintList);
-                }
-                if (tintInfo.mHasTintMode) {
-                    mIconDrawable.setTintMode(tintInfo.mTintMode);
-                }
-            }
-        }
-    }
-
-    private static class TintInfo {
-        ColorStateList mTintList;
-        PorterDuff.Mode mTintMode;
-        boolean mHasTintMode;
-        boolean mHasTintList;
-    }
 }
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a13f494..3f64e45 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -6646,33 +6646,6 @@
              for more info. -->
         <attr name="actionProviderClass" format="string" />
 
-        <!-- An optional tint for the item's icon.
-             See {@link android.view.MenuItem#setIconTintList(android.content.res.ColorStateList)}
-             for more info. -->
-        <attr name="iconTint" format="color" />
-
-        <!-- The blending mode used for tinting the item's icon
-             See {@link android.view.MenuItem#setIconTintMode(android.graphics.PorterDuff.Mode)}
-             for more info. -->
-        <attr name="iconTintMode">
-            <!-- The tint is drawn on top of the drawable.
-                 [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] -->
-            <enum name="src_over" value="3" />
-            <!-- The tint is masked by the alpha channel of the drawable. The drawable’s
-                 color channels are thrown out. [Sa * Da, Sc * Da] -->
-            <enum name="src_in" value="5" />
-            <!-- The tint is drawn above the drawable, but with the drawable’s alpha
-                 channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] -->
-            <enum name="src_atop" value="9" />
-            <!-- Multiplies the color and alpha channels of the drawable with those of
-                 the tint. [Sa * Da, Sc * Dc] -->
-            <enum name="multiply" value="14" />
-            <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] -->
-            <enum name="screen" value="15" />
-            <!-- Combines the tint and drawable color and alpha channels, clamping the
-                 result to valid color values. Saturate(S + D) -->
-            <enum name="add" value="16" />
-        </attr>
     </declare-styleable>
 
     <!-- Attrbitutes for a ActvityChooserView. -->
@@ -7786,52 +7759,6 @@
         <!-- Text to set as the content description for the navigation button
              located at the start of the toolbar. -->
         <attr name="navigationContentDescription" format="string" />
-
-        <!-- Tint used for the navigation button -->
-        <attr name="navigationTint" format="color" />
-        <!-- The blending mode used for tinting the navigation button -->
-        <attr name="navigationTintMode">
-            <!-- The tint is drawn on top of the drawable.
-                 [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] -->
-            <enum name="src_over" value="3" />
-            <!-- The tint is masked by the alpha channel of the drawable. The drawable’s
-                 color channels are thrown out. [Sa * Da, Sc * Da] -->
-            <enum name="src_in" value="5" />
-            <!-- The tint is drawn above the drawable, but with the drawable’s alpha
-                 channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] -->
-            <enum name="src_atop" value="9" />
-            <!-- Multiplies the color and alpha channels of the drawable with those of
-                 the tint. [Sa * Da, Sc * Dc] -->
-            <enum name="multiply" value="14" />
-            <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] -->
-            <enum name="screen" value="15" />
-            <!-- Combines the tint and drawable color and alpha channels, clamping the
-                 result to valid color values. Saturate(S + D). Only works on APIv 11+ -->
-            <enum name="add" value="16" />
-        </attr>
-
-        <!-- Tint used for the overflow button -->
-        <attr name="overflowTint" format="color" />
-        <!-- The blending mode used for tinting the overflow button -->
-        <attr name="overflowTintMode">
-            <!-- The tint is drawn on top of the drawable.
-                 [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] -->
-            <enum name="src_over" value="3" />
-            <!-- The tint is masked by the alpha channel of the drawable. The drawable’s
-                 color channels are thrown out. [Sa * Da, Sc * Da] -->
-            <enum name="src_in" value="5" />
-            <!-- The tint is drawn above the drawable, but with the drawable’s alpha
-                 channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] -->
-            <enum name="src_atop" value="9" />
-            <!-- Multiplies the color and alpha channels of the drawable with those of
-                 the tint. [Sa * Da, Sc * Dc] -->
-            <enum name="multiply" value="14" />
-            <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] -->
-            <enum name="screen" value="15" />
-            <!-- Combines the tint and drawable color and alpha channels, clamping the
-                 result to valid color values. Saturate(S + D). Only works on APIv 11+ -->
-            <enum name="add" value="16" />
-        </attr>
     </declare-styleable>
 
     <declare-styleable name="Toolbar_LayoutParams">
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index bbf4005..84b2ead 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2614,12 +2614,20 @@
   <public type="attr" name="end" />
   <public type="attr" name="windowLightStatusBar" />
   <public type="attr" name="numbersInnerTextColor" />
-  <public type="attr" name="iconTint" />
-  <public type="attr" name="iconTintMode" />
-  <public type="attr" name="overflowTint" />
-  <public type="attr" name="overflowTintMode" />
-  <public type="attr" name="navigationTint" />
-  <public type="attr" name="navigationTintMode" />
+
+  <attr name="__reserved2" format="boolean" />
+  <public type="attr" name="__reserved2" />
+  <attr name="__reserved3" format="boolean" />
+  <public type="attr" name="__reserved3" />
+  <attr name="__reserved4" format="boolean" />
+  <public type="attr" name="__reserved4" />
+  <attr name="__reserved5" format="boolean" />
+  <public type="attr" name="__reserved5" />
+  <attr name="__reserved6" format="boolean" />
+  <public type="attr" name="__reserved6" />
+  <attr name="__reserved7" format="boolean" />
+  <public type="attr" name="__reserved7" />
+
   <public type="attr" name="fullBackupContent" />
 
   <public type="style" name="Widget.Material.Button.Colored" />