From ff32f353f8f6974de80cd6979ce3047dc7133d96 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Thu, 18 Jul 2013 17:31:13 -0700 Subject: Fix issue #9925269: Naver app crashes on launch No comment. Change-Id: I084cbbf21cacdce179c11528b7217fdc6006dceb --- core/java/android/app/ContextImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/java/android/app/ContextImpl.java') diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 6a0fbd5..141d12d 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); -- cgit v1.1