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

Commit e0175431 authored by Yorke Lee's avatar Yorke Lee Committed by Android (Google) Code Review
Browse files

Merge "Enforce CALL_PRIVILEGED check at start of CallActivity" into lmp-dev

parents aa479376 39d94c1b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public class CallActivity extends Activity {
            return;
        }

        verifyCallAction(intent);
        String action = intent.getAction();

        if (Intent.ACTION_CALL.equals(action) ||
@@ -89,6 +90,17 @@ public class CallActivity extends Activity {
        }
    }

    private void verifyCallAction(Intent intent) {
        if (CallActivity.class.getName().equals(intent.getComponent().getClassName())) {
            // If we were launched directly from the CallActivity, not one of its more privileged
            // aliases, then make sure that only the non-privileged actions are allowed.
            if (!Intent.ACTION_CALL.equals(intent.getAction())) {
                Log.w(this, "Attempt to deliver non-CALL action; forcing to CALL");
                intent.setAction(Intent.ACTION_CALL);
            }
        }
    }

    private void processOutgoingCallIntent(Intent intent) {
        Uri handle = intent.getData();
        String scheme = handle.getScheme();
+1 −10
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ class NewOutgoingCallIntentBroadcaster {
        systemDialerIntent.setData(handle);
        systemDialerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        Log.v(this, "calling startActivity for default dialer: %s", systemDialerIntent);
        mContext.startActivity(systemDialerIntent);
        mContext.startActivityAsUser(systemDialerIntent, UserHandle.CURRENT);
    }

    /**
@@ -393,15 +393,6 @@ class NewOutgoingCallIntentBroadcaster {
     * number.
     */
    private void rewriteCallIntentAction(Intent intent, boolean isPotentialEmergencyNumber) {
        if (CallActivity.class.getName().equals(intent.getComponent().getClassName())) {
            // If we were launched directly from the CallActivity, not one of its more privileged
            // aliases, then make sure that only the non-privileged actions are allowed.
            if (!Intent.ACTION_CALL.equals(intent.getAction())) {
                Log.w(this, "Attempt to deliver non-CALL action; forcing to CALL");
                intent.setAction(Intent.ACTION_CALL);
            }
        }

        String action = intent.getAction();

        /* Change CALL_PRIVILEGED into CALL or CALL_EMERGENCY as needed. */