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

Commit 59db768a authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Extra security checks in placeCall."

am: 3cb2f5e5

Change-Id: I307164aa24794cd71f5cdb7e6e1c078da9f2d376
parents 5ef1b634 3cb2f5e5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -996,6 +996,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();
@@ -1086,6 +1090,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");