diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-12-14 11:52:13 -0800 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@android.com> | 2010-12-14 16:27:21 -0800 |
commit | 4e920f70f38d52d3a74c6a3133388a2e2cb6c175 (patch) | |
tree | 89295eea67ed7453471b0119323f16a0b5d78f8c /core/java/android/app/ContextImpl.java | |
parent | e464fba4a4bbaef40b6b1a4c0f06969484c38edb (diff) | |
download | frameworks_base-4e920f70f38d52d3a74c6a3133388a2e2cb6c175.zip frameworks_base-4e920f70f38d52d3a74c6a3133388a2e2cb6c175.tar.gz frameworks_base-4e920f70f38d52d3a74c6a3133388a2e2cb6c175.tar.bz2 |
Add MODE_MULTI_PROCESS flag to Context.getSharedPreferences()
Also, changes to make this testable with CTS:
-- special PENALTY_DEATH StrictMode fast path that doesn't use
the Looper idling to "time" the violation. Only used when
death is the only violation,
-- make PENALTY_DEATH throw a RuntimeException instead of
killing its process with a signal. this means we can catch
it in CTS tests, but it's also more consistent with
PENALTY_NETWORK_DEATH in Honeycomb.
-- make FileUtils.getFileStatus() invoke StrictMode, which isn't
(yet?) aware of I/O in native code. so help it out.
CTS test for MODE_MULTI_PROCESS is in I6154edab
Change-Id: Icf93f9dfb0ece06b16781e4803dd2c17df3cf1b3
Diffstat (limited to 'core/java/android/app/ContextImpl.java')
-rw-r--r-- | core/java/android/app/ContextImpl.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 083612e..72f7286 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -554,10 +554,13 @@ class ContextImpl extends Context { return sp; } } - // If somebody else (some other process) changed the prefs - // file behind our back, we reload it. This has been the - // historical (if undocumented) behavior. - sp.startReloadIfChangedUnexpectedly(); + if ((mode & Context.MODE_MULTI_PROCESS) != 0 || + getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB) { + // If somebody else (some other process) changed the prefs + // file behind our back, we reload it. This has been the + // historical (if undocumented) behavior. + sp.startReloadIfChangedUnexpectedly(); + } return sp; } |