am e1f02ef0: Merge "Miscellaneous fixes for Settings" into jb-mr1-dev
* commit 'e1f02ef080e5046e03b4b3b7bb64e22e7790b707': Miscellaneous fixes for Settings
This commit is contained in:
@@ -739,6 +739,7 @@ public final class Settings {
|
||||
try {
|
||||
Bundle arg = new Bundle();
|
||||
arg.putString(Settings.NameValueTable.VALUE, value);
|
||||
arg.putInt(CALL_METHOD_USER_KEY, userHandle);
|
||||
IContentProvider cp = lazyGetProvider(cr);
|
||||
cp.call(mCallSetCommand, name, arg);
|
||||
} catch (RemoteException e) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.HashSet;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.backup.BackupManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -60,7 +61,7 @@ import android.util.SparseArray;
|
||||
|
||||
public class SettingsProvider extends ContentProvider {
|
||||
private static final String TAG = "SettingsProvider";
|
||||
private static final boolean LOCAL_LOGV = false;
|
||||
private static final boolean LOCAL_LOGV = true;
|
||||
|
||||
private static final String TABLE_SYSTEM = "system";
|
||||
private static final String TABLE_SECURE = "secure";
|
||||
@@ -621,24 +622,10 @@ public class SettingsProvider extends ContentProvider {
|
||||
if (args != null) {
|
||||
int reqUser = args.getInt(Settings.CALL_METHOD_USER_KEY, callingUser);
|
||||
if (reqUser != callingUser) {
|
||||
getContext().enforceCallingPermission(
|
||||
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
|
||||
"Not permitted to access settings for other users");
|
||||
if (reqUser == UserHandle.USER_CURRENT) {
|
||||
try {
|
||||
reqUser = ActivityManagerNative.getDefault().getCurrentUser().id;
|
||||
} catch (RemoteException e) {
|
||||
// can't happen
|
||||
}
|
||||
if (LOCAL_LOGV) {
|
||||
Slog.v(TAG, " USER_CURRENT resolved to " + reqUser);
|
||||
}
|
||||
}
|
||||
if (reqUser < 0) {
|
||||
throw new IllegalArgumentException("Bad user handle " + reqUser);
|
||||
}
|
||||
callingUser = reqUser;
|
||||
if (LOCAL_LOGV) Slog.v(TAG, " fetching setting for user " + callingUser);
|
||||
callingUser = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
|
||||
Binder.getCallingUid(), reqUser, false, true,
|
||||
"get/set setting for user", null);
|
||||
if (LOCAL_LOGV) Slog.v(TAG, " access setting for user " + callingUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,9 +665,6 @@ public class SettingsProvider extends ContentProvider {
|
||||
// the Settings.NameValueTable.VALUE static.
|
||||
final String newValue = (args == null)
|
||||
? null : args.getString(Settings.NameValueTable.VALUE);
|
||||
if (newValue == null) {
|
||||
throw new IllegalArgumentException("Bad value for " + method);
|
||||
}
|
||||
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(Settings.NameValueTable.NAME, request);
|
||||
|
||||
Reference in New Issue
Block a user