Skip to content

Commit f4a8752

Browse files
hwwang-googleAndroid Build Coastguard Worker
authored andcommitted
Disallow loading icon from content URI to PipMenu
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
1 parent 791225d commit f4a8752

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import android.graphics.Color;
4646
import android.graphics.Rect;
4747
import android.graphics.drawable.Drawable;
48+
import android.graphics.drawable.Icon;
4849
import android.net.Uri;
4950
import android.os.Bundle;
5051
import android.os.Handler;
@@ -513,13 +514,19 @@ private void updateActionViews(int menuState, Rect stackBounds) {
513514
final boolean isCloseAction = mCloseAction != null && Objects.equals(
514515
mCloseAction.getActionIntent(), action.getActionIntent());
515516

516-
// TODO: Check if the action drawable has changed before we reload it
517-
action.getIcon().loadDrawableAsync(mContext, d -> {
518-
if (d != null) {
519-
d.setTint(Color.WHITE);
520-
actionView.setImageDrawable(d);
521-
}
522-
}, mMainHandler);
517+
final int iconType = action.getIcon().getType();
518+
if (iconType == Icon.TYPE_URI || iconType == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
519+
// Disallow loading icon from content URI
520+
actionView.setImageDrawable(null);
521+
} else {
522+
// TODO: Check if the action drawable has changed before we reload it
523+
action.getIcon().loadDrawableAsync(mContext, d -> {
524+
if (d != null) {
525+
d.setTint(Color.WHITE);
526+
actionView.setImageDrawable(d);
527+
}
528+
}, mMainHandler);
529+
}
523530
actionView.setCustomCloseBackgroundVisibility(
524531
isCloseAction ? View.VISIBLE : View.GONE);
525532
actionView.setContentDescription(action.getContentDescription());

0 commit comments

Comments
 (0)