am 5c742333: am b83bba7c: Merge "Log noisily on uid vs user-handle confusion in the settings provider" into klp-dev

* commit '5c74233315fd3b4ff9710624996b2312bbbaca5e':
  Log noisily on uid vs user-handle confusion in the settings provider
This commit is contained in:
Christopher Tate
2013-10-14 19:00:03 -07:00
committed by Android Git Automerger

View File

@@ -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);