Merge \"Allow system apps to have disabled QS tiles.\" into nyc-mr1-dev

am: 611093b1a1

Change-Id: Ie3f832621d982f45af7d0e4d1b786f429cef9f2c
This commit is contained in:
Will Harmon
2016-06-27 22:20:47 +00:00
committed by android-build-merger

View File

@@ -82,8 +82,11 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
private void setTileIcon() {
try {
PackageManager pm = mContext.getPackageManager();
ServiceInfo info = pm.getServiceInfo(mComponent,
PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE);
int flags = PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE;
if (isSystemApp(pm)) {
flags |= PackageManager.MATCH_DISABLED_COMPONENTS;
}
ServiceInfo info = pm.getServiceInfo(mComponent, flags);
int icon = info.icon != 0 ? info.icon
: info.applicationInfo.icon;
// Update the icon if its not set or is the default icon.
@@ -103,6 +106,10 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
}
}
private boolean isSystemApp(PackageManager pm) throws PackageManager.NameNotFoundException {
return pm.getApplicationInfo(mComponent.getPackageName(), 0).isSystemApp();
}
/**
* Compare two icons, only works for resources.
*/