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

Commit 9559c20a authored by Roozbeh Pournader's avatar Roozbeh Pournader
Browse files

Deprecate android.text.AndroidCharacter

AndroidCharacter was added to compensate for limitations in
java.lang.Character, but it has been outdated and its functionality
is provided with a much better API by android.icu.lang.UCharacter.

Bug: 32551718
Test: cts-tradefed run cts-dev --module CtsTextTestCases --test android.text.cts.AndroidCharacterTest
Change-Id: Iec1969dc5787a4ebb0e68cdc213d3d0cdc3b2d0d
parent e70c9095
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38749,7 +38749,7 @@ package android.text {
    method public java.lang.CharSequence subSequence(int, int);
  }
  public class AndroidCharacter {
  public deprecated class AndroidCharacter {
    ctor public AndroidCharacter();
    method public static void getDirectionalities(char[], byte[], int);
    method public static int getEastAsianWidth(char);
+1 −1
Original line number Diff line number Diff line
@@ -41937,7 +41937,7 @@ package android.text {
    method public java.lang.CharSequence subSequence(int, int);
  }
  public class AndroidCharacter {
  public deprecated class AndroidCharacter {
    ctor public AndroidCharacter();
    method public static void getDirectionalities(char[], byte[], int);
    method public static int getEastAsianWidth(char);
+1 −1
Original line number Diff line number Diff line
@@ -38848,7 +38848,7 @@ package android.text {
    method public java.lang.CharSequence subSequence(int, int);
  }
  public class AndroidCharacter {
  public deprecated class AndroidCharacter {
    ctor public AndroidCharacter();
    method public static void getDirectionalities(char[], byte[], int);
    method public static int getEastAsianWidth(char);
+4 −2
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@
package android.text;

/**
 * AndroidCharacter exposes some character properties that are not
 * easily accessed from java.lang.Character.
 * AndroidCharacter exposes some character properties that used to be not
 * easily accessed from java.lang.Character, but are now available in ICU.
 * @deprecated Use various methods from {@link android.icu.lang.UCharacter}, instead.
 */
@Deprecated
public class AndroidCharacter
{
    public static final int EAST_ASIAN_WIDTH_NEUTRAL = 0;
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.annotation.PluralsRes;
import android.content.Context;
import android.content.res.Resources;
import android.icu.lang.UCharacter;
import android.icu.util.ULocale;
import android.os.Parcel;
import android.os.Parcelable;
@@ -545,9 +546,10 @@ public class TextUtils {
        }

        public char charAt(int off) {
            return AndroidCharacter.getMirror(mSource.charAt(mEnd - 1 - off));
            return (char) UCharacter.getMirror(mSource.charAt(mEnd - 1 - off));
        }

        @SuppressWarnings("deprecation")
        public void getChars(int start, int end, char[] dest, int destoff) {
            TextUtils.getChars(mSource, start + mStart, end + mStart,
                               dest, destoff);