Merge "QS: Fix default icon handling for services" into nyc-dev

This commit is contained in:
Jason Monk
2016-06-22 15:39:29 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 3 deletions

View File

@@ -155,7 +155,7 @@ public class TileQueryHelper {
addTile(spec, appLabel, state, false);
continue;
}
if (info.serviceInfo.icon == 0) {
if (info.serviceInfo.icon == 0 && info.serviceInfo.applicationInfo.icon == 0) {
continue;
}
Drawable icon = info.serviceInfo.loadIcon(pm);

View File

@@ -84,11 +84,13 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
PackageManager pm = mContext.getPackageManager();
ServiceInfo info = pm.getServiceInfo(mComponent,
PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE);
int icon = info.icon != 0 ? info.icon
: info.applicationInfo.icon;
// Update the icon if its not set or is the default icon.
boolean updateIcon = mTile.getIcon() == null
|| iconEquals(mTile.getIcon(), mDefaultIcon);
mDefaultIcon = info.icon != 0 ? android.graphics.drawable.Icon
.createWithResource(mComponent.getPackageName(), info.icon) : null;
mDefaultIcon = icon != 0 ? android.graphics.drawable.Icon
.createWithResource(mComponent.getPackageName(), icon) : null;
if (updateIcon) {
mTile.setIcon(mDefaultIcon);
}