am 37fd8bd1: am fef8cbd6: Merge "Marking some globals from setGlobalSetting as not supported" into mnc-dev
* commit '37fd8bd182c110b98772876f3fa47cc4d54042bc': Marking some globals from setGlobalSetting as not supported
This commit is contained in:
@@ -3962,24 +3962,27 @@ public class DevicePolicyManager {
|
|||||||
* <li>{@link Settings.Global#ADB_ENABLED}</li>
|
* <li>{@link Settings.Global#ADB_ENABLED}</li>
|
||||||
* <li>{@link Settings.Global#AUTO_TIME}</li>
|
* <li>{@link Settings.Global#AUTO_TIME}</li>
|
||||||
* <li>{@link Settings.Global#AUTO_TIME_ZONE}</li>
|
* <li>{@link Settings.Global#AUTO_TIME_ZONE}</li>
|
||||||
* <li>{@link Settings.Global#BLUETOOTH_ON}
|
|
||||||
* Changing this setting has not effect as of {@link android.os.Build.VERSION_CODES#MNC}. Use
|
|
||||||
* {@link android.bluetooth.BluetoothAdapter#enable()} and
|
|
||||||
* {@link android.bluetooth.BluetoothAdapter#disable()} instead.</li>
|
|
||||||
* <li>{@link Settings.Global#DATA_ROAMING}</li>
|
* <li>{@link Settings.Global#DATA_ROAMING}</li>
|
||||||
* <li>{@link Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}</li>
|
|
||||||
* <li>{@link Settings.Global#MODE_RINGER}</li>
|
|
||||||
* <li>{@link Settings.Global#NETWORK_PREFERENCE}</li>
|
|
||||||
* <li>{@link Settings.Global#USB_MASS_STORAGE_ENABLED}</li>
|
* <li>{@link Settings.Global#USB_MASS_STORAGE_ENABLED}</li>
|
||||||
* <li>{@link Settings.Global#WIFI_ON}
|
|
||||||
* Changing this setting has not effect as of {@link android.os.Build.VERSION_CODES#MNC}. Use
|
|
||||||
* {@link android.net.wifi.WifiManager#setWifiEnabled(boolean)} instead.</li>
|
|
||||||
* <li>{@link Settings.Global#WIFI_SLEEP_POLICY}</li>
|
* <li>{@link Settings.Global#WIFI_SLEEP_POLICY}</li>
|
||||||
* <li>{@link Settings.Global#STAY_ON_WHILE_PLUGGED_IN}
|
* <li>{@link Settings.Global#STAY_ON_WHILE_PLUGGED_IN}
|
||||||
* This setting is only available from {@link android.os.Build.VERSION_CODES#MNC} onwards
|
* This setting is only available from {@link android.os.Build.VERSION_CODES#MNC} onwards
|
||||||
* and can only be set if {@link #setMaximumTimeToLock} is not used to set a timeout.</li>
|
* and can only be set if {@link #setMaximumTimeToLock} is not used to set a timeout.</li>
|
||||||
* <li>{@link Settings.Global#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN}</li>
|
* <li>{@link Settings.Global#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* <p>Changing the following settings has no effect as of
|
||||||
|
* {@link android.os.Build.VERSION_CODES#MNC}:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@link Settings.Global#BLUETOOTH_ON}.
|
||||||
|
* Use {@link android.bluetooth.BluetoothAdapter#enable()} and
|
||||||
|
* {@link android.bluetooth.BluetoothAdapter#disable()} instead.</li>
|
||||||
|
* <li>{@link Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}</li>
|
||||||
|
* <li>{@link Settings.Global#MODE_RINGER}.
|
||||||
|
* Use {@link android.media.AudioManager#setRingerMode(int)} instead.</li>
|
||||||
|
* <li>{@link Settings.Global#NETWORK_PREFERENCE}</li>
|
||||||
|
* <li>{@link Settings.Global#WIFI_ON}.
|
||||||
|
* Use {@link android.net.wifi.WifiManager#setWifiEnabled(boolean)} instead.</li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
|
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
|
||||||
* @param setting The name of the setting to update.
|
* @param setting The name of the setting to update.
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
private static final Set<String> SECURE_SETTINGS_WHITELIST;
|
private static final Set<String> SECURE_SETTINGS_WHITELIST;
|
||||||
private static final Set<String> SECURE_SETTINGS_DEVICEOWNER_WHITELIST;
|
private static final Set<String> SECURE_SETTINGS_DEVICEOWNER_WHITELIST;
|
||||||
private static final Set<String> GLOBAL_SETTINGS_WHITELIST;
|
private static final Set<String> GLOBAL_SETTINGS_WHITELIST;
|
||||||
|
private static final Set<String> GLOBAL_SETTINGS_DEPRECATED;
|
||||||
static {
|
static {
|
||||||
SECURE_SETTINGS_WHITELIST = new HashSet();
|
SECURE_SETTINGS_WHITELIST = new HashSet();
|
||||||
SECURE_SETTINGS_WHITELIST.add(Settings.Secure.DEFAULT_INPUT_METHOD);
|
SECURE_SETTINGS_WHITELIST.add(Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||||
@@ -240,13 +241,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.AUTO_TIME);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.AUTO_TIME);
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.AUTO_TIME_ZONE);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.AUTO_TIME_ZONE);
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.DATA_ROAMING);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.DATA_ROAMING);
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
|
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.MODE_RINGER);
|
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.NETWORK_PREFERENCE);
|
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_SLEEP_POLICY);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_SLEEP_POLICY);
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
|
||||||
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN);
|
GLOBAL_SETTINGS_WHITELIST.add(Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN);
|
||||||
|
|
||||||
|
GLOBAL_SETTINGS_DEPRECATED = new HashSet();
|
||||||
|
GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.BLUETOOTH_ON);
|
||||||
|
GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
|
||||||
|
GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.MODE_RINGER);
|
||||||
|
GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.NETWORK_PREFERENCE);
|
||||||
|
GLOBAL_SETTINGS_DEPRECATED.add(Settings.Global.WIFI_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keyguard features that when set of a profile will affect the profiles
|
// Keyguard features that when set of a profile will affect the profiles
|
||||||
@@ -5954,14 +5959,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
|
getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
|
||||||
|
|
||||||
|
// Some settings are no supported any more. However we do not want to throw a
|
||||||
|
// SecurityException to avoid breaking apps.
|
||||||
|
if (GLOBAL_SETTINGS_DEPRECATED.contains(setting)) {
|
||||||
|
Log.i(LOG_TAG, "Global setting no longer supported: " + setting);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!GLOBAL_SETTINGS_WHITELIST.contains(setting)) {
|
if (!GLOBAL_SETTINGS_WHITELIST.contains(setting)) {
|
||||||
// BLUETOOTH_ON and WIFI_ON used to be supported but not any more. We do not want to
|
throw new SecurityException(String.format(
|
||||||
// throw a SecurityException not to break apps.
|
"Permission denial: device owners cannot update %1$s", setting));
|
||||||
if (!Settings.Global.BLUETOOTH_ON.equals(setting)
|
|
||||||
&& !Settings.Global.WIFI_ON.equals(setting)) {
|
|
||||||
throw new SecurityException(String.format(
|
|
||||||
"Permission denial: device owners cannot update %1$s", setting));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Global.STAY_ON_WHILE_PLUGGED_IN.equals(setting)) {
|
if (Settings.Global.STAY_ON_WHILE_PLUGGED_IN.equals(setting)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user