Merge "[Injection] Stop using the component icon as a fallback option" into sc-dev am: 361ab7e1e8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14672880 Change-Id: I0940a3297dcee4dc298ea03a295f78c809e03982
This commit is contained in:
@@ -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[]{
|
||||
|
||||
@@ -98,7 +98,7 @@ public class MetricsFeatureProvider {
|
||||
/**
|
||||
* Logs a simple action without page id or attribution
|
||||
*/
|
||||
public void action(Context context, int category, Pair<Integer, Object>... taggedData) {
|
||||
public void action(Context context, int category, Pair<Integer, Object>... taggedData) {
|
||||
for (LogWriter writer : mLoggerWriters) {
|
||||
writer.action(context, category, taggedData);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user