Merge "QS: Fix default icon handling for services" into nyc-dev
This commit is contained in:
@@ -155,7 +155,7 @@ public class TileQueryHelper {
|
|||||||
addTile(spec, appLabel, state, false);
|
addTile(spec, appLabel, state, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (info.serviceInfo.icon == 0) {
|
if (info.serviceInfo.icon == 0 && info.serviceInfo.applicationInfo.icon == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Drawable icon = info.serviceInfo.loadIcon(pm);
|
Drawable icon = info.serviceInfo.loadIcon(pm);
|
||||||
|
|||||||
@@ -84,11 +84,13 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
|
|||||||
PackageManager pm = mContext.getPackageManager();
|
PackageManager pm = mContext.getPackageManager();
|
||||||
ServiceInfo info = pm.getServiceInfo(mComponent,
|
ServiceInfo info = pm.getServiceInfo(mComponent,
|
||||||
PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE);
|
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.
|
// Update the icon if its not set or is the default icon.
|
||||||
boolean updateIcon = mTile.getIcon() == null
|
boolean updateIcon = mTile.getIcon() == null
|
||||||
|| iconEquals(mTile.getIcon(), mDefaultIcon);
|
|| iconEquals(mTile.getIcon(), mDefaultIcon);
|
||||||
mDefaultIcon = info.icon != 0 ? android.graphics.drawable.Icon
|
mDefaultIcon = icon != 0 ? android.graphics.drawable.Icon
|
||||||
.createWithResource(mComponent.getPackageName(), info.icon) : null;
|
.createWithResource(mComponent.getPackageName(), icon) : null;
|
||||||
if (updateIcon) {
|
if (updateIcon) {
|
||||||
mTile.setIcon(mDefaultIcon);
|
mTile.setIcon(mDefaultIcon);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user