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

Commit 4ff9cd0f authored by Jason Chiu's avatar Jason Chiu Committed by Automerger Merge Worker
Browse files

Merge "[Injection] Stop using the component icon as a fallback option" into...

Merge "[Injection] Stop using the component icon as a fallback option" into sc-dev am: 361ab7e1 am: b0b56e6e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14672880

Change-Id: I5ce61f386926ea6281d99053b1f1a6a05607e249
parents 0c142e52 b0b56e6e
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.settingslib.drawer;
import static com.android.settingslib.drawer.TileUtils.META_DATA_KEY_ORDER;
import static com.android.settingslib.drawer.TileUtils.META_DATA_KEY_PROFILE;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_ICON;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_ICON_URI;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_KEYHINT;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY_URI;
@@ -301,16 +300,8 @@ public abstract class Tile implements Parcelable {
        }

        int iconResId = mMetaData.getInt(META_DATA_PREFERENCE_ICON);
        // Set the icon
        if (iconResId == 0) {
            // Only fallback to componentInfo.icon if metadata does not contain ICON_URI.
            // ICON_URI should be loaded in app UI when need the icon object. Handling IPC at this
            // level is too complex because we don't have a strong threading contract for this class
            if (!mMetaData.containsKey(META_DATA_PREFERENCE_ICON_URI)) {
                iconResId = getComponentIcon(componentInfo);
            }
        }
        if (iconResId != 0) {
        // Set the icon. Skip the transparent color for backward compatibility since Android S.
        if (iconResId != 0 && iconResId != android.R.color.transparent) {
            final Icon icon = Icon.createWithResource(componentInfo.packageName, iconResId);
            if (isIconTintable(context)) {
                final TypedArray a = context.obtainStyledAttributes(new int[]{
+3 −4
Original line number Diff line number Diff line
@@ -105,11 +105,10 @@ public class ActivityTileTest {
    }

    @Test
    public void getIcon_noIconMetadata_returnActivityIcon() {
        mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON, 0);
    public void getIcon_transparentColorInMetadata_returnNull() {
        mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON, android.R.color.transparent);

        assertThat(mTile.getIcon(RuntimeEnvironment.application).getResId())
                .isEqualTo(mActivityInfo.icon);
        assertThat(mTile.getIcon(RuntimeEnvironment.application)).isNull();
    }

    @Test