From 4311ec42bfaa40993cd1112026f7b0f4a23bd0e8 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Wed, 5 Jan 2022 15:45:26 -0800 Subject: [PATCH] Include app badge without markings in bubble data Sometimes we need to show the app badge without any markings for priority conversations. For example in case of the manage menu. As we include the priority ring in the app badge icon itself, add another app badge icon to bubble data that does not include the priority ring - raw app badge. Change-Id: Ib472519d9bec5cdd09d7559e4dad2ee5e5f71b50 Test: verified that priority conversation bubble has ring around app badge and no ring in manage menu Bug: 189173831 Change-Id: I276e110ece40bf394f58da9acc3d0ecd09cf5afc --- .../Shell/src/com/android/wm/shell/bubbles/Bubble.java | 8 ++++++++ .../src/com/android/wm/shell/bubbles/BubbleOverflow.kt | 4 ++++ .../com/android/wm/shell/bubbles/BubbleStackView.java | 10 ++++++---- .../android/wm/shell/bubbles/BubbleViewInfoTask.java | 3 +++ .../android/wm/shell/bubbles/BubbleViewProvider.java | 3 +++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java index 8d43f1375a8cb..eaeade82ebb6a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java @@ -108,6 +108,8 @@ public class Bubble implements BubbleViewProvider { private Bitmap mBubbleBitmap; // The app badge for the bubble private Bitmap mBadgeBitmap; + // App badge without any markings for important conversations + private Bitmap mRawBadgeBitmap; private int mDotColor; private Path mDotPath; private int mFlags; @@ -247,6 +249,11 @@ public class Bubble implements BubbleViewProvider { return mBadgeBitmap; } + @Override + public Bitmap getRawAppBadge() { + return mRawBadgeBitmap; + } + @Override public int getDotColor() { return mDotColor; @@ -409,6 +416,7 @@ public class Bubble implements BubbleViewProvider { mFlyoutMessage = info.flyoutMessage; mBadgeBitmap = info.badgeBitmap; + mRawBadgeBitmap = info.mRawBadgeBitmap; mBubbleBitmap = info.bubbleBitmap; mDotColor = info.dotColor; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt index a175929cf4987..dd751d24e7702 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt @@ -141,6 +141,10 @@ class BubbleOverflow( return null } + override fun getRawAppBadge(): Bitmap? { + return null + } + override fun getBubbleIcon(): Bitmap { return bitmap } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index 79b765356e9e3..df3780ec1360f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -2615,11 +2615,13 @@ public class BubbleStackView extends FrameLayout // If available, update the manage menu's settings option with the expanded bubble's app // name and icon. - if (show && mBubbleData.hasBubbleInStackWithKey(mExpandedBubble.getKey())) { + if (show) { final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey()); - mManageSettingsIcon.setImageBitmap(bubble.getAppBadge()); - mManageSettingsText.setText(getResources().getString( - R.string.bubbles_app_settings, bubble.getAppName())); + if (bubble != null) { + mManageSettingsIcon.setImageBitmap(bubble.getRawAppBadge()); + mManageSettingsText.setText(getResources().getString( + R.string.bubbles_app_settings, bubble.getAppName())); + } } if (mExpandedBubble.getExpandedView().getTaskView() != null) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java index 91aff3e8a9e0d..b01c756c5a7ec 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java @@ -127,6 +127,7 @@ public class BubbleViewInfoTask extends AsyncTask