Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3d2479a authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Fix regressions in existing constructors of TextInfo"

parents f32b3de8 bf655982
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -31,12 +31,15 @@ public final class TextInfo implements Parcelable {
    private final int mCookie;
    private final int mSequenceNumber;

    private static final int DEFAULT_COOKIE = 0;
    private static final int DEFAULT_SEQUENCE_NUMBER = 0;

    /**
     * Constructor.
     * @param text the text which will be input to TextService
     */
    public TextInfo(String text) {
        this(text, 0, 0, 0, 0);
        this(text, 0, getStringLengthOrZero(text), DEFAULT_COOKIE, DEFAULT_SEQUENCE_NUMBER);
    }

    /**
@@ -46,7 +49,11 @@ public final class TextInfo implements Parcelable {
     * @param sequenceNumber the sequence number for this TextInfo
     */
    public TextInfo(String text, int cookie, int sequenceNumber) {
        this(text, 0, 0, 0, 0);
        this(text, 0, getStringLengthOrZero(text), cookie, sequenceNumber);
    }

    private static int getStringLengthOrZero(final String text) {
        return TextUtils.isEmpty(text) ? 0 : text.length();
    }

    /**