summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/ContextImpl.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 7180408..eeee57d 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -16,6 +16,7 @@
package android.app;
+import android.os.Build;
import com.android.internal.policy.PolicyManager;
import com.android.internal.util.Preconditions;
@@ -706,6 +707,16 @@ class ContextImpl extends Context {
sSharedPrefs.put(packageName, packagePrefs);
}
+ // At least one application in the world actually passes in a null
+ // name. This happened to work because when we generated the file name
+ // we would stringify it to "null.xml". Nice.
+ if (mPackageInfo.getApplicationInfo().targetSdkVersion <
+ Build.VERSION_CODES.KEY_LIME_PIE) {
+ if (name == null) {
+ name = "null";
+ }
+ }
+
sp = packagePrefs.get(name);
if (sp == null) {
File prefsFile = getSharedPrefsFile(name);