Bug #118695
IOVDEV-33582【内部】【VC1】【0106】【台架】【EE环境】【副屏】【launcher】通知列表隐藏通知图标颜色和展开后不一致
Status: | CLOSED | Start date: | 2023-06-08 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | CD TEST-方永红 | % Done: | 0% | |
Category: | 依赖客户及其供应商解决 | |||
Target version: | - | |||
Need_Info: | -- | Found Version: | 0106 | |
Resolution: | -- | Degrated: | -- | |
Severity: | Normal | Verified Version: | ||
Reproducibility: | Every time | Fixed Version: | ||
Test Type: | ST | Root cause: |
Description
环境信息】:EE环境
【问题出现时间】:20230608 17:51,第226次开机
【前提条件】:副屏安装今日头条,收到消息通知
【操作步骤】:下拉展开通知列表
【实际结果】:今日头条图标显示不一致
【期望结果】:通知展开与折叠时图标一致
【备注】:
https://ofs.human-horizons.com/#/download/index/yYtZFA6quo4%3D
【副屏版本号】:01.00.0106.C104
【中控版本号】:03.02.0088.C103.02_userdebug_2306021732
【VIN】HRYTTESTVINMGM403
History
#1 Updated by CD FW 曹覃刚 about 2 years ago
- Status changed from New to ASSIGNED
- Assignee changed from CD FW 曹覃刚 to CD FW-廖涛
#2 Updated by CD FW-廖涛 about 2 years ago
- Assignee changed from CD FW-廖涛 to CD FW-周羚洛
#3 Updated by CD FW-廖涛 about 2 years ago
- Category changed from CD-FW to 依赖客户及其供应商解决
- Status changed from ASSIGNED to NEED_INFO
- Assignee changed from CD FW-周羚洛 to CD TEST-方永红
■ 我的分析
两处图标不同的原因是:两处使用的图标不一致
左侧图片使用的是getLargeIcon
frameworks/base/core/java/android/app/Notification.java
------------------------------------------------------------------------------------
5139 private RemoteViews applyStandardTemplate(int resId, StandardTemplateParams p,
5140 TemplateBindResult result) {
5141 p.headerless(resId getBaseLayoutResource()
5142 || resId getHeadsUpBaseLayoutResource()
5143 || resId getMessagingLayoutResource()
5144 || resId R.layout.notification_template_material_media);
5145 RemoteViews contentView = new BuilderRemoteViews(mContext.getApplicationInfo(), resId);
5146
5147 resetStandardTemplate(contentView);
5148
5149 final Bundle ex = mN.extras;
5150 updateBackgroundColor(contentView, p);
5151 bindNotificationHeader(contentView, p);
5152 bindLargeIconAndApplyMargin(contentView, p, result); ★★★
5153 boolean showProgress = handleProgressBar(contentView, ex, p);
5154 boolean hasSecondLine = showProgress;
5155 if (p.hasTitle())
{ 5156 contentView.setViewVisibility(p.mTitleViewId, View.VISIBLE); 5157 contentView.setTextViewText(p.mTitleViewId, processTextSpans(p.title)); 5158 setTextViewColorPrimary(contentView, p.mTitleViewId, p); 5159 }
else if (p.mTitleViewId != R.id.title)
{ 5160 // This alternate title view ID is not cleared by resetStandardTemplate 5161 contentView.setViewVisibility(p.mTitleViewId, View.GONE); 5162 contentView.setTextViewText(p.mTitleViewId, null); 5163 }
5164 if (p.text != null && p.text.length() != 0
5165 && (!showProgress || p.mAllowTextWithProgress))
{ 5166 contentView.setViewVisibility(p.mTextViewId, View.VISIBLE); 5167 contentView.setTextViewText(p.mTextViewId, processTextSpans(p.text)); 5168 setTextViewColorSecondary(contentView, p.mTextViewId, p); 5169 hasSecondLine = true; 5170 }
else if (p.mTextViewId != R.id.text)
{ 5171 // This alternate text view ID is not cleared by resetStandardTemplate 5172 contentView.setViewVisibility(p.mTextViewId, View.GONE); 5173 contentView.setTextViewText(p.mTextViewId, null); 5174 }
5175 setHeaderlessVerticalMargins(contentView, p, hasSecondLine);
5176
5177 return contentView;
5178 }
------------------------------------------------------------------------------------
右侧图片使用的是getSmallIcon
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
------------------------------------------------------------------------------------
258 private void updateHideNotificationCountAndIcon() {
...
297 Icon icon = entry.getSbn().getNotification().getSmallIcon(); ★★★
298 if (icon != null && icon.getType() Icon.TYPE_RESOURCE
299 && (icon.getResPackage() null || icon.getResPackage().isEmpty())
300 && entry.getSbn().getPackageName() != null
301 && entry.getSbn().getNotification().icon != 0)
{ 302 icon = Icon.createWithResource(entry.getSbn().getPackageContext(mContext), 303 entry.getSbn().getNotification().icon); 304 }
305 mImageView.setImageIcon(icon);
306 mImageView.setBackgroundResource(R.drawable.notification_icon_circle);
307 mImageView.setZ(MAX_NOTIFICATION_ICON_SIZE - mContentNotificationIcons.getChildCount());
308 mContentNotificationIcons.addView(mImageView);
...
------------------------------------------------------------------------------------
根据 AOSP 的通知策略,SmallIcon 三方应用应该使用可灰度化的图标(系统会将其着色为主题色),LargeIcon 会保持原样展示。
所以该现象为正常现象,无需处理。
#4 Updated by CD FW-廖涛 about 2 years ago
已在 JIRA 上回复。
#5 Updated by CDTS_TEST 王成 about 2 years ago
- Status changed from NEED_INFO to RESOLVED
两处图标不同的原因是:两处使用的图标不一致
左侧图片使用的是getLargeIcon
frameworks/base/core/java/android/app/Notification.java
------------------------------------------------------------------------------------
5139 private RemoteViews applyStandardTemplate(int resId, StandardTemplateParams p,
5140 TemplateBindResult result) {
5141 p.headerless(resId getBaseLayoutResource()
5142 || resId getHeadsUpBaseLayoutResource()
5143 || resId getMessagingLayoutResource()
5144 || resId R.layout.notification_template_material_media);
5145 RemoteViews contentView = new BuilderRemoteViews(mContext.getApplicationInfo(), resId);
5146
5147 resetStandardTemplate(contentView);
5148
5149 final Bundle ex = mN.extras;
5150 updateBackgroundColor(contentView, p);
5151 bindNotificationHeader(contentView, p);
5152 bindLargeIconAndApplyMargin(contentView, p, result); ★★★
5153 boolean showProgress = handleProgressBar(contentView, ex, p);
5154 boolean hasSecondLine = showProgress;
5155 if (p.hasTitle())
{ 5156 contentView.setViewVisibility(p.mTitleViewId, View.VISIBLE); 5157 contentView.setTextViewText(p.mTitleViewId, processTextSpans(p.title)); 5158 setTextViewColorPrimary(contentView, p.mTitleViewId, p); 5159 }
else if (p.mTitleViewId != R.id.title)
{ 5160 // This alternate title view ID is not cleared by resetStandardTemplate 5161 contentView.setViewVisibility(p.mTitleViewId, View.GONE); 5162 contentView.setTextViewText(p.mTitleViewId, null); 5163 }
5164 if (p.text != null && p.text.length() != 0
5165 && (!showProgress || p.mAllowTextWithProgress))
{ 5166 contentView.setViewVisibility(p.mTextViewId, View.VISIBLE); 5167 contentView.setTextViewText(p.mTextViewId, processTextSpans(p.text)); 5168 setTextViewColorSecondary(contentView, p.mTextViewId, p); 5169 hasSecondLine = true; 5170 }
else if (p.mTextViewId != R.id.text)
{ 5171 // This alternate text view ID is not cleared by resetStandardTemplate 5172 contentView.setViewVisibility(p.mTextViewId, View.GONE); 5173 contentView.setTextViewText(p.mTextViewId, null); 5174 }
5175 setHeaderlessVerticalMargins(contentView, p, hasSecondLine);
5176
5177 return contentView;
5178 }
------------------------------------------------------------------------------------
右侧图片使用的是getSmallIcon
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/SectionHeaderView.java
------------------------------------------------------------------------------------
258 private void updateHideNotificationCountAndIcon() {
...
297 Icon icon = entry.getSbn().getNotification().getSmallIcon(); ★★★
298 if (icon != null && icon.getType() Icon.TYPE_RESOURCE
299 && (icon.getResPackage() null || icon.getResPackage().isEmpty())
300 && entry.getSbn().getPackageName() != null
301 && entry.getSbn().getNotification().icon != 0)
{ 302 icon = Icon.createWithResource(entry.getSbn().getPackageContext(mContext), 303 entry.getSbn().getNotification().icon); 304 }
305 mImageView.setImageIcon(icon);
306 mImageView.setBackgroundResource(R.drawable.notification_icon_circle);
307 mImageView.setZ(MAX_NOTIFICATION_ICON_SIZE - mContentNotificationIcons.getChildCount());
308 mContentNotificationIcons.addView(mImageView);
...
------------------------------------------------------------------------------------
根据 AOSP 的通知策略,SmallIcon 三方应用应该使用可灰度化的图标(系统会将其着色为主题色),LargeIcon 会保持原样展示。
所以该现象为正常现象,无需处理。
#6 Updated by CDTS_TEST 王成 about 2 years ago
- Status changed from RESOLVED to VERIFIED
#7 Updated by CDTS_TEST 王成 about 2 years ago
- Status changed from VERIFIED to CLOSED