Loading core/java/android/app/SharedPreferencesImpl.java +7 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.app; import android.annotation.Nullable; import android.content.SharedPreferences; import android.os.FileUtils; import android.os.Looper; Loading Loading @@ -217,7 +218,8 @@ final class SharedPreferencesImpl implements SharedPreferences { } } 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); Loading @@ -225,7 +227,8 @@ final class SharedPreferencesImpl implements SharedPreferences { } } 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); Loading Loading @@ -303,13 +306,13 @@ final class SharedPreferencesImpl implements SharedPreferences { 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)); Loading core/java/android/content/SharedPreferences.java +8 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.content; import android.annotation.Nullable; import java.util.Map; import java.util.Set; Loading Loading @@ -78,7 +80,7 @@ public interface SharedPreferences { * @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 Loading @@ -91,7 +93,7 @@ public interface SharedPreferences { * @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 Loading Loading @@ -254,7 +256,8 @@ public interface SharedPreferences { * * @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. Loading @@ -272,7 +275,8 @@ public interface SharedPreferences { * * @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. Loading Loading
core/java/android/app/SharedPreferencesImpl.java +7 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.app; import android.annotation.Nullable; import android.content.SharedPreferences; import android.os.FileUtils; import android.os.Looper; Loading Loading @@ -217,7 +218,8 @@ final class SharedPreferencesImpl implements SharedPreferences { } } 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); Loading @@ -225,7 +227,8 @@ final class SharedPreferencesImpl implements SharedPreferences { } } 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); Loading Loading @@ -303,13 +306,13 @@ final class SharedPreferencesImpl implements SharedPreferences { 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)); Loading
core/java/android/content/SharedPreferences.java +8 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.content; import android.annotation.Nullable; import java.util.Map; import java.util.Set; Loading Loading @@ -78,7 +80,7 @@ public interface SharedPreferences { * @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 Loading @@ -91,7 +93,7 @@ public interface SharedPreferences { * @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 Loading Loading @@ -254,7 +256,8 @@ public interface SharedPreferences { * * @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. Loading @@ -272,7 +275,8 @@ public interface SharedPreferences { * * @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. Loading