Show admin support dialog when DISALLOW_OUTGOING_CALLS is set.
Bug: 26762992
Change-Id: If30918918d0aff44717286ebc3fb683574969b34
diff --git a/Android.mk b/Android.mk
index b2fbc16..4785b24 100644
--- a/Android.mk
+++ b/Android.mk
@@ -6,6 +6,7 @@
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := Telecom
@@ -14,6 +15,8 @@
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+include frameworks/base/packages/SettingsLib/common.mk
+
include $(BUILD_PACKAGE)
# Build the test package.
diff --git a/src/com/android/server/telecom/components/UserCallIntentProcessor.java b/src/com/android/server/telecom/components/UserCallIntentProcessor.java
index 97a59eb..a513bcf 100644
--- a/src/com/android/server/telecom/components/UserCallIntentProcessor.java
+++ b/src/com/android/server/telecom/components/UserCallIntentProcessor.java
@@ -21,6 +21,8 @@
import com.android.server.telecom.R;
import com.android.server.telecom.TelephonyUtil;
import com.android.server.telecom.UserUtil;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.app.AppOpsManager;
import android.content.Context;
@@ -102,17 +104,24 @@
// profile user because this check can always be bypassed by copying and pasting the phone
// number into the personal dialer.
if (!UserUtil.isManagedProfile(mContext, mUserHandle)) {
- final UserManager userManager =
- (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- if (userManager.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS, mUserHandle)
- && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) {
- // Only emergency calls are allowed for users with the DISALLOW_OUTGOING_CALLS
- // restriction.
- showErrorDialogForRestrictedOutgoingCall(mContext,
- R.string.outgoing_call_not_allowed_user_restriction);
- Log.w(this, "Rejecting non-emergency phone call due to DISALLOW_OUTGOING_CALLS "
- + "restriction");
- return;
+ // Only emergency calls are allowed for users with the DISALLOW_OUTGOING_CALLS
+ // restriction.
+ if (!TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) {
+ final UserManager userManager = (UserManager) mContext.getSystemService(
+ Context.USER_SERVICE);
+ if (userManager.hasBaseUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS,
+ mUserHandle)) {
+ showErrorDialogForRestrictedOutgoingCall(mContext,
+ R.string.outgoing_call_not_allowed_user_restriction);
+ Log.w(this, "Rejecting non-emergency phone call due to DISALLOW_OUTGOING_CALLS "
+ + "restriction");
+ return;
+ } else if (userManager.hasUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS,
+ mUserHandle)) {
+ RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext,
+ EnforcedAdmin.MULTIPLE_ENFORCED_ADMIN);
+ return;
+ }
}
}
diff --git a/tests/Android.mk b/tests/Android.mk
index 12edf37..e639b55 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -46,4 +46,6 @@
LOCAL_MODULE_TAGS := tests
+include frameworks/base/packages/SettingsLib/common.mk
+
include $(BUILD_PACKAGE)