Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24b10beb authored by Tony Mak's avatar Tony Mak
Browse files

Skip DISALLOW_OUTGOING_CALLS checking in managed profile.

In pre-N, DISALLOW_OUTGOING_CALLS is not checked in managed profile as
ACTION_CALL is always forwarded to personal side.

In N, ACTION_CALL is now handled in managed profile and hence
we do check DISALLOW_OUTGOING_CALLS. It does not align with the javadoc in
http://developer.android.com/intl/ja/reference/android/os/UserManager.html#DISALLOW_OUTGOING_CALLS.

After offline discussion, we decide to keep the pre-N behavior,
because user can always copy and paste the phone number from work side
to personal side anyway.

Bug: 27165111
Change-Id: Id696c0ce1f3bb3fff56addc8646e997a3dfb5a42
parent f7380b9a
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.server.telecom.CallIntentProcessor;
import com.android.server.telecom.Log;
import com.android.server.telecom.R;
import com.android.server.telecom.TelephonyUtil;
import com.android.server.telecom.UserUtil;

import android.app.AppOpsManager;
import android.content.Context;
@@ -97,6 +98,10 @@ public class UserCallIntentProcessor {
                    PhoneAccount.SCHEME_SIP : PhoneAccount.SCHEME_TEL, uriString, null);
        }

        // Check DISALLOW_OUTGOING_CALLS restriction. Note: We are skipping this check in a managed
        // 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)
@@ -109,6 +114,7 @@ public class UserCallIntentProcessor {
                        + "restriction");
                return;
            }
        }

        if (!canCallNonEmergency && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) {
            showErrorDialogForRestrictedOutgoingCall(mContext,