Merge branch 'master' of https://googleplex-android.googlesource.com/_direct/platform/frameworks/base
diff --git a/core/java/android/app/SharedPreferencesImpl.java b/core/java/android/app/SharedPreferencesImpl.java
index 4427ce1..e617553 100644
--- a/core/java/android/app/SharedPreferencesImpl.java
+++ b/core/java/android/app/SharedPreferencesImpl.java
@@ -16,6 +16,7 @@
package android.app;
+import android.annotation.Nullable;
import android.content.SharedPreferences;
import android.os.FileUtils;
import android.os.Looper;
@@ -217,7 +218,8 @@
}
}
- public String getString(String key, String defValue) {
+ @Nullable
+ public String getString(String key, @Nullable String defValue) {
synchronized (this) {
awaitLoadedLocked();
String v = (String)mMap.get(key);
@@ -225,7 +227,8 @@
}
}
- public Set<String> getStringSet(String key, Set<String> defValues) {
+ @Nullable
+ public Set<String> getStringSet(String key, @Nullable Set<String> defValues) {
synchronized (this) {
awaitLoadedLocked();
Set<String> v = (Set<String>) mMap.get(key);
@@ -303,13 +306,13 @@
private final Map<String, Object> mModified = Maps.newHashMap();
private boolean mClear = false;
- public Editor putString(String key, String value) {
+ public Editor putString(String key, @Nullable String value) {
synchronized (this) {
mModified.put(key, value);
return this;
}
}
- public Editor putStringSet(String key, Set<String> values) {
+ public Editor putStringSet(String key, @Nullable Set<String> values) {
synchronized (this) {
mModified.put(key,
(values == null) ? null : new HashSet<String>(values));
diff --git a/core/java/android/content/SharedPreferences.java b/core/java/android/content/SharedPreferences.java
index 46c9234..cd32dae 100644
--- a/core/java/android/content/SharedPreferences.java
+++ b/core/java/android/content/SharedPreferences.java
@@ -16,6 +16,8 @@
package android.content;
+import android.annotation.Nullable;
+
import java.util.Map;
import java.util.Set;
@@ -78,7 +80,7 @@
* @return Returns a reference to the same Editor object, so you can
* chain put calls together.
*/
- Editor putString(String key, String value);
+ Editor putString(String key, @Nullable String value);
/**
* Set a set of String values in the preferences editor, to be written
@@ -91,7 +93,7 @@
* @return Returns a reference to the same Editor object, so you can
* chain put calls together.
*/
- Editor putStringSet(String key, Set<String> values);
+ Editor putStringSet(String key, @Nullable Set<String> values);
/**
* Set an int value in the preferences editor, to be written back once
@@ -254,7 +256,8 @@
*
* @throws ClassCastException
*/
- String getString(String key, String defValue);
+ @Nullable
+ String getString(String key, @Nullable String defValue);
/**
* Retrieve a set of String values from the preferences.
@@ -272,7 +275,8 @@
*
* @throws ClassCastException
*/
- Set<String> getStringSet(String key, Set<String> defValues);
+ @Nullable
+ Set<String> getStringSet(String key, @Nullable Set<String> defValues);
/**
* Retrieve an int value from the preferences.