Merge "Disallow loading icon from content URI to PipMenu" into sc-dev am: 1f2e080f1b am: 0fbf93b9f6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23423703 Change-Id: Ide4509e9405cc7a4099e34ca8e18b3bce4777a48 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -43,6 +43,7 @@ import android.content.Intent;
|
||||
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;
|
||||
@@ -488,13 +489,19 @@ public class PipMenuView extends FrameLayout {
|
||||
final PipMenuActionView actionView =
|
||||
(PipMenuActionView) mActionsGroup.getChildAt(i);
|
||||
|
||||
// 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.setContentDescription(action.getContentDescription());
|
||||
if (action.isEnabled()) {
|
||||
actionView.setOnClickListener(v -> {
|
||||
|
||||
Reference in New Issue
Block a user