diff options
author | Christopher Tate <ctate@google.com> | 2013-10-13 17:34:49 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2013-10-13 18:36:08 -0700 |
commit | 0da1357f9827b6a2df24a449dbb8eba12484095c (patch) | |
tree | 12c79b0be416e0b9e1bdf672d341eb718b3dee00 /packages/SettingsProvider/src/com/android/providers/settings | |
parent | ce6d9066b666cb065821163036bdabc9ec8081dd (diff) | |
download | frameworks_base-0da1357f9827b6a2df24a449dbb8eba12484095c.zip frameworks_base-0da1357f9827b6a2df24a449dbb8eba12484095c.tar.gz frameworks_base-0da1357f9827b6a2df24a449dbb8eba12484095c.tar.bz2 |
Log noisily on uid vs user-handle confusion in the settings provider
Make sure that we catch any attempts to pass a uid to the settings
provider's "for this user" code paths.
Bug 11087584
Bug 11208808
Change-Id: I1cc025b2aade9072b4a61b4499d02c82b0085fa2
Diffstat (limited to 'packages/SettingsProvider/src/com/android/providers/settings')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index bc02b0d..158227f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -47,6 +47,7 @@ import android.os.Bundle; import android.os.DropBoxManager; import android.os.FileObserver; import android.os.ParcelFileDescriptor; +import android.os.Process; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; @@ -62,6 +63,8 @@ public class SettingsProvider extends ContentProvider { private static final String TAG = "SettingsProvider"; private static final boolean LOCAL_LOGV = false; + private static final boolean USER_CHECK_THROWS = true; + private static final String TABLE_SYSTEM = "system"; private static final String TABLE_SECURE = "secure"; private static final String TABLE_GLOBAL = "global"; @@ -522,6 +525,14 @@ public class SettingsProvider extends ContentProvider { // Lazy initialize the database helper and caches for this user, if necessary private DatabaseHelper getOrEstablishDatabase(int callingUser) { + if (callingUser >= Process.SYSTEM_UID) { + if (USER_CHECK_THROWS) { + throw new IllegalArgumentException("Uid rather than user handle: " + callingUser); + } else { + Slog.wtf(TAG, "establish db for uid rather than user: " + callingUser); + } + } + long oldId = Binder.clearCallingIdentity(); try { DatabaseHelper dbHelper = mOpenHelpers.get(callingUser); |