当试图回复传入消息时,消息应用程序会闪烁
2024-01-07 17:38:42
问题描述:
Actual Results:?Unable to reply for incoming message as Messaging app flickers and closes.
Expected Results:? User should be able to send reply for incoming messages.
Reproduction Steps:
- Stay in home screen.?
- Receive an incoming message.
- Click on reply from incoming pop-up.
Reproducibility:?2/3
Recoverability:?NA
Comparative Data:?Issue not seen in ET65
*****{}{}{}Device Details{}{}{}*****
Software
Build Number: ?13-10-03.00-TG-U00-PRD-NEM-04
具体Error的UI如下面的图片所示:
分析可能是QN?的对话框中手机号码的长度过长导致的问题
解决方案如下:
frameworks/base/+/447854/2/core/java/android/app/Notification.java
?
private RemoteViews makeMessagingView(int viewType) {
boolean isCollapsed = viewType != StandardTemplateParams.VIEW_TYPE_BIG;
boolean hideRightIcons = viewType != StandardTemplateParams.VIEW_TYPE_NORMAL;
boolean isConversationLayout = mConversationType != CONVERSATION_TYPE_LEGACY;
boolean isImportantConversation = mConversationType == CONVERSATION_TYPE_IMPORTANT;
boolean isHeaderless = !isConversationLayout && isCollapsed;
CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle)
? super.mBigContentTitle
: mConversationTitle;
CharSequence conversationTitleNew = "";
boolean atLeastP = mBuilder.mContext.getApplicationInfo().targetSdkVersion
>= Build.VERSION_CODES.P;
boolean isOneToOne;
CharSequence nameReplacement = null;
if (!atLeastP) {
isOneToOne = TextUtils.isEmpty(conversationTitle);
if (hasOnlyWhiteSpaceSenders()) {
isOneToOne = true;
nameReplacement = conversationTitle;
conversationTitle = null;
}
} else {
isOneToOne = !isGroupConversation();
}
if (isHeaderless && isOneToOne && TextUtils.isEmpty(conversationTitle)) {
conversationTitle = getOtherPersonName();
}
if (ZebraUtils.isZebra().orElse(false) && ZebraUtils.isMediumDisplay().orElse(false) && conversationTitle.length()>=7){
conversationTitleNew = conversationTitle.subSequence(0,7) + ".";
}else{
conversationTitleNew = conversationTitle;
}
Icon largeIcon = mBuilder.mN.mLargeIcon;
TemplateBindResult bindResult = new TemplateBindResult();
StandardTemplateParams p = mBuilder.mParams.reset()
.viewType(viewType)
.highlightExpander(isConversationLayout)
.hideProgress(true)
.title(isHeaderless ? conversationTitle : null)
.text(null)
.hideLeftIcon(isOneToOne)
.hideRightIcon(hideRightIcons || isOneToOne)
.headerTextSecondary(isHeaderless ? null : conversationTitle);
RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
isConversationLayout
? mBuilder.getConversationLayoutResource()
: isCollapsed
? mBuilder.getMessagingLayoutResource()
: mBuilder.getBigMessagingLayoutResource(),
p,
bindResult);
if (isConversationLayout) {
mBuilder.setTextViewColorPrimary(contentView, R.id.conversation_text, p);
mBuilder.setTextViewColorSecondary(contentView, R.id.app_name_divider, p);
}
addExtras(mBuilder.mN.extras);
contentView.setInt(R.id.status_bar_latest_event_content, "setLayoutColor",
mBuilder.getSmallIconColor(p));
contentView.setInt(R.id.status_bar_latest_event_content, "setSenderTextColor",
mBuilder.getPrimaryTextColor(p));
contentView.setInt(R.id.status_bar_latest_event_content, "setMessageTextColor",
mBuilder.getSecondaryTextColor(p));
contentView.setInt(R.id.status_bar_latest_event_content,
"setNotificationBackgroundColor",
mBuilder.getBackgroundColor(p));
contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsCollapsed",
isCollapsed);
contentView.setIcon(R.id.status_bar_latest_event_content, "setAvatarReplacement",
mBuilder.mN.mLargeIcon);
contentView.setCharSequence(R.id.status_bar_latest_event_content, "setNameReplacement",
nameReplacement);
contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsOneToOne",
isOneToOne);
contentView.setCharSequence(R.id.status_bar_latest_event_content,
"setConversationTitle", conversationTitleNew);
if (isConversationLayout) {
contentView.setIcon(R.id.status_bar_latest_event_content,
"setShortcutIcon", mShortcutIcon);
contentView.setBoolean(R.id.status_bar_latest_event_content,
"setIsImportantConversation", isImportantConversation);
}
if (isHeaderless) {
// Collapsed legacy messaging style has a 1-line limit.
contentView.setInt(R.id.notification_messaging, "setMaxDisplayedLines", 1);
}
}
其中关键处理是对号码的长度做截取处理:
if (ZebraUtils.isZebra().orElse(false) && ZebraUtils.isMediumDisplay().orElse(false) && conversationTitle.length()>=7){
conversationTitleNew = conversationTitle.subSequence(0,7) + ".";
}else{
conversationTitleNew = conversationTitle;
}
修改后的效果如下:
文章来源:https://blog.csdn.net/Leif_dong/article/details/135408366
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!