Obsolete
Status Update
Comments
ar...@google.com <ar...@google.com> #2
This issue does not reproduce with dev preview 4.
zh...@spreadtrum.com <zh...@spreadtrum.com> #3
Closing this issue as per comment #2 from reporter.
zh...@spreadtrum.com <zh...@spreadtrum.com> #4
Do you have some update information about this issure?
ar...@google.com <ar...@google.com> #5
We've deferred this to a future release, but leaving this open for now.
is...@google.com <is...@google.com>
sa...@google.com <sa...@google.com> #6
We will be closing this bug due to being logged in a Preview version of Android. If the issue is still relevant and reproducible in the latest public release (Android Q), please capture a bugreport and log the bug in https://goo.gl/TbMiIO . If a reply is not received within the next 14 days, this issue will be closed. Thank you for your understanding.
Description
Nexus 6p/ sharkl2
Android Version:
8.0
Test Steps:
1. open Email--->add four recipients, like: abc@sina.com, abc@sina.com, bcd@sina.com, bcd@sina.com
2. rotate the screen
3. observe the RecipientEditTextView, you will see the second recipient displays abnormal. the fourth recipient disappear.
Frequency
100%
Expected output
filtering all the repeatable recipients
Current output
the second recipient displays abnormal. the fourth recipient disappear.
Analysis:
RecipientEditTextView.java
// Visible for testing.
/*package*/ void handlePendingChips() {
......
synchronized (mPendingChips) {
Editable editable = getText();
// Tokenize!
if (mPendingChipsCount <= MAX_CHIPS_PARSED) {
for (int i = 0; i < mPendingChips.size(); i++) {
String current = mPendingChips.get(i);
>> int tokenStart = editable.toString().indexOf(current);
// Always leave a space at the end between tokens.
>> int tokenEnd = tokenStart + current.length() - 1;
if (tokenStart >= 0) {
// When we have a valid token, include it with the token
// to the left.
if (tokenEnd < editable.length() - 2
&& editable.charAt(tokenEnd) == COMMIT_CHAR_COMMA) {
tokenEnd++;
}
>> createReplacementChip(tokenStart, tokenEnd, editable, i < CHIP_LIMIT
|| !mShouldShrink);
}
mPendingChipsCount--;
}
>> sanitizeEnd();
} else {
mNoChipMode = true;
}
......
}
If you add fourth recipient like, A <abc@sina.com>, A <abc@sina.com>, B <bcd@sina.com>, B <bcd@sina.com>, . The first one is the same as the second one.
According to the above code, when i = 0, tokenStart=0, tokenEnd=17. However, when i=1, tokenStart=0, tokenEnd=17, too.
Strictly speaking, when i=1, tokenStart=18, tokenEnd=35. Thus, the wrong values of tokenStart and tokenEnd cause the chip make fail.
While, the API sanitizeEnd() can not filter all repeatable recipients.
So, my solution is: before execute createReplacementChip function, filtering all repeatable recipient.
You can download form attachment for detail code.