summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aurimas Liutikas <aurimas@google.com> 2019-09-11 15:00:22 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-09-11 15:00:22 +0000
commit648056c2107f69072ce6d5e9716632678a75fd6e (patch)
treeef783b6c705d584513e15e9e203574611321ce42
parent4b1ea9150ee1efbbebd0fc6df5027406243f8cca (diff)
parent7da04d64ba52f80b688d006728baa4925d815509 (diff)
Merge "Adding nullability annotations on ViewNode/AssistStructure."
-rw-r--r--api/current.txt20
-rw-r--r--core/java/android/app/assist/AssistStructure.java10
-rw-r--r--core/java/android/view/contentcapture/ViewNode.java14
3 files changed, 34 insertions, 10 deletions
diff --git a/api/current.txt b/api/current.txt
index e3fde232f074..9fc3eda61f76 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7216,18 +7216,18 @@ package android.app.assist {
method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
method public android.app.assist.AssistStructure.ViewNode getChildAt(int);
method public int getChildCount();
- method public String getClassName();
- method public CharSequence getContentDescription();
+ method @Nullable public String getClassName();
+ method @Nullable public CharSequence getContentDescription();
method public float getElevation();
- method public android.os.Bundle getExtras();
+ method @Nullable public android.os.Bundle getExtras();
method public int getHeight();
- method public String getHint();
+ method @Nullable public String getHint();
method @Nullable public String getHintIdEntry();
method @Nullable public android.view.ViewStructure.HtmlInfo getHtmlInfo();
method public int getId();
- method public String getIdEntry();
- method public String getIdPackage();
- method public String getIdType();
+ method @Nullable public String getIdEntry();
+ method @Nullable public String getIdPackage();
+ method @Nullable public String getIdType();
method public int getImportantForAutofill();
method public int getInputType();
method public int getLeft();
@@ -7237,12 +7237,12 @@ package android.app.assist {
method public int getMinTextEms();
method public int getScrollX();
method public int getScrollY();
- method public CharSequence getText();
+ method @Nullable public CharSequence getText();
method public int getTextBackgroundColor();
method public int getTextColor();
method @Nullable public String getTextIdEntry();
- method public int[] getTextLineBaselines();
- method public int[] getTextLineCharOffsets();
+ method @Nullable public int[] getTextLineBaselines();
+ method @Nullable public int[] getTextLineCharOffsets();
method public int getTextSelectionEnd();
method public int getTextSelectionStart();
method public float getTextSize();
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
index 86e768db3c52..f9e710e118ea 100644
--- a/core/java/android/app/assist/AssistStructure.java
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -1080,6 +1080,7 @@ public class AssistStructure implements Parcelable {
* identifier. See {@link android.view.ViewStructure#setId ViewStructure.setId}
* for more information.
*/
+ @Nullable
public String getIdPackage() {
return mIdPackage;
}
@@ -1089,6 +1090,7 @@ public class AssistStructure implements Parcelable {
* identifier. See {@link android.view.ViewStructure#setId ViewStructure.setId}
* for more information.
*/
+ @Nullable
public String getIdType() {
return mIdType;
}
@@ -1098,6 +1100,7 @@ public class AssistStructure implements Parcelable {
* identifier. See {@link android.view.ViewStructure#setId ViewStructure.setId}
* for more information.
*/
+ @Nullable
public String getIdEntry() {
return mIdEntry;
}
@@ -1391,6 +1394,7 @@ public class AssistStructure implements Parcelable {
* For example, a button will report "android.widget.Button" meaning it behaves
* like a {@link android.widget.Button}.
*/
+ @Nullable
public String getClassName() {
return mClassName;
}
@@ -1399,6 +1403,7 @@ public class AssistStructure implements Parcelable {
* Returns any content description associated with the node, which semantically describes
* its purpose for accessibility and other uses.
*/
+ @Nullable
public CharSequence getContentDescription() {
return mContentDescription;
}
@@ -1473,6 +1478,7 @@ public class AssistStructure implements Parcelable {
* Returns any text associated with the node that is displayed to the user, or null
* if there is none.
*/
+ @Nullable
public CharSequence getText() {
return mText != null ? mText.mText : null;
}
@@ -1560,6 +1566,7 @@ public class AssistStructure implements Parcelable {
* <p>It's only relevant when the {@link AssistStructure} is used for assist purposes,
* not for autofill purposes.
*/
+ @Nullable
public int[] getTextLineCharOffsets() {
return mText != null ? mText.mLineCharOffsets : null;
}
@@ -1573,6 +1580,7 @@ public class AssistStructure implements Parcelable {
* <p>It's only relevant when the {@link AssistStructure} is used for assist purposes,
* not for autofill purposes.
*/
+ @Nullable
public int[] getTextLineBaselines() {
return mText != null ? mText.mLineBaselines : null;
}
@@ -1592,6 +1600,7 @@ public class AssistStructure implements Parcelable {
* Return additional hint text associated with the node; this is typically used with
* a node that takes user input, describing to the user what the input means.
*/
+ @Nullable
public String getHint() {
return mText != null ? mText.mHint : null;
}
@@ -1610,6 +1619,7 @@ public class AssistStructure implements Parcelable {
/**
* Return a Bundle containing optional vendor-specific extension information.
*/
+ @Nullable
public Bundle getExtras() {
return mExtras;
}
diff --git a/core/java/android/view/contentcapture/ViewNode.java b/core/java/android/view/contentcapture/ViewNode.java
index 0dd2587feed5..e035c620d1fd 100644
--- a/core/java/android/view/contentcapture/ViewNode.java
+++ b/core/java/android/view/contentcapture/ViewNode.java
@@ -211,16 +211,19 @@ public final class ViewNode extends AssistStructure.ViewNode {
return mParentAutofillId;
}
+ @Nullable
@Override
public AutofillId getAutofillId() {
return mAutofillId;
}
+ @Nullable
@Override
public CharSequence getText() {
return mText != null ? mText.mText : null;
}
+ @Nullable
@Override
public String getClassName() {
return mClassName;
@@ -231,16 +234,19 @@ public final class ViewNode extends AssistStructure.ViewNode {
return mId;
}
+ @Nullable
@Override
public String getIdPackage() {
return mIdPackage;
}
+ @Nullable
@Override
public String getIdType() {
return mIdType;
}
+ @Nullable
@Override
public String getIdEntry() {
return mIdEntry;
@@ -341,21 +347,25 @@ public final class ViewNode extends AssistStructure.ViewNode {
return (mFlags & FLAGS_OPAQUE) != 0;
}
+ @Nullable
@Override
public CharSequence getContentDescription() {
return mContentDescription;
}
+ @Nullable
@Override
public Bundle getExtras() {
return mExtras;
}
+ @Nullable
@Override
public String getHint() {
return mText != null ? mText.mHint : null;
}
+ @Nullable
@Override
public String getHintIdEntry() {
return mHintIdEntry;
@@ -391,11 +401,13 @@ public final class ViewNode extends AssistStructure.ViewNode {
return mText != null ? mText.mTextStyle : 0;
}
+ @Nullable
@Override
public int[] getTextLineCharOffsets() {
return mText != null ? mText.mLineCharOffsets : null;
}
+ @Nullable
@Override
public int[] getTextLineBaselines() {
return mText != null ? mText.mLineBaselines : null;
@@ -426,6 +438,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
return mMaxLength;
}
+ @Nullable
@Override
public String getTextIdEntry() {
return mTextIdEntry;
@@ -451,6 +464,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
return mAutofillOptions;
}
+ @Nullable
@Override
public LocaleList getLocaleList() {
return mLocaleList;