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

Commit f7622446 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

resolve merge conflicts of 453749fa to lmp-sprout-dev

Change-Id: I1f768e539f0c425befdeef44f70f59c94654b248
parents 7b9a15f2 453749fa
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import android.telecom.TelecomManager;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;

import android.util.EventLog;

// TODO: Needed for move to system service: import com.android.internal.R;
import com.android.internal.telecom.ITelecomService;
import com.android.internal.util.IndentingPrintWriter;
@@ -477,6 +479,7 @@ public class TelecomServiceImpl extends ITelecomService.Stub {
        if (phoneAccountHandle != null && phoneAccountHandle.getComponentName() != null) {
            mAppOpsManager.checkPackage(
                    Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName());
            enforcePhoneAccountIsRegistered(phoneAccountHandle);

            Intent intent = new Intent(TelecomManager.ACTION_INCOMING_CALL);
            intent.setPackage(mContext.getPackageName());
@@ -501,6 +504,7 @@ public class TelecomServiceImpl extends ITelecomService.Stub {
                TelephonyUtil.isPstnComponentName(phoneAccountHandle.getComponentName())) {
            mAppOpsManager.checkPackage(
                    Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName());
            enforcePhoneAccountIsRegistered(phoneAccountHandle);

            Intent intent = new Intent(TelecomManager.ACTION_NEW_UNKNOWN_CALL);
            intent.setClass(mContext, CallReceiver.class);
@@ -550,6 +554,16 @@ public class TelecomServiceImpl extends ITelecomService.Stub {
        return false;
    }

    // Enforce that the PhoneAccountHandle being passed in is registered to a valid PhoneAccount.
    private void enforcePhoneAccountIsRegistered(PhoneAccountHandle phoneAccountHandle) {
        PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccount(phoneAccountHandle);
        if(phoneAccount == null) {
            EventLog.writeEvent(0x534e4554, "26864502", Binder.getCallingUid(), "R");
            throw new SecurityException("This PhoneAccountHandle is not registered to a valid " +
                    "PhoneAccount!");
        }
    }

    private void enforcePhoneAccountModificationForPackage(String packageName) {
        // TODO: Use a new telecomm permission for this instead of reusing modify.