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

Commit 5d31bd1c authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Disallow loading icon from content URI to PipMenu" into rvc-dev

parents 287bfd5a 5f5a87d8
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 -> {