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
This commit is contained in:
@@ -53,6 +53,7 @@ import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -560,11 +561,17 @@ public class PipMenuActivity extends Activity {
|
||||
final RemoteAction action = mActions.get(i);
|
||||
final ImageButton actionView = (ImageButton) mActionsGroup.getChildAt(i);
|
||||
|
||||
// TODO: Check if the action drawable has changed before we reload it
|
||||
action.getIcon().loadDrawableAsync(this, d -> {
|
||||
d.setTint(Color.WHITE);
|
||||
actionView.setImageDrawable(d);
|
||||
}, mHandler);
|
||||
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(this, d -> {
|
||||
d.setTint(Color.WHITE);
|
||||
actionView.setImageDrawable(d);
|
||||
}, mHandler);
|
||||
}
|
||||
actionView.setContentDescription(action.getContentDescription());
|
||||
if (action.isEnabled()) {
|
||||
actionView.setOnClickListener(v -> {
|
||||
|
||||
Reference in New Issue
Block a user