summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHai Zhang <zhanghai@google.com>2019-05-20 11:22:46 -0700
committerHyunyoung Song <hyunyoungs@google.com>2019-11-22 23:40:04 +0000
commitf58ba9ca79802f14d402fdef22f6319437e42e3b (patch)
tree01b662f4a5ee7072c73f270a2fa29ec72a604827
parenta3ea27de3941f2802361aff1d46547122f096c7d (diff)
downloadandroid_packages_apps_Trebuchet-f58ba9ca79802f14d402fdef22f6319437e42e3b.tar.gz
android_packages_apps_Trebuchet-f58ba9ca79802f14d402fdef22f6319437e42e3b.tar.bz2
android_packages_apps_Trebuchet-f58ba9ca79802f14d402fdef22f6319437e42e3b.zip
Align badging logic with platform IconDrawableFactory.
The current logic in BaseIconFactory is only trying to add the user badge if the user passed in isn't null and isn't the current user, then if no such attempt is made, try to add an instant app badge. This is causing user badge to disappear if the current user is a work profile. Meanwhile, the badging logic in IconDrawableFactory is to try to add the instant app badge first, and then always try to add the user badge. Bug: 132625654 Test: manually test as in b/128625591 Change-Id: Ia5b456f1f27095d546504266a1a90034105c9ae9 Merged-In: I2241bdb524ca6bc66e545a0ec8433119e0448358 (cherry picked from commit bdb0236125922a3a9b20fbaa8ecd1d2477b48ed5)
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
index f491ed73f..5c4f37ca9 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
@@ -171,22 +171,19 @@ public class BaseIconFactory implements AutoCloseable {
mCanvas.setBitmap(null);
}
- final Bitmap result;
- if (user != null && !Process.myUserHandle().equals(user)) {
+ if (isInstantApp) {
+ badgeWithDrawable(bitmap, mContext.getDrawable(R.drawable.ic_instant_app_badge));
+ }
+ if (user != null) {
BitmapDrawable drawable = new FixedSizeBitmapDrawable(bitmap);
Drawable badged = mPm.getUserBadgedIcon(drawable, user);
if (badged instanceof BitmapDrawable) {
- result = ((BitmapDrawable) badged).getBitmap();
+ bitmap = ((BitmapDrawable) badged).getBitmap();
} else {
- result = createIconBitmap(badged, 1f);
+ bitmap = createIconBitmap(badged, 1f);
}
- } else if (isInstantApp) {
- badgeWithDrawable(bitmap, mContext.getDrawable(R.drawable.ic_instant_app_badge));
- result = bitmap;
- } else {
- result = bitmap;
}
- return BitmapInfo.fromBitmap(result, mDisableColorExtractor ? null : mColorExtractor);
+ return BitmapInfo.fromBitmap(bitmap, mDisableColorExtractor ? null : mColorExtractor);
}
public Bitmap createScaledBitmapWithoutShadow(Drawable icon, boolean shrinkNonAdaptiveIcons) {