field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi";
field public static final java.lang.String DISALLOW_CREATE_WINDOWS = "no_create_windows";
field public static final java.lang.String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste";
+ field public static final java.lang.String DISALLOW_DATA_ROAMING = "no_data_roaming";
field public static final java.lang.String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features";
field public static final java.lang.String DISALLOW_FACTORY_RESET = "no_factory_reset";
field public static final java.lang.String DISALLOW_FUN = "no_fun";
field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi";
field public static final java.lang.String DISALLOW_CREATE_WINDOWS = "no_create_windows";
field public static final java.lang.String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste";
+ field public static final java.lang.String DISALLOW_DATA_ROAMING = "no_data_roaming";
field public static final java.lang.String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features";
field public static final java.lang.String DISALLOW_FACTORY_RESET = "no_factory_reset";
field public static final java.lang.String DISALLOW_FUN = "no_fun";
field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi";
field public static final java.lang.String DISALLOW_CREATE_WINDOWS = "no_create_windows";
field public static final java.lang.String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste";
+ field public static final java.lang.String DISALLOW_DATA_ROAMING = "no_data_roaming";
field public static final java.lang.String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features";
field public static final java.lang.String DISALLOW_FACTORY_RESET = "no_factory_reset";
field public static final java.lang.String DISALLOW_FUN = "no_fun";
public static final String DISALLOW_CAMERA = "no_camera";
/**
+ * Specifies if a user is not allowed to use cellular data when roaming. This can only be set by
+ * device owners. The default value is <code>false</code>.
+ *
+ * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
+ * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_DATA_ROAMING = "no_data_roaming";
+
+ /**
* Allows apps in the parent profile to handle web links from the managed profile.
*
* This user restriction has an effect only in a managed profile.
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
import android.util.Log;
import org.xmlpull.v1.XmlPullParser;
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.List;
import java.util.Set;
/**
- * Utility methods for uesr restrictions.
+ * Utility methods for user restrictions.
*
* <p>See {@link UserManagerService} for the method suffixes.
*/
UserManager.ALLOW_PARENT_PROFILE_APP_LINKING,
UserManager.DISALLOW_RECORD_AUDIO,
UserManager.DISALLOW_CAMERA,
- UserManager.DISALLOW_RUN_IN_BACKGROUND
+ UserManager.DISALLOW_RUN_IN_BACKGROUND,
+ UserManager.DISALLOW_DATA_ROAMING
);
/**
UserManager.DISALLOW_SMS,
UserManager.DISALLOW_FUN,
UserManager.DISALLOW_SAFE_BOOT,
- UserManager.DISALLOW_CREATE_WINDOWS
+ UserManager.DISALLOW_CREATE_WINDOWS,
+ UserManager.DISALLOW_DATA_ROAMING
);
/**
.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0, userId);
}
break;
+ case UserManager.DISALLOW_DATA_ROAMING:
+ if (newValue) {
+ // DISALLOW_DATA_ROAMING user restriction is set.
+
+ // Multi sim device.
+ SubscriptionManager subscriptionManager = new SubscriptionManager(context);
+ final List<SubscriptionInfo> subscriptionInfoList =
+ subscriptionManager.getActiveSubscriptionInfoList();
+ if (subscriptionInfoList != null) {
+ for (SubscriptionInfo subInfo : subscriptionInfoList) {
+ android.provider.Settings.Global.putStringForUser(cr,
+ android.provider.Settings.Global.DATA_ROAMING
+ + subInfo.getSubscriptionId(), "0", userId);
+ }
+ }
+
+ // Single sim device.
+ android.provider.Settings.Global.putStringForUser(cr,
+ android.provider.Settings.Global.DATA_ROAMING, "0", userId);
+ }
+ break;
case UserManager.DISALLOW_SHARE_LOCATION:
if (newValue) {
android.provider.Settings.Secure.putIntForUser(cr,