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

Commit d44286f9 authored by Abodunrinwa Toki's avatar Abodunrinwa Toki
Browse files

TextClassification.text is nullable

Removes the @NonNull requirement on TextClassification.text.
e.g. TextClassifier.NO_OP doesn't classify text and thus returns
TextClassification.EMPTY which doesn't set TextClassification.text.
This is ideal as we need not make copies of this object when NO_OP
was performed.

Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
bit FrameworksCoreTests:android.widget.TextViewActivityTest
bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I0b3ac5bf0027cbd67ba40d1110f1100280c8c3a2
parent 3c3acf8b
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -50,11 +50,11 @@ public final class TextClassification {
    private int mLogType;

    private TextClassification(
            @NonNull String text,
            Drawable icon,
            String label,
            Intent intent,
            OnClickListener onClickListener,
            @Nullable String text,
            @Nullable Drawable icon,
            @Nullable String label,
            @Nullable Intent intent,
            @Nullable OnClickListener onClickListener,
            @NonNull EntityConfidence<String> entityConfidence,
            int logType) {
        mText = text;
@@ -70,7 +70,7 @@ public final class TextClassification {
    /**
     * Gets the classified text.
     */
    @NonNull
    @Nullable
    public String getText() {
        return mText;
    }
@@ -183,8 +183,8 @@ public final class TextClassification {
        /**
         * Sets the classified text.
         */
        public Builder setText(@NonNull String text) {
            mText = Preconditions.checkNotNull(text);
        public Builder setText(@Nullable String text) {
            mText = text;
            return this;
        }