Loading src/java/com/android/internal/telephony/SmsMessageBase.java +16 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import java.util.Arrays; import android.provider.Telephony; import android.telephony.SmsMessage; import android.text.Emoji; /** * Base class declaring the specific methods and members for SmsMessage. Loading Loading @@ -367,7 +368,21 @@ public abstract class SmsMessageBase { BreakIterator breakIterator = BreakIterator.getCharacterInstance(); breakIterator.setText(msgBody.toString()); if (!breakIterator.isBoundary(nextPos)) { nextPos = breakIterator.preceding(nextPos); int breakPos = breakIterator.preceding(nextPos); while (breakPos + 4 <= nextPos && Emoji.isRegionalIndicatorSymbol( Character.codePointAt(msgBody, breakPos)) && Emoji.isRegionalIndicatorSymbol( Character.codePointAt(msgBody, breakPos + 2))) { // skip forward over flags (pairs of Regional Indicator Symbol) breakPos += 4; } if (breakPos > currentPosition) { nextPos = breakPos; } else if (Character.isHighSurrogate(msgBody.charAt(nextPos - 1))) { // no character boundary in this fragment, try to at least land on a code point nextPos -= 1; } } } return nextPos; Loading Loading
src/java/com/android/internal/telephony/SmsMessageBase.java +16 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import java.util.Arrays; import android.provider.Telephony; import android.telephony.SmsMessage; import android.text.Emoji; /** * Base class declaring the specific methods and members for SmsMessage. Loading Loading @@ -367,7 +368,21 @@ public abstract class SmsMessageBase { BreakIterator breakIterator = BreakIterator.getCharacterInstance(); breakIterator.setText(msgBody.toString()); if (!breakIterator.isBoundary(nextPos)) { nextPos = breakIterator.preceding(nextPos); int breakPos = breakIterator.preceding(nextPos); while (breakPos + 4 <= nextPos && Emoji.isRegionalIndicatorSymbol( Character.codePointAt(msgBody, breakPos)) && Emoji.isRegionalIndicatorSymbol( Character.codePointAt(msgBody, breakPos + 2))) { // skip forward over flags (pairs of Regional Indicator Symbol) breakPos += 4; } if (breakPos > currentPosition) { nextPos = breakPos; } else if (Character.isHighSurrogate(msgBody.charAt(nextPos - 1))) { // no character boundary in this fragment, try to at least land on a code point nextPos -= 1; } } } return nextPos; Loading