[DO NOT MERGE][conflict] Merge "Disallow loading icon from content URI to PipMenu" into rvc-dev am: 5d31bd1c3b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23424576

Bug: 293475290
Change-Id: Ic50edc109c89378aacc926b5b56aa142f9a01bbb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2023-07-27 18:22:51 +00:00

View File

@@ -53,6 +53,7 @@ import android.graphics.Color;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -560,13 +561,17 @@ public class PipMenuActivity extends Activity {
final RemoteAction action = mActions.get(i); final RemoteAction action = mActions.get(i);
final ImageButton actionView = (ImageButton) mActionsGroup.getChildAt(i); final ImageButton actionView = (ImageButton) mActionsGroup.getChildAt(i);
// TODO: Check if the action drawable has changed before we reload it final int iconType = action.getIcon().getType();
action.getIcon().loadDrawableAsync(this, d -> { if (iconType == Icon.TYPE_URI || iconType == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
if (d != null) { // Disallow loading icon from content URI
d.setTint(Color.WHITE); actionView.setImageDrawable(null);
actionView.setImageDrawable(d); } else {
} // TODO: Check if the action drawable has changed before we reload it
}, mHandler); action.getIcon().loadDrawableAsync(this, d -> {
d.setTint(Color.WHITE);
actionView.setImageDrawable(d);
}, mHandler);
}
actionView.setContentDescription(action.getContentDescription()); actionView.setContentDescription(action.getContentDescription());
if (action.isEnabled()) { if (action.isEnabled()) {
actionView.setOnClickListener(v -> { actionView.setOnClickListener(v -> {