Skip to content

Commit

Permalink
Disallow loading icon from content URI to PipMenu
Browse files Browse the repository at this point in the history
Bug: 278246904
Test: manually, with the PoC app attached to the bug
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1aee65603e262affd815fa53dcc5416c605e4037)
Merged-In: Ib3f5b8b6b9ce644fdf1173548d9078e4d969ae2e
Change-Id: Ib3f5b8b6b9ce644fdf1173548d9078e4d969ae2e
  • Loading branch information
hwwang-google authored and thestinger committed Oct 3, 2023
1 parent 19747f6 commit e7a1aa9
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
Expand Down Expand Up @@ -513,13 +514,19 @@ private void updateActionViews(int menuState, Rect stackBounds) {
final boolean isCloseAction = mCloseAction != null && Objects.equals(
mCloseAction.getActionIntent(), action.getActionIntent());

// TODO: Check if the action drawable has changed before we reload it
action.getIcon().loadDrawableAsync(mContext, d -> {
if (d != null) {
d.setTint(Color.WHITE);
actionView.setImageDrawable(d);
}
}, mMainHandler);
final int iconType = action.getIcon().getType();
if (iconType == Icon.TYPE_URI || iconType == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
// Disallow loading icon from content URI
actionView.setImageDrawable(null);
} else {
// TODO: Check if the action drawable has changed before we reload it
action.getIcon().loadDrawableAsync(mContext, d -> {
if (d != null) {
d.setTint(Color.WHITE);
actionView.setImageDrawable(d);
}
}, mMainHandler);
}
actionView.setCustomCloseBackgroundVisibility(
isCloseAction ? View.VISIBLE : View.GONE);
actionView.setContentDescription(action.getContentDescription());
Expand Down

0 comments on commit e7a1aa9

Please sign in to comment.