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

Commit 5f5a87d8 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Disallow loading icon from content URI to PipMenu

Bug: 278246904
Test: manually, with the PoC app attached to the bug
Merged-In: Idbd4081bf464e2b3420d4c3fd22ca37867d26bc0
Merged-In: Ib3f5b8b6b9ce644fdf1173548d9078e4d969ae2e
Change-Id: Iecfc1fb962de611cbe3c51a44ba4fded53925a7d
parent 71e7d412
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -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,11 +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);


                    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(this, d -> {
                        action.getIcon().loadDrawableAsync(this, d -> {
                              d.setTint(Color.WHITE);
                              d.setTint(Color.WHITE);
                              actionView.setImageDrawable(d);
                              actionView.setImageDrawable(d);
                        }, mHandler);
                        }, mHandler);
                    }
                    actionView.setContentDescription(action.getContentDescription());
                    actionView.setContentDescription(action.getContentDescription());
                    if (action.isEnabled()) {
                    if (action.isEnabled()) {
                        actionView.setOnClickListener(v -> {
                        actionView.setOnClickListener(v -> {