From 390989da1967f9d385212cd2e22a50589ce69046 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 17 Jul 2014 10:52:03 -0700 Subject: [PATCH] Split telephony restrictions into outgoing calls and sms DISALLOW_TELEPHONY renamed to DISALLOW_OUTGOING_CALLS and introduced DISALLOW_SMS. Outgoing emergency calls should always be permitted. Change-Id: I0a38ef6e2df9dcf62d16fd93622ad61f4327614f --- api/current.txt | 3 ++- core/java/android/os/UserManager.java | 17 ++++++++++++++--- .../android/server/pm/UserManagerService.java | 6 ++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/api/current.txt b/api/current.txt index f7996719b8e40..0c1e2fc472af2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22311,9 +22311,10 @@ package android.os { field public static final java.lang.String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; field public static final java.lang.String DISALLOW_MOUNT_PHYSICAL_MEDIA = "no_physical_media"; + field public static final java.lang.String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls"; field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user"; field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location"; - field public static final java.lang.String DISALLOW_TELEPHONY = "no_telephony"; + field public static final java.lang.String DISALLOW_SMS = "no_sms"; field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps"; field public static final java.lang.String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone"; field public static final java.lang.String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer"; diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 7bbac2ce1e678..d3aee50f6f84e 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -271,15 +271,26 @@ public class UserManager { public static final String DISALLOW_ADJUST_VOLUME = "no_adjust_volume"; /** - * Key for user restrictions. Specifies that the user is not allowed to send or receive - * phone calls or text messages. Emergency calls may still be permitted. + * Key for user restrictions. Specifies that the user is not allowed to make outgoing + * phone calls. Emergency calls are still permitted. * The default value is false. *

* Type: Boolean * @see #setUserRestrictions(Bundle) * @see #getUserRestrictions() */ - public static final String DISALLOW_TELEPHONY = "no_telephony"; + public static final String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls"; + + /** + * Key for user restrictions. Specifies that the user is not allowed to send or receive + * SMS messages. + * The default value is false. + *

+ * Type: Boolean + * @see #setUserRestrictions(Bundle) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_SMS = "no_sms"; /** * Key for user restrictions. Specifies that windows besides app windows should not be diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 43469ba8af69b..b4cc25238803d 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -843,7 +843,8 @@ public class UserManagerService extends IUserManager.Stub { writeBoolean(serializer, restrictions, UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA); writeBoolean(serializer, restrictions, UserManager.DISALLOW_UNMUTE_MICROPHONE); writeBoolean(serializer, restrictions, UserManager.DISALLOW_ADJUST_VOLUME); - writeBoolean(serializer, restrictions, UserManager.DISALLOW_TELEPHONY); + writeBoolean(serializer, restrictions, UserManager.DISALLOW_OUTGOING_CALLS); + writeBoolean(serializer, restrictions, UserManager.DISALLOW_SMS); writeBoolean(serializer, restrictions, UserManager.DISALLOW_CREATE_WINDOWS); serializer.endTag(null, TAG_RESTRICTIONS); } @@ -986,7 +987,8 @@ public class UserManagerService extends IUserManager.Stub { UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA); readBoolean(parser, restrictions, UserManager.DISALLOW_UNMUTE_MICROPHONE); readBoolean(parser, restrictions, UserManager.DISALLOW_ADJUST_VOLUME); - readBoolean(parser, restrictions, UserManager.DISALLOW_TELEPHONY); + readBoolean(parser, restrictions, UserManager.DISALLOW_OUTGOING_CALLS); + readBoolean(parser, restrictions, UserManager.DISALLOW_SMS); readBoolean(parser, restrictions, UserManager.DISALLOW_CREATE_WINDOWS); }