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

Commit 24c35e0f authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Extra security checks in placeCall." am: 3cb2f5e5 am: 59db768a

am: a025d428

Change-Id: If0198bed5475e09ce2ef7dec1f69e5d104215c46
parents 0f5f0568 a025d428
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -994,6 +994,10 @@ public class TelecomServiceImpl {
                                        android.Manifest.permission.MANAGE_OWN_CALLS,
                                        "Self-managed phone accounts must have MANAGE_OWN_CALLS " +
                                                "permission.");

                                // Self-managed ConnectionServices can ONLY add new incoming calls
                                // using their own PhoneAccounts.  The checkPackage(..) app opps
                                // check above ensures this.
                            }
                        }
                        long token = Binder.clearCallingIdentity();
@@ -1084,6 +1088,16 @@ public class TelecomServiceImpl {
                if (isSelfManaged) {
                    mContext.enforceCallingOrSelfPermission(Manifest.permission.MANAGE_OWN_CALLS,
                            "Self-managed ConnectionServices require MANAGE_OWN_CALLS permission.");

                    if (!callingPackage.equals(
                            phoneAccountHandle.getComponentName().getPackageName())
                            && !canCallPhone(callingPackage,
                            "CALL_PHONE permission required to place calls.")) {
                        // The caller is not allowed to place calls, so we want to ensure that it
                        // can only place calls through itself.
                        throw new SecurityException("Self-managed ConnectionServices can only "
                                + "place calls through their own ConnectionService.");
                    }
                } else if (!canCallPhone(callingPackage, "placeCall")) {
                    throw new SecurityException("Package " + callingPackage
                            + " is not allowed to place phone calls");