OSDN Git Service

Add nullability annotation to Theme#getAttributeResolutionStack
authorAurimas Liutikas <aurimas@google.com>
Thu, 28 Feb 2019 19:16:06 +0000 (11:16 -0800)
committerAurimas Liutikas <aurimas@google.com>
Fri, 1 Mar 2019 18:04:21 +0000 (10:04 -0800)
Bug: 126700353
Test: None
Change-Id: I50979abbdffbf347f8ee2ac85df119fe76abf841

api/current.txt
core/java/android/content/res/Resources.java
core/java/android/content/res/ResourcesImpl.java

index 6de1383..8c485cb 100644 (file)
@@ -12335,7 +12335,7 @@ package android.content.res {
   public final class Resources.Theme {
     method public void applyStyle(int, boolean);
     method public void dump(int, String, String);
-    method public int[] getAttributeResolutionStack(@AttrRes int, @StyleRes int, @StyleRes int);
+    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int, @StyleRes int, @StyleRes int);
     method public int getChangingConfigurations();
     method public android.graphics.drawable.Drawable getDrawable(@DrawableRes int) throws android.content.res.Resources.NotFoundException;
     method @StyleRes public int getExplicitStyle(@Nullable android.util.AttributeSet);
index a2ae994..c855d45 100644 (file)
@@ -1782,10 +1782,16 @@ public class Resources {
          * @param explicitStyleRes A resource identifier of an explicit style resource.
          * @return ordered list of resource ID that are considered when resolving attribute values.
          */
+        @NonNull
         public int[] getAttributeResolutionStack(@AttrRes int defStyleAttr,
                 @StyleRes int defStyleRes, @StyleRes int explicitStyleRes) {
-            return mThemeImpl.getAttributeResolutionStack(
+            int[] stack = mThemeImpl.getAttributeResolutionStack(
                     defStyleAttr, defStyleRes, explicitStyleRes);
+            if (stack == null) {
+                return new int[0];
+            } else {
+                return stack;
+            }
         }
     }
 
index da064c9..565cd33 100644 (file)
@@ -1507,6 +1507,7 @@ public class ResourcesImpl {
          * @param explicitStyleRes A resource identifier of an explicit style resource.
          * @return ordered list of resource ID that are considered when resolving attribute values.
          */
+        @Nullable
         public int[] getAttributeResolutionStack(@AttrRes int defStyleAttr,
                 @StyleRes int defStyleRes, @StyleRes int explicitStyleRes) {
             synchronized (mKey) {