diff options
author | Scott Kennedy <skennedy@google.com> | 2015-03-01 17:10:10 -0800 |
---|---|---|
committer | Scott Kennedy <skennedy@google.com> | 2015-03-01 17:19:29 -0800 |
commit | c6a65dff3d9ed3e75f9f4f5abbf24e3d10bdba8b (patch) | |
tree | f198b7150ead227af28c7f88667bc85a4441be5c /core/java | |
parent | 3062e57072145ba5e71ba8b2cf565d3453db04a7 (diff) | |
download | frameworks_base-c6a65dff3d9ed3e75f9f4f5abbf24e3d10bdba8b.zip frameworks_base-c6a65dff3d9ed3e75f9f4f5abbf24e3d10bdba8b.tar.gz frameworks_base-c6a65dff3d9ed3e75f9f4f5abbf24e3d10bdba8b.tar.bz2 |
Annotate Bundle with @Nullable
Change-Id: Ide572124deea8271ca5c47009acb62603d644363
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/os/BaseBundle.java | 110 | ||||
-rw-r--r-- | core/java/android/os/Bundle.java | 113 | ||||
-rw-r--r-- | core/java/android/os/PersistableBundle.java | 6 |
3 files changed, 135 insertions, 94 deletions
diff --git a/core/java/android/os/BaseBundle.java b/core/java/android/os/BaseBundle.java index 1b02141..7f8c95b 100644 --- a/core/java/android/os/BaseBundle.java +++ b/core/java/android/os/BaseBundle.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.Nullable; import android.util.ArrayMap; import android.util.Log; @@ -63,7 +64,7 @@ public class BaseBundle { * inside of the Bundle. * @param capacity Initial size of the ArrayMap. */ - BaseBundle(ClassLoader loader, int capacity) { + BaseBundle(@Nullable ClassLoader loader, int capacity) { mMap = capacity > 0 ? new ArrayMap<String, Object>(capacity) : new ArrayMap<String, Object>(); mClassLoader = loader == null ? getClass().getClassLoader() : loader; @@ -276,6 +277,7 @@ public class BaseBundle { * @param key a String key * @return an Object, or null */ + @Nullable public Object get(String key) { unparcel(); return mMap.get(key); @@ -327,9 +329,9 @@ public class BaseBundle { * any existing value for the given key. Either key or value may be null. * * @param key a String, or null - * @param value a Boolean, or null + * @param value a boolean */ - public void putBoolean(String key, boolean value) { + public void putBoolean(@Nullable String key, boolean value) { unparcel(); mMap.put(key, value); } @@ -341,7 +343,7 @@ public class BaseBundle { * @param key a String, or null * @param value a byte */ - void putByte(String key, byte value) { + void putByte(@Nullable String key, byte value) { unparcel(); mMap.put(key, value); } @@ -351,9 +353,9 @@ public class BaseBundle { * any existing value for the given key. * * @param key a String, or null - * @param value a char, or null + * @param value a char */ - void putChar(String key, char value) { + void putChar(@Nullable String key, char value) { unparcel(); mMap.put(key, value); } @@ -365,7 +367,7 @@ public class BaseBundle { * @param key a String, or null * @param value a short */ - void putShort(String key, short value) { + void putShort(@Nullable String key, short value) { unparcel(); mMap.put(key, value); } @@ -375,9 +377,9 @@ public class BaseBundle { * any existing value for the given key. * * @param key a String, or null - * @param value an int, or null + * @param value an int */ - public void putInt(String key, int value) { + public void putInt(@Nullable String key, int value) { unparcel(); mMap.put(key, value); } @@ -389,7 +391,7 @@ public class BaseBundle { * @param key a String, or null * @param value a long */ - public void putLong(String key, long value) { + public void putLong(@Nullable String key, long value) { unparcel(); mMap.put(key, value); } @@ -401,7 +403,7 @@ public class BaseBundle { * @param key a String, or null * @param value a float */ - void putFloat(String key, float value) { + void putFloat(@Nullable String key, float value) { unparcel(); mMap.put(key, value); } @@ -413,7 +415,7 @@ public class BaseBundle { * @param key a String, or null * @param value a double */ - public void putDouble(String key, double value) { + public void putDouble(@Nullable String key, double value) { unparcel(); mMap.put(key, value); } @@ -425,7 +427,7 @@ public class BaseBundle { * @param key a String, or null * @param value a String, or null */ - public void putString(String key, String value) { + public void putString(@Nullable String key, @Nullable String value) { unparcel(); mMap.put(key, value); } @@ -437,7 +439,7 @@ public class BaseBundle { * @param key a String, or null * @param value a CharSequence, or null */ - void putCharSequence(String key, CharSequence value) { + void putCharSequence(@Nullable String key, @Nullable CharSequence value) { unparcel(); mMap.put(key, value); } @@ -449,7 +451,7 @@ public class BaseBundle { * @param key a String, or null * @param value an ArrayList<Integer> object, or null */ - void putIntegerArrayList(String key, ArrayList<Integer> value) { + void putIntegerArrayList(@Nullable String key, @Nullable ArrayList<Integer> value) { unparcel(); mMap.put(key, value); } @@ -461,7 +463,7 @@ public class BaseBundle { * @param key a String, or null * @param value an ArrayList<String> object, or null */ - void putStringArrayList(String key, ArrayList<String> value) { + void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) { unparcel(); mMap.put(key, value); } @@ -473,7 +475,7 @@ public class BaseBundle { * @param key a String, or null * @param value an ArrayList<CharSequence> object, or null */ - void putCharSequenceArrayList(String key, ArrayList<CharSequence> value) { + void putCharSequenceArrayList(@Nullable String key, @Nullable ArrayList<CharSequence> value) { unparcel(); mMap.put(key, value); } @@ -485,7 +487,7 @@ public class BaseBundle { * @param key a String, or null * @param value a Serializable object, or null */ - void putSerializable(String key, Serializable value) { + void putSerializable(@Nullable String key, @Nullable Serializable value) { unparcel(); mMap.put(key, value); } @@ -497,7 +499,7 @@ public class BaseBundle { * @param key a String, or null * @param value a boolean array object, or null */ - public void putBooleanArray(String key, boolean[] value) { + public void putBooleanArray(@Nullable String key, @Nullable boolean[] value) { unparcel(); mMap.put(key, value); } @@ -509,7 +511,7 @@ public class BaseBundle { * @param key a String, or null * @param value a byte array object, or null */ - void putByteArray(String key, byte[] value) { + void putByteArray(@Nullable String key, @Nullable byte[] value) { unparcel(); mMap.put(key, value); } @@ -521,7 +523,7 @@ public class BaseBundle { * @param key a String, or null * @param value a short array object, or null */ - void putShortArray(String key, short[] value) { + void putShortArray(@Nullable String key, @Nullable short[] value) { unparcel(); mMap.put(key, value); } @@ -533,7 +535,7 @@ public class BaseBundle { * @param key a String, or null * @param value a char array object, or null */ - void putCharArray(String key, char[] value) { + void putCharArray(@Nullable String key, @Nullable char[] value) { unparcel(); mMap.put(key, value); } @@ -545,7 +547,7 @@ public class BaseBundle { * @param key a String, or null * @param value an int array object, or null */ - public void putIntArray(String key, int[] value) { + public void putIntArray(@Nullable String key, @Nullable int[] value) { unparcel(); mMap.put(key, value); } @@ -557,7 +559,7 @@ public class BaseBundle { * @param key a String, or null * @param value a long array object, or null */ - public void putLongArray(String key, long[] value) { + public void putLongArray(@Nullable String key, @Nullable long[] value) { unparcel(); mMap.put(key, value); } @@ -569,7 +571,7 @@ public class BaseBundle { * @param key a String, or null * @param value a float array object, or null */ - void putFloatArray(String key, float[] value) { + void putFloatArray(@Nullable String key, @Nullable float[] value) { unparcel(); mMap.put(key, value); } @@ -581,7 +583,7 @@ public class BaseBundle { * @param key a String, or null * @param value a double array object, or null */ - public void putDoubleArray(String key, double[] value) { + public void putDoubleArray(@Nullable String key, @Nullable double[] value) { unparcel(); mMap.put(key, value); } @@ -593,7 +595,7 @@ public class BaseBundle { * @param key a String, or null * @param value a String array object, or null */ - public void putStringArray(String key, String[] value) { + public void putStringArray(@Nullable String key, @Nullable String[] value) { unparcel(); mMap.put(key, value); } @@ -605,7 +607,7 @@ public class BaseBundle { * @param key a String, or null * @param value a CharSequence array object, or null */ - void putCharSequenceArray(String key, CharSequence[] value) { + void putCharSequenceArray(@Nullable String key, @Nullable CharSequence[] value) { unparcel(); mMap.put(key, value); } @@ -914,7 +916,8 @@ public class BaseBundle { * @param key a String, or null * @return a String value, or null */ - public String getString(String key) { + @Nullable + public String getString(@Nullable String key) { unparcel(); final Object o = mMap.get(key); try { @@ -936,7 +939,7 @@ public class BaseBundle { * @return the String value associated with the given key, or defaultValue * if no valid String object is currently mapped to that key. */ - public String getString(String key, String defaultValue) { + public String getString(@Nullable String key, String defaultValue) { final String s = getString(key); return (s == null) ? defaultValue : s; } @@ -949,7 +952,8 @@ public class BaseBundle { * @param key a String, or null * @return a CharSequence value, or null */ - CharSequence getCharSequence(String key) { + @Nullable + CharSequence getCharSequence(@Nullable String key) { unparcel(); final Object o = mMap.get(key); try { @@ -971,7 +975,7 @@ public class BaseBundle { * @return the CharSequence value associated with the given key, or defaultValue * if no valid CharSequence object is currently mapped to that key. */ - CharSequence getCharSequence(String key, CharSequence defaultValue) { + CharSequence getCharSequence(@Nullable String key, CharSequence defaultValue) { final CharSequence cs = getCharSequence(key); return (cs == null) ? defaultValue : cs; } @@ -984,7 +988,8 @@ public class BaseBundle { * @param key a String, or null * @return a Serializable value, or null */ - Serializable getSerializable(String key) { + @Nullable + Serializable getSerializable(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1006,7 +1011,8 @@ public class BaseBundle { * @param key a String, or null * @return an ArrayList<String> value, or null */ - ArrayList<Integer> getIntegerArrayList(String key) { + @Nullable + ArrayList<Integer> getIntegerArrayList(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1028,7 +1034,8 @@ public class BaseBundle { * @param key a String, or null * @return an ArrayList<String> value, or null */ - ArrayList<String> getStringArrayList(String key) { + @Nullable + ArrayList<String> getStringArrayList(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1050,7 +1057,8 @@ public class BaseBundle { * @param key a String, or null * @return an ArrayList<CharSequence> value, or null */ - ArrayList<CharSequence> getCharSequenceArrayList(String key) { + @Nullable + ArrayList<CharSequence> getCharSequenceArrayList(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1072,7 +1080,8 @@ public class BaseBundle { * @param key a String, or null * @return a boolean[] value, or null */ - public boolean[] getBooleanArray(String key) { + @Nullable + public boolean[] getBooleanArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1094,7 +1103,8 @@ public class BaseBundle { * @param key a String, or null * @return a byte[] value, or null */ - byte[] getByteArray(String key) { + @Nullable + byte[] getByteArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1116,7 +1126,8 @@ public class BaseBundle { * @param key a String, or null * @return a short[] value, or null */ - short[] getShortArray(String key) { + @Nullable + short[] getShortArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1138,7 +1149,8 @@ public class BaseBundle { * @param key a String, or null * @return a char[] value, or null */ - char[] getCharArray(String key) { + @Nullable + char[] getCharArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1160,7 +1172,8 @@ public class BaseBundle { * @param key a String, or null * @return an int[] value, or null */ - public int[] getIntArray(String key) { + @Nullable + public int[] getIntArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1182,7 +1195,8 @@ public class BaseBundle { * @param key a String, or null * @return a long[] value, or null */ - public long[] getLongArray(String key) { + @Nullable + public long[] getLongArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1204,7 +1218,8 @@ public class BaseBundle { * @param key a String, or null * @return a float[] value, or null */ - float[] getFloatArray(String key) { + @Nullable + float[] getFloatArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1226,7 +1241,8 @@ public class BaseBundle { * @param key a String, or null * @return a double[] value, or null */ - public double[] getDoubleArray(String key) { + @Nullable + public double[] getDoubleArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1248,7 +1264,8 @@ public class BaseBundle { * @param key a String, or null * @return a String[] value, or null */ - public String[] getStringArray(String key) { + @Nullable + public String[] getStringArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -1270,7 +1287,8 @@ public class BaseBundle { * @param key a String, or null * @return a CharSequence[] value, or null */ - CharSequence[] getCharSequenceArray(String key) { + @Nullable + CharSequence[] getCharSequenceArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java index c5c5372..4c02ca2 100644 --- a/core/java/android/os/Bundle.java +++ b/core/java/android/os/Bundle.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.Nullable; import android.util.ArrayMap; import android.util.Size; import android.util.SizeF; @@ -259,7 +260,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a byte */ @Override - public void putByte(String key, byte value) { + public void putByte(@Nullable String key, byte value) { super.putByte(key, value); } @@ -268,10 +269,10 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * any existing value for the given key. * * @param key a String, or null - * @param value a char, or null + * @param value a char */ @Override - public void putChar(String key, char value) { + public void putChar(@Nullable String key, char value) { super.putChar(key, value); } @@ -283,7 +284,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a short */ @Override - public void putShort(String key, short value) { + public void putShort(@Nullable String key, short value) { super.putShort(key, value); } @@ -295,7 +296,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a float */ @Override - public void putFloat(String key, float value) { + public void putFloat(@Nullable String key, float value) { super.putFloat(key, value); } @@ -307,7 +308,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a CharSequence, or null */ @Override - public void putCharSequence(String key, CharSequence value) { + public void putCharSequence(@Nullable String key, @Nullable CharSequence value) { super.putCharSequence(key, value); } @@ -318,7 +319,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value a Parcelable object, or null */ - public void putParcelable(String key, Parcelable value) { + public void putParcelable(@Nullable String key, @Nullable Parcelable value) { unparcel(); mMap.put(key, value); mFdsKnown = false; @@ -331,7 +332,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value a Size object, or null */ - public void putSize(String key, Size value) { + public void putSize(@Nullable String key, @Nullable Size value) { unparcel(); mMap.put(key, value); } @@ -343,7 +344,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value a SizeF object, or null */ - public void putSizeF(String key, SizeF value) { + public void putSizeF(@Nullable String key, @Nullable SizeF value) { unparcel(); mMap.put(key, value); } @@ -356,7 +357,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value an array of Parcelable objects, or null */ - public void putParcelableArray(String key, Parcelable[] value) { + public void putParcelableArray(@Nullable String key, @Nullable Parcelable[] value) { unparcel(); mMap.put(key, value); mFdsKnown = false; @@ -370,8 +371,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value an ArrayList of Parcelable objects, or null */ - public void putParcelableArrayList(String key, - ArrayList<? extends Parcelable> value) { + public void putParcelableArrayList(@Nullable String key, + @Nullable ArrayList<? extends Parcelable> value) { unparcel(); mMap.put(key, value); mFdsKnown = false; @@ -392,8 +393,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value a SparseArray of Parcelable objects, or null */ - public void putSparseParcelableArray(String key, - SparseArray<? extends Parcelable> value) { + public void putSparseParcelableArray(@Nullable String key, + @Nullable SparseArray<? extends Parcelable> value) { unparcel(); mMap.put(key, value); mFdsKnown = false; @@ -407,7 +408,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value an ArrayList<Integer> object, or null */ @Override - public void putIntegerArrayList(String key, ArrayList<Integer> value) { + public void putIntegerArrayList(@Nullable String key, @Nullable ArrayList<Integer> value) { super.putIntegerArrayList(key, value); } @@ -419,7 +420,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value an ArrayList<String> object, or null */ @Override - public void putStringArrayList(String key, ArrayList<String> value) { + public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) { super.putStringArrayList(key, value); } @@ -431,7 +432,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value an ArrayList<CharSequence> object, or null */ @Override - public void putCharSequenceArrayList(String key, ArrayList<CharSequence> value) { + public void putCharSequenceArrayList(@Nullable String key, + @Nullable ArrayList<CharSequence> value) { super.putCharSequenceArrayList(key, value); } @@ -443,7 +445,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a Serializable object, or null */ @Override - public void putSerializable(String key, Serializable value) { + public void putSerializable(@Nullable String key, @Nullable Serializable value) { super.putSerializable(key, value); } @@ -455,7 +457,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a byte array object, or null */ @Override - public void putByteArray(String key, byte[] value) { + public void putByteArray(@Nullable String key, @Nullable byte[] value) { super.putByteArray(key, value); } @@ -467,7 +469,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a short array object, or null */ @Override - public void putShortArray(String key, short[] value) { + public void putShortArray(@Nullable String key, @Nullable short[] value) { super.putShortArray(key, value); } @@ -479,7 +481,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a char array object, or null */ @Override - public void putCharArray(String key, char[] value) { + public void putCharArray(@Nullable String key, @Nullable char[] value) { super.putCharArray(key, value); } @@ -491,7 +493,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a float array object, or null */ @Override - public void putFloatArray(String key, float[] value) { + public void putFloatArray(@Nullable String key, @Nullable float[] value) { super.putFloatArray(key, value); } @@ -503,7 +505,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param value a CharSequence array object, or null */ @Override - public void putCharSequenceArray(String key, CharSequence[] value) { + public void putCharSequenceArray(@Nullable String key, @Nullable CharSequence[] value) { super.putCharSequenceArray(key, value); } @@ -514,7 +516,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value a Bundle object, or null */ - public void putBundle(String key, Bundle value) { + public void putBundle(@Nullable String key, @Nullable Bundle value) { unparcel(); mMap.put(key, value); } @@ -533,7 +535,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @param value an IBinder object, or null */ - public void putBinder(String key, IBinder value) { + public void putBinder(@Nullable String key, @Nullable IBinder value) { unparcel(); mMap.put(key, value); } @@ -549,7 +551,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @hide This is the old name of the function. */ @Deprecated - public void putIBinder(String key, IBinder value) { + public void putIBinder(@Nullable String key, @Nullable IBinder value) { unparcel(); mMap.put(key, value); } @@ -663,7 +665,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a CharSequence value, or null */ @Override - public CharSequence getCharSequence(String key) { + @Nullable + public CharSequence getCharSequence(@Nullable String key) { return super.getCharSequence(key); } @@ -679,7 +682,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * if no valid CharSequence object is currently mapped to that key. */ @Override - public CharSequence getCharSequence(String key, CharSequence defaultValue) { + public CharSequence getCharSequence(@Nullable String key, CharSequence defaultValue) { return super.getCharSequence(key, defaultValue); } @@ -691,7 +694,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return a Size value, or null */ - public Size getSize(String key) { + @Nullable + public Size getSize(@Nullable String key) { unparcel(); final Object o = mMap.get(key); try { @@ -710,7 +714,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return a Size value, or null */ - public SizeF getSizeF(String key) { + @Nullable + public SizeF getSizeF(@Nullable String key) { unparcel(); final Object o = mMap.get(key); try { @@ -729,7 +734,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return a Bundle value, or null */ - public Bundle getBundle(String key) { + @Nullable + public Bundle getBundle(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -751,7 +757,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return a Parcelable value, or null */ - public <T extends Parcelable> T getParcelable(String key) { + @Nullable + public <T extends Parcelable> T getParcelable(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -773,7 +780,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return a Parcelable[] value, or null */ - public Parcelable[] getParcelableArray(String key) { + @Nullable + public Parcelable[] getParcelableArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -795,7 +803,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return an ArrayList<T> value, or null */ - public <T extends Parcelable> ArrayList<T> getParcelableArrayList(String key) { + @Nullable + public <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -818,7 +827,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * * @return a SparseArray of T values, or null */ - public <T extends Parcelable> SparseArray<T> getSparseParcelableArray(String key) { + @Nullable + public <T extends Parcelable> SparseArray<T> getSparseParcelableArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -841,7 +851,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a Serializable value, or null */ @Override - public Serializable getSerializable(String key) { + @Nullable + public Serializable getSerializable(@Nullable String key) { return super.getSerializable(key); } @@ -854,7 +865,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return an ArrayList<String> value, or null */ @Override - public ArrayList<Integer> getIntegerArrayList(String key) { + @Nullable + public ArrayList<Integer> getIntegerArrayList(@Nullable String key) { return super.getIntegerArrayList(key); } @@ -867,7 +879,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return an ArrayList<String> value, or null */ @Override - public ArrayList<String> getStringArrayList(String key) { + @Nullable + public ArrayList<String> getStringArrayList(@Nullable String key) { return super.getStringArrayList(key); } @@ -880,7 +893,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return an ArrayList<CharSequence> value, or null */ @Override - public ArrayList<CharSequence> getCharSequenceArrayList(String key) { + @Nullable + public ArrayList<CharSequence> getCharSequenceArrayList(@Nullable String key) { return super.getCharSequenceArrayList(key); } @@ -893,7 +907,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a byte[] value, or null */ @Override - public byte[] getByteArray(String key) { + @Nullable + public byte[] getByteArray(@Nullable String key) { return super.getByteArray(key); } @@ -906,7 +921,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a short[] value, or null */ @Override - public short[] getShortArray(String key) { + @Nullable + public short[] getShortArray(@Nullable String key) { return super.getShortArray(key); } @@ -919,7 +935,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a char[] value, or null */ @Override - public char[] getCharArray(String key) { + @Nullable + public char[] getCharArray(@Nullable String key) { return super.getCharArray(key); } @@ -932,7 +949,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a float[] value, or null */ @Override - public float[] getFloatArray(String key) { + @Nullable + public float[] getFloatArray(@Nullable String key) { return super.getFloatArray(key); } @@ -945,7 +963,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @return a CharSequence[] value, or null */ @Override - public CharSequence[] getCharSequenceArray(String key) { + @Nullable + public CharSequence[] getCharSequenceArray(@Nullable String key) { return super.getCharSequenceArray(key); } @@ -957,7 +976,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @param key a String, or null * @return an IBinder value, or null */ - public IBinder getBinder(String key) { + @Nullable + public IBinder getBinder(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { @@ -983,7 +1003,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { * @hide This is the old name of the function. */ @Deprecated - public IBinder getIBinder(String key) { + @Nullable + public IBinder getIBinder(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { diff --git a/core/java/android/os/PersistableBundle.java b/core/java/android/os/PersistableBundle.java index 3a44428..a467c87 100644 --- a/core/java/android/os/PersistableBundle.java +++ b/core/java/android/os/PersistableBundle.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.Nullable; import android.util.ArrayMap; import com.android.internal.util.XmlUtils; import org.xmlpull.v1.XmlPullParser; @@ -135,7 +136,7 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa * @param key a String, or null * @param value a Bundle object, or null */ - public void putPersistableBundle(String key, PersistableBundle value) { + public void putPersistableBundle(@Nullable String key, @Nullable PersistableBundle value) { unparcel(); mMap.put(key, value); } @@ -148,7 +149,8 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa * @param key a String, or null * @return a Bundle value, or null */ - public PersistableBundle getPersistableBundle(String key) { + @Nullable + public PersistableBundle getPersistableBundle(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { |