Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit bc240fff authored by Hongwei Wang's avatar Hongwei Wang Committed by Kevin F. Haggerty
Browse files

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:4bf71d74fc21cd9389dbe00fb750e2f9802eb789)
Merged-In: Idbd4081bf464e2b3420d4c3fd22ca37867d26bc0
Change-Id: Idbd4081bf464e2b3420d4c3fd22ca37867d26bc0
parent 5b1e387e
Loading
Loading
Loading
Loading
+14 −7
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@ import android.content.Intent;
import android.graphics.Color;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.Rect;
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;
@@ -488,6 +489,11 @@ public class PipMenuView extends FrameLayout {
                    final PipMenuActionView actionView =
                    final PipMenuActionView actionView =
                            (PipMenuActionView) mActionsGroup.getChildAt(i);
                            (PipMenuActionView) mActionsGroup.getChildAt(i);


                    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
                        // TODO: Check if the action drawable has changed before we reload it
                        action.getIcon().loadDrawableAsync(mContext, d -> {
                        action.getIcon().loadDrawableAsync(mContext, d -> {
                            if (d != null) {
                            if (d != null) {
@@ -495,6 +501,7 @@ public class PipMenuView extends FrameLayout {
                                actionView.setImageDrawable(d);
                                actionView.setImageDrawable(d);
                            }
                            }
                        }, mMainHandler);
                        }, mMainHandler);
                    }
                    actionView.setContentDescription(action.getContentDescription());
                    actionView.setContentDescription(action.getContentDescription());
                    if (action.isEnabled()) {
                    if (action.isEnabled()) {
                        actionView.setOnClickListener(v -> {
                        actionView.setOnClickListener(v -> {