Loading api/current.txt +16 −2 Original line number Diff line number Diff line Loading @@ -48955,14 +48955,22 @@ package android.view.textclassifier { method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String); } public static final class TextClassification.Options { ctor public TextClassification.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextClassification.Options setDefaultLocales(android.os.LocaleList); } public final class TextClassificationManager { method public android.view.textclassifier.TextClassifier getTextClassifier(); method public void setTextClassifier(android.view.textclassifier.TextClassifier); } public abstract interface TextClassifier { method public abstract android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public abstract android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); field public static final android.view.textclassifier.TextClassifier NO_OP; field public static final java.lang.String TYPE_ADDRESS = "address"; field public static final java.lang.String TYPE_EMAIL = "email"; Loading @@ -48985,6 +48993,12 @@ package android.view.textclassifier { method public android.view.textclassifier.TextSelection.Builder setEntityType(java.lang.String, float); } public static final class TextSelection.Options { ctor public TextSelection.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextSelection.Options setDefaultLocales(android.os.LocaleList); } } package android.view.textservice { api/system-current.txt +16 −2 Original line number Diff line number Diff line Loading @@ -52694,14 +52694,22 @@ package android.view.textclassifier { method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String); } public static final class TextClassification.Options { ctor public TextClassification.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextClassification.Options setDefaultLocales(android.os.LocaleList); } public final class TextClassificationManager { method public android.view.textclassifier.TextClassifier getTextClassifier(); method public void setTextClassifier(android.view.textclassifier.TextClassifier); } public abstract interface TextClassifier { method public abstract android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public abstract android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); field public static final android.view.textclassifier.TextClassifier NO_OP; field public static final java.lang.String TYPE_ADDRESS = "address"; field public static final java.lang.String TYPE_EMAIL = "email"; Loading @@ -52724,6 +52732,12 @@ package android.view.textclassifier { method public android.view.textclassifier.TextSelection.Builder setEntityType(java.lang.String, float); } public static final class TextSelection.Options { ctor public TextSelection.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextSelection.Options setDefaultLocales(android.os.LocaleList); } } package android.view.textservice { api/test-current.txt +16 −2 Original line number Diff line number Diff line Loading @@ -49592,14 +49592,22 @@ package android.view.textclassifier { method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String); } public static final class TextClassification.Options { ctor public TextClassification.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextClassification.Options setDefaultLocales(android.os.LocaleList); } public final class TextClassificationManager { method public android.view.textclassifier.TextClassifier getTextClassifier(); method public void setTextClassifier(android.view.textclassifier.TextClassifier); } public abstract interface TextClassifier { method public abstract android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public abstract android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); field public static final android.view.textclassifier.TextClassifier NO_OP; field public static final java.lang.String TYPE_ADDRESS = "address"; field public static final java.lang.String TYPE_EMAIL = "email"; Loading @@ -49622,6 +49630,12 @@ package android.view.textclassifier { method public android.view.textclassifier.TextSelection.Builder setEntityType(java.lang.String, float); } public static final class TextSelection.Options { ctor public TextSelection.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextSelection.Options setDefaultLocales(android.os.LocaleList); } } package android.view.textservice { core/java/android/view/textclassifier/TextClassification.java +28 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.annotation.Nullable; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.LocaleList; import android.view.View.OnClickListener; import android.view.textclassifier.TextClassifier.EntityType; Loading Loading @@ -438,4 +439,31 @@ public final class TextClassification { mLogType, mVersionInfo); } } /** * TextClassification optional input parameters. */ public static final class Options { private LocaleList mDefaultLocales; /** * @param defaultLocales ordered list of locale preferences that may be used to disambiguate * the provided text. If no locale preferences exist, set this to null or an empty * locale list. */ public Options setDefaultLocales(@Nullable LocaleList defaultLocales) { mDefaultLocales = defaultLocales; return this; } /** * @return ordered list of locale preferences that can be used to disambiguate * the provided text. */ @Nullable public LocaleList getDefaultLocales() { return mDefaultLocales; } } } core/java/android/view/textclassifier/TextClassifier.java +39 −29 Original line number Diff line number Diff line Loading @@ -56,23 +56,7 @@ public interface TextClassifier { * No-op TextClassifier. * This may be used to turn off TextClassifier features. */ TextClassifier NO_OP = new TextClassifier() { @Override public TextSelection suggestSelection( CharSequence text, int selectionStartIndex, int selectionEndIndex, LocaleList defaultLocales) { return new TextSelection.Builder(selectionStartIndex, selectionEndIndex).build(); } @Override public TextClassification classifyText( CharSequence text, int startIndex, int endIndex, LocaleList defaultLocales) { return TextClassification.EMPTY; } }; TextClassifier NO_OP = new TextClassifier() {}; /** * Returns suggested text selection start and end indices, recognized entity types, and their Loading @@ -82,21 +66,34 @@ public interface TextClassifier { * by the sub sequence starting at selectionStartIndex and ending at selectionEndIndex) * @param selectionStartIndex start index of the selected part of text * @param selectionEndIndex end index of the selected part of text * @param defaultLocales ordered list of locale preferences that can be used to disambiguate * the provided text. If no locale preferences exist, set this to null or an empty locale * list in which case the classifier will decide whether to use no locale information, use * a default locale, or use the system default. * @param options optional input parameters * * @throws IllegalArgumentException if text is null; selectionStartIndex is negative; * selectionEndIndex is greater than text.length() or not greater than selectionStartIndex */ @WorkerThread @NonNull TextSelection suggestSelection( default TextSelection suggestSelection( @NonNull CharSequence text, @IntRange(from = 0) int selectionStartIndex, @IntRange(from = 0) int selectionEndIndex, @Nullable TextSelection.Options options) { return new TextSelection.Builder(selectionStartIndex, selectionEndIndex).build(); } /** * @see #suggestSelection(CharSequence, int, int, TextSelection.Options) */ // TODO: Consider deprecating (b/68846316) @WorkerThread @NonNull default TextSelection suggestSelection( @NonNull CharSequence text, @IntRange(from = 0) int selectionStartIndex, @IntRange(from = 0) int selectionEndIndex, @Nullable LocaleList defaultLocales); @Nullable LocaleList defaultLocales) { return new TextSelection.Builder(selectionStartIndex, selectionEndIndex).build(); } /** * Classifies the specified text and returns a {@link TextClassification} object that can be Loading @@ -106,21 +103,34 @@ public interface TextClassifier { * by the sub sequence starting at startIndex and ending at endIndex) * @param startIndex start index of the text to classify * @param endIndex end index of the text to classify * @param defaultLocales ordered list of locale preferences that can be used to disambiguate * the provided text. If no locale preferences exist, set this to null or an empty locale * list in which case the classifier will decide whether to use no locale information, use * a default locale, or use the system default. * @param options optional input parameters * * @throws IllegalArgumentException if text is null; startIndex is negative; * endIndex is greater than text.length() or not greater than startIndex */ @WorkerThread @NonNull TextClassification classifyText( default TextClassification classifyText( @NonNull CharSequence text, @IntRange(from = 0) int startIndex, @IntRange(from = 0) int endIndex, @Nullable LocaleList defaultLocales); @Nullable TextClassification.Options options) { return TextClassification.EMPTY; } /** * @see #classifyText(CharSequence, int, int, TextClassification.Options) */ // TODO: Consider deprecating (b/68846316) @WorkerThread @NonNull default TextClassification classifyText( @NonNull CharSequence text, @IntRange(from = 0) int startIndex, @IntRange(from = 0) int endIndex, @Nullable LocaleList defaultLocales) { return TextClassification.EMPTY; } /** * Returns a {@link LinksInfo} that may be applied to the text to annotate it with links Loading Loading
api/current.txt +16 −2 Original line number Diff line number Diff line Loading @@ -48955,14 +48955,22 @@ package android.view.textclassifier { method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String); } public static final class TextClassification.Options { ctor public TextClassification.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextClassification.Options setDefaultLocales(android.os.LocaleList); } public final class TextClassificationManager { method public android.view.textclassifier.TextClassifier getTextClassifier(); method public void setTextClassifier(android.view.textclassifier.TextClassifier); } public abstract interface TextClassifier { method public abstract android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public abstract android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); field public static final android.view.textclassifier.TextClassifier NO_OP; field public static final java.lang.String TYPE_ADDRESS = "address"; field public static final java.lang.String TYPE_EMAIL = "email"; Loading @@ -48985,6 +48993,12 @@ package android.view.textclassifier { method public android.view.textclassifier.TextSelection.Builder setEntityType(java.lang.String, float); } public static final class TextSelection.Options { ctor public TextSelection.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextSelection.Options setDefaultLocales(android.os.LocaleList); } } package android.view.textservice {
api/system-current.txt +16 −2 Original line number Diff line number Diff line Loading @@ -52694,14 +52694,22 @@ package android.view.textclassifier { method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String); } public static final class TextClassification.Options { ctor public TextClassification.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextClassification.Options setDefaultLocales(android.os.LocaleList); } public final class TextClassificationManager { method public android.view.textclassifier.TextClassifier getTextClassifier(); method public void setTextClassifier(android.view.textclassifier.TextClassifier); } public abstract interface TextClassifier { method public abstract android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public abstract android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); field public static final android.view.textclassifier.TextClassifier NO_OP; field public static final java.lang.String TYPE_ADDRESS = "address"; field public static final java.lang.String TYPE_EMAIL = "email"; Loading @@ -52724,6 +52732,12 @@ package android.view.textclassifier { method public android.view.textclassifier.TextSelection.Builder setEntityType(java.lang.String, float); } public static final class TextSelection.Options { ctor public TextSelection.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextSelection.Options setDefaultLocales(android.os.LocaleList); } } package android.view.textservice {
api/test-current.txt +16 −2 Original line number Diff line number Diff line Loading @@ -49592,14 +49592,22 @@ package android.view.textclassifier { method public android.view.textclassifier.TextClassification.Builder setText(java.lang.String); } public static final class TextClassification.Options { ctor public TextClassification.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextClassification.Options setDefaultLocales(android.os.LocaleList); } public final class TextClassificationManager { method public android.view.textclassifier.TextClassifier getTextClassifier(); method public void setTextClassifier(android.view.textclassifier.TextClassifier); } public abstract interface TextClassifier { method public abstract android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public abstract android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options); method public default android.view.textclassifier.TextClassification classifyText(java.lang.CharSequence, int, int, android.os.LocaleList); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options); method public default android.view.textclassifier.TextSelection suggestSelection(java.lang.CharSequence, int, int, android.os.LocaleList); field public static final android.view.textclassifier.TextClassifier NO_OP; field public static final java.lang.String TYPE_ADDRESS = "address"; field public static final java.lang.String TYPE_EMAIL = "email"; Loading @@ -49622,6 +49630,12 @@ package android.view.textclassifier { method public android.view.textclassifier.TextSelection.Builder setEntityType(java.lang.String, float); } public static final class TextSelection.Options { ctor public TextSelection.Options(); method public android.os.LocaleList getDefaultLocales(); method public android.view.textclassifier.TextSelection.Options setDefaultLocales(android.os.LocaleList); } } package android.view.textservice {
core/java/android/view/textclassifier/TextClassification.java +28 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.annotation.Nullable; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.LocaleList; import android.view.View.OnClickListener; import android.view.textclassifier.TextClassifier.EntityType; Loading Loading @@ -438,4 +439,31 @@ public final class TextClassification { mLogType, mVersionInfo); } } /** * TextClassification optional input parameters. */ public static final class Options { private LocaleList mDefaultLocales; /** * @param defaultLocales ordered list of locale preferences that may be used to disambiguate * the provided text. If no locale preferences exist, set this to null or an empty * locale list. */ public Options setDefaultLocales(@Nullable LocaleList defaultLocales) { mDefaultLocales = defaultLocales; return this; } /** * @return ordered list of locale preferences that can be used to disambiguate * the provided text. */ @Nullable public LocaleList getDefaultLocales() { return mDefaultLocales; } } }
core/java/android/view/textclassifier/TextClassifier.java +39 −29 Original line number Diff line number Diff line Loading @@ -56,23 +56,7 @@ public interface TextClassifier { * No-op TextClassifier. * This may be used to turn off TextClassifier features. */ TextClassifier NO_OP = new TextClassifier() { @Override public TextSelection suggestSelection( CharSequence text, int selectionStartIndex, int selectionEndIndex, LocaleList defaultLocales) { return new TextSelection.Builder(selectionStartIndex, selectionEndIndex).build(); } @Override public TextClassification classifyText( CharSequence text, int startIndex, int endIndex, LocaleList defaultLocales) { return TextClassification.EMPTY; } }; TextClassifier NO_OP = new TextClassifier() {}; /** * Returns suggested text selection start and end indices, recognized entity types, and their Loading @@ -82,21 +66,34 @@ public interface TextClassifier { * by the sub sequence starting at selectionStartIndex and ending at selectionEndIndex) * @param selectionStartIndex start index of the selected part of text * @param selectionEndIndex end index of the selected part of text * @param defaultLocales ordered list of locale preferences that can be used to disambiguate * the provided text. If no locale preferences exist, set this to null or an empty locale * list in which case the classifier will decide whether to use no locale information, use * a default locale, or use the system default. * @param options optional input parameters * * @throws IllegalArgumentException if text is null; selectionStartIndex is negative; * selectionEndIndex is greater than text.length() or not greater than selectionStartIndex */ @WorkerThread @NonNull TextSelection suggestSelection( default TextSelection suggestSelection( @NonNull CharSequence text, @IntRange(from = 0) int selectionStartIndex, @IntRange(from = 0) int selectionEndIndex, @Nullable TextSelection.Options options) { return new TextSelection.Builder(selectionStartIndex, selectionEndIndex).build(); } /** * @see #suggestSelection(CharSequence, int, int, TextSelection.Options) */ // TODO: Consider deprecating (b/68846316) @WorkerThread @NonNull default TextSelection suggestSelection( @NonNull CharSequence text, @IntRange(from = 0) int selectionStartIndex, @IntRange(from = 0) int selectionEndIndex, @Nullable LocaleList defaultLocales); @Nullable LocaleList defaultLocales) { return new TextSelection.Builder(selectionStartIndex, selectionEndIndex).build(); } /** * Classifies the specified text and returns a {@link TextClassification} object that can be Loading @@ -106,21 +103,34 @@ public interface TextClassifier { * by the sub sequence starting at startIndex and ending at endIndex) * @param startIndex start index of the text to classify * @param endIndex end index of the text to classify * @param defaultLocales ordered list of locale preferences that can be used to disambiguate * the provided text. If no locale preferences exist, set this to null or an empty locale * list in which case the classifier will decide whether to use no locale information, use * a default locale, or use the system default. * @param options optional input parameters * * @throws IllegalArgumentException if text is null; startIndex is negative; * endIndex is greater than text.length() or not greater than startIndex */ @WorkerThread @NonNull TextClassification classifyText( default TextClassification classifyText( @NonNull CharSequence text, @IntRange(from = 0) int startIndex, @IntRange(from = 0) int endIndex, @Nullable LocaleList defaultLocales); @Nullable TextClassification.Options options) { return TextClassification.EMPTY; } /** * @see #classifyText(CharSequence, int, int, TextClassification.Options) */ // TODO: Consider deprecating (b/68846316) @WorkerThread @NonNull default TextClassification classifyText( @NonNull CharSequence text, @IntRange(from = 0) int startIndex, @IntRange(from = 0) int endIndex, @Nullable LocaleList defaultLocales) { return TextClassification.EMPTY; } /** * Returns a {@link LinksInfo} that may be applied to the text to annotate it with links Loading