summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Martinz <amartinz@shiftphones.com>2018-04-12 17:25:06 +0200
committerJoey <joey@lineageos.org>2018-05-21 14:42:22 +0200
commitc84b872c26e420f2d2d099146f5227c504fb24ec (patch)
treeed58d214bd19d6f986ce12d4f5ba2f7db9e75802 /src
parent0a000247c9041c1c786e9b2b89217c9abf6fa848 (diff)
downloadandroid_packages_apps_Trebuchet-c84b872c26e420f2d2d099146f5227c504fb24ec.tar.gz
android_packages_apps_Trebuchet-c84b872c26e420f2d2d099146f5227c504fb24ec.tar.bz2
android_packages_apps_Trebuchet-c84b872c26e420f2d2d099146f5227c504fb24ec.zip
Icons: wrap all legacy icons to adaptive icons
Previously only apps targetting API 26 (O) would get wrapped as adaptive icon, resulting in legacy icons still looking out of place. Wrap all icons, independent of target API. Change-Id: I3647d95c7f4f5c0515a14cbf4eebd5afcdfb38ae Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/IconCache.java7
-rw-r--r--src/com/android/launcher3/icons/CustomIconsProvider.java5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index cb58766bf..137265262 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -370,7 +370,7 @@ public class IconCache {
if (entry == null) {
entry = new CacheEntry();
entry.icon = LauncherIcons.createBadgedIconBitmap(getFullResIcon(app), app.getUser(),
- mContext, app.getApplicationInfo().targetSdkVersion);
+ mContext, Build.VERSION_CODES.O);
}
entry.title = app.getLabel();
entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser());
@@ -571,7 +571,7 @@ public class IconCache {
if (info != null) {
entry.icon = LauncherIcons.createBadgedIconBitmap(
getFullResIcon(info), info.getUser(), mContext,
- infoProvider.get().getApplicationInfo().targetSdkVersion);
+ Build.VERSION_CODES.O);
} else {
if (usePackageIcon) {
CacheEntry packageEntry = getEntryForPackageLocked(
@@ -677,7 +677,8 @@ public class IconCache {
// Load the full res icon for the application, but if useLowResIcon is set, then
// only keep the low resolution icon instead of the larger full-sized icon
Bitmap icon = LauncherIcons.createBadgedIconBitmap(
- appInfo.loadIcon(mPackageManager), user, mContext, appInfo.targetSdkVersion);
+ appInfo.loadIcon(mPackageManager), user, mContext,
+ Build.VERSION_CODES.O);
if (mInstantAppResolver.isInstantApp(appInfo)) {
icon = LauncherIcons.badgeWithDrawable(icon,
mContext.getDrawable(R.drawable.ic_instant_app_badge), mContext);
diff --git a/src/com/android/launcher3/icons/CustomIconsProvider.java b/src/com/android/launcher3/icons/CustomIconsProvider.java
index 1490fd9d7..98259b83d 100644
--- a/src/com/android/launcher3/icons/CustomIconsProvider.java
+++ b/src/com/android/launcher3/icons/CustomIconsProvider.java
@@ -38,6 +38,11 @@ public class CustomIconsProvider extends IconProvider {
@Override
public Drawable getIcon(LauncherActivityInfo info, int iconDpi, boolean flattenDrawable) {
+ // if we are not using any icon pack, load application icon directly
+ if (Utilities.ATLEAST_OREO && !Utilities.isUsingIconPack(mContext)) {
+ return mContext.getPackageManager().getApplicationIcon(info.getApplicationInfo());
+ }
+
final Bitmap bm = mHandler.getDrawableIconForPackage(info.getComponentName());
if (bm == null) {
return info.getIcon(iconDpi);