diff options
| author | 2023-05-25 12:18:44 -0700 | |
|---|---|---|
| committer | 2023-05-30 16:41:08 +0000 | |
| commit | 6b230c82a190ed1c6acf129cd3a1bd573fdf19d0 (patch) | |
| tree | f6187cdccd6bd78f47ce609184144d19298179b5 | |
| parent | 250376b0d03bf124c5567e8492105308cfb722f5 (diff) | |
Disallow loading icon from content URI to PipMenu
Bug: 278246904
Test: manually, with the PoC app attached to the bug
Change-Id: Ib3f5b8b6b9ce644fdf1173548d9078e4d969ae2e
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java index 167c0321d3ad..779c539a2097 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java @@ -45,6 +45,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; @@ -513,13 +514,19 @@ public class PipMenuView extends FrameLayout { 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()); |