Loading src/com/android/server/telecom/TelecomServiceImpl.java +11 −1 Original line number Diff line number Diff line Loading @@ -808,9 +808,19 @@ public class TelecomServiceImpl { + " is not allowed to place phone calls"); } // Note: we can still get here for the default/system dialer, even if the Phone // permission is turned off. This is because the default/system dialer is always // allowed to attempt to place a call (regardless of permission state), in case // it turns out to be an emergency call. If the permission is denied and the // call is being made to a non-emergency number, the call will be denied later on // by {@link UserCallIntentProcessor}. final boolean hasCallAppOp = mAppOpsManager.noteOp(AppOpsManager.OP_CALL_PHONE, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED; final boolean hasCallPermission = mContext.checkCallingPermission(CALL_PHONE) == PackageManager.PERMISSION_GRANTED; synchronized (mLock) { final UserHandle userHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); Loading @@ -818,7 +828,7 @@ public class TelecomServiceImpl { final Intent intent = new Intent(Intent.ACTION_CALL, handle); intent.putExtras(extras); new UserCallIntentProcessor(mContext, userHandle).processIntent(intent, callingPackage, hasCallAppOp); callingPackage, hasCallAppOp && hasCallPermission); } finally { Binder.restoreCallingIdentity(token); } Loading src/com/android/server/telecom/components/UserCallIntentProcessor.java +5 −4 Original line number Diff line number Diff line Loading @@ -70,7 +70,8 @@ public class UserCallIntentProcessor { * * @param intent The intent. */ public void processIntent(Intent intent, String callingPackageName, boolean hasCallAppOp) { public void processIntent(Intent intent, String callingPackageName, boolean canCallNonEmergency) { // Ensure call intents are not processed on devices that are not capable of calling. if (!isVoiceCapable()) { return; Loading @@ -81,12 +82,12 @@ public class UserCallIntentProcessor { if (Intent.ACTION_CALL.equals(action) || Intent.ACTION_CALL_PRIVILEGED.equals(action) || Intent.ACTION_CALL_EMERGENCY.equals(action)) { processOutgoingCallIntent(intent, callingPackageName, hasCallAppOp); processOutgoingCallIntent(intent, callingPackageName, canCallNonEmergency); } } private void processOutgoingCallIntent(Intent intent, String callingPackageName, boolean hasCallAppOp) { boolean canCallNonEmergency) { Uri handle = intent.getData(); String scheme = handle.getScheme(); String uriString = handle.getSchemeSpecificPart(); Loading @@ -109,7 +110,7 @@ public class UserCallIntentProcessor { return; } if (!hasCallAppOp && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) { if (!canCallNonEmergency && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) { showErrorDialogForRestrictedOutgoingCall(mContext, R.string.outgoing_call_not_allowed_no_permission); Log.w(this, "Rejecting non-emergency phone call because " Loading Loading
src/com/android/server/telecom/TelecomServiceImpl.java +11 −1 Original line number Diff line number Diff line Loading @@ -808,9 +808,19 @@ public class TelecomServiceImpl { + " is not allowed to place phone calls"); } // Note: we can still get here for the default/system dialer, even if the Phone // permission is turned off. This is because the default/system dialer is always // allowed to attempt to place a call (regardless of permission state), in case // it turns out to be an emergency call. If the permission is denied and the // call is being made to a non-emergency number, the call will be denied later on // by {@link UserCallIntentProcessor}. final boolean hasCallAppOp = mAppOpsManager.noteOp(AppOpsManager.OP_CALL_PHONE, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED; final boolean hasCallPermission = mContext.checkCallingPermission(CALL_PHONE) == PackageManager.PERMISSION_GRANTED; synchronized (mLock) { final UserHandle userHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); Loading @@ -818,7 +828,7 @@ public class TelecomServiceImpl { final Intent intent = new Intent(Intent.ACTION_CALL, handle); intent.putExtras(extras); new UserCallIntentProcessor(mContext, userHandle).processIntent(intent, callingPackage, hasCallAppOp); callingPackage, hasCallAppOp && hasCallPermission); } finally { Binder.restoreCallingIdentity(token); } Loading
src/com/android/server/telecom/components/UserCallIntentProcessor.java +5 −4 Original line number Diff line number Diff line Loading @@ -70,7 +70,8 @@ public class UserCallIntentProcessor { * * @param intent The intent. */ public void processIntent(Intent intent, String callingPackageName, boolean hasCallAppOp) { public void processIntent(Intent intent, String callingPackageName, boolean canCallNonEmergency) { // Ensure call intents are not processed on devices that are not capable of calling. if (!isVoiceCapable()) { return; Loading @@ -81,12 +82,12 @@ public class UserCallIntentProcessor { if (Intent.ACTION_CALL.equals(action) || Intent.ACTION_CALL_PRIVILEGED.equals(action) || Intent.ACTION_CALL_EMERGENCY.equals(action)) { processOutgoingCallIntent(intent, callingPackageName, hasCallAppOp); processOutgoingCallIntent(intent, callingPackageName, canCallNonEmergency); } } private void processOutgoingCallIntent(Intent intent, String callingPackageName, boolean hasCallAppOp) { boolean canCallNonEmergency) { Uri handle = intent.getData(); String scheme = handle.getScheme(); String uriString = handle.getSchemeSpecificPart(); Loading @@ -109,7 +110,7 @@ public class UserCallIntentProcessor { return; } if (!hasCallAppOp && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) { if (!canCallNonEmergency && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) { showErrorDialogForRestrictedOutgoingCall(mContext, R.string.outgoing_call_not_allowed_no_permission); Log.w(this, "Rejecting non-emergency phone call because " Loading