问题描述:
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;}
修改后的效果如下: