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

Commit 24b6d774 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Pass call subject from ACTION_CALL intent to Connections.

- Added code in test connection service to faciliate testing call subjects.

Bug: 22685114
Change-Id: I729a574107cc2913f8cff956b03876053e4c44de
parent 306c6bea
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Trace;
import android.os.UserHandle;
import android.telecom.Connection;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -87,6 +88,12 @@ public class CallIntentProcessor {
            clientExtras = new Bundle();
        }

        // Ensure call subject is passed on to the connection service.
        if (intent.hasExtra(TelecomManager.EXTRA_CALL_SUBJECT)) {
            String callsubject = intent.getStringExtra(TelecomManager.EXTRA_CALL_SUBJECT);
            clientExtras.putString(TelecomManager.EXTRA_CALL_SUBJECT, callsubject);
        }

        final boolean isPrivilegedDialer = intent.getBooleanExtra(KEY_IS_PRIVILEGED_DIALER, false);

        // Send to CallsManager to ensure the InCallUI gets kicked off before the broadcast returns
+4 −2
Original line number Diff line number Diff line
@@ -111,7 +111,8 @@ public class CallServiceNotifier {
                .setAddress(Uri.parse("tel:555-TEST"))
                .setSubscriptionAddress(Uri.parse("tel:555-TEST"))
                .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER |
                        PhoneAccount.CAPABILITY_VIDEO_CALLING)
                        PhoneAccount.CAPABILITY_VIDEO_CALLING |
                        PhoneAccount.CAPABILITY_CALL_SUBJECT)
                .setIcon(Icon.createWithResource(
                        context.getResources(), R.drawable.stat_sys_phone_call))
                // TODO: Add icon tint (Color.RED)
@@ -129,7 +130,8 @@ public class CallServiceNotifier {
                .setSubscriptionAddress(Uri.parse("tel:555-TSIM"))
                .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER |
                        PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
                        PhoneAccount.CAPABILITY_VIDEO_CALLING)
                        PhoneAccount.CAPABILITY_VIDEO_CALLING |
                        PhoneAccount.CAPABILITY_CALL_SUBJECT)
                .setIcon(Icon.createWithResource(
                        context.getResources(), R.drawable.stat_sys_phone_call))
                // TODO: Add icon tint (Color.GREEN)
+26 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.util.Log;
import android.widget.Toast;

import com.android.server.telecom.testapps.R;

@@ -299,6 +300,13 @@ public class TestConnectionService extends ConnectionService {
        String gatewayPackage = extras.getString(TelecomManager.GATEWAY_PROVIDER_PACKAGE);
        Uri originalHandle = extras.getParcelable(TelecomManager.GATEWAY_ORIGINAL_ADDRESS);

        if (extras.containsKey(TelecomManager.EXTRA_CALL_SUBJECT)) {
            String callSubject = extras.getString(TelecomManager.EXTRA_CALL_SUBJECT);
            log("Got subject: " + callSubject);
            Toast.makeText(getApplicationContext(), "Got subject :" + callSubject,
                    Toast.LENGTH_SHORT).show();
        }

        log("gateway package [" + gatewayPackage + "], original handle [" +
                originalHandle + "]");

@@ -354,6 +362,24 @@ public class TestConnectionService extends ConnectionService {
                    VideoProfile.STATE_BIDIRECTIONAL :
                    VideoProfile.STATE_AUDIO_ONLY;
            connection.setVideoState(videoState);

            Bundle connectionExtras = connection.getExtras();
            if (connectionExtras == null) {
                connectionExtras = new Bundle();
            }

            // Randomly choose a varying length call subject.
            int subjectFormat = mRandom.nextInt(3);
            if (subjectFormat == 0) {
                connectionExtras.putString(Connection.EXTRA_CALL_SUBJECT,
                        "This is a test of call subject lines. Subjects for a call can be long " +
                                " and can go even longer.");
            } else if (subjectFormat == 1) {
                connectionExtras.putString(Connection.EXTRA_CALL_SUBJECT,
                        "This is a test of call subject lines.");
            }
            connection.setExtras(connectionExtras);

            setAddress(connection, address);

            addVideoProvider(connection);