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

Commit 67e27e37 authored by Thomas Stuart's avatar Thomas Stuart Committed by Android (Google) Code Review
Browse files

Merge "CallLogManager & TestApp updates given business composer changes" into main

parents 12419181 8d0f849e
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.telecom;

import static android.provider.CallLog.AddCallParams.AddCallParametersBuilder.MAX_NUMBER_OF_CHARACTERS;
import static android.provider.CallLog.Calls.BLOCK_REASON_NOT_BLOCKED;
import static android.telephony.CarrierConfigManager.KEY_SUPPORT_IMS_CONFERENCE_EVENT_PACKAGE_BOOL;

@@ -31,6 +32,7 @@ import android.location.CountryDetector;
import android.location.Location;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.Looper;
@@ -60,8 +62,6 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.stream.Stream;

/**
@@ -419,11 +419,24 @@ public final class CallLogManager extends CallsManagerListenerBase {
        paramBuilder.setCallType(callLogType);
        paramBuilder.setIsRead(call.isSelfManaged());
        paramBuilder.setMissedReason(call.getMissedReason());
        if (Flags.businessCallComposer() && call.getExtras() != null) {
            paramBuilder.setIsBusinessCall(call.getExtras().getBoolean(
                    android.telecom.Call.EXTRA_IS_BUSINESS_CALL, false));
            paramBuilder.setBusinessName(call.getExtras().getString(
                    android.telecom.Call.EXTRA_ASSERTED_DISPLAY_NAME, ""));
        if (mFeatureFlags.businessCallComposer() && call.getExtras() != null) {
            Bundle extras = call.getExtras();
            boolean isBusinessCall =
                    extras.getBoolean(android.telecom.Call.EXTRA_IS_BUSINESS_CALL, false);
            paramBuilder.setIsBusinessCall(isBusinessCall);
            if (isBusinessCall) {
                Log.i(TAG, "logging business call");
                String assertedDisplayName =
                        extras.getString(android.telecom.Call.EXTRA_ASSERTED_DISPLAY_NAME, "");
                if (assertedDisplayName.length() > MAX_NUMBER_OF_CHARACTERS) {
                    // avoid throwing an IllegalArgumentException and only log the first 256
                    // characters of the name.
                    paramBuilder.setAssertedDisplayName(
                            assertedDisplayName.substring(0, MAX_NUMBER_OF_CHARACTERS));
                } else {
                    paramBuilder.setAssertedDisplayName(assertedDisplayName);
                }
            }
        }
        sendAddCallBroadcast(callLogType, call.getAgeMillis());

+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
    <uses-permission android:name="android.permission.REGISTER_CONNECTION_MANAGER"/>
    <uses-permission android:name="android.permission.REGISTER_SIM_SUBSCRIPTION"/>
    <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>

    <application android:label="@string/app_name">
        <uses-library android:name="android.test.runner"/>
+17 −0
Original line number Diff line number Diff line
@@ -54,6 +54,23 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/cancelMissedButton" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    <EditText
        android:id="@+id/set_composer_edit_text"
        android:inputType="number"
        android:layout_width="200dp"
        android:layout_height="wrap_content" />
    <Button
        android:id="@+id/submit_composer_value"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/submitCallComposerLabel" />
    </LinearLayout>

    <CheckBox
        android:id="@+id/call_with_rtt_checkbox"
        android:layout_width="wrap_content"
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@

    <string name="postCallActivityLabel">Test Post Call Screen</string>

    <string name="submitCallComposerLabel">Set Call Composer</string>

    <string-array name="rtt_mode_array">
        <item>Full</item>
        <item>HCO</item>
+28 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.ims.ImsRcsManager;
import android.util.Log;
import android.view.View;
@@ -30,9 +31,11 @@ import android.widget.EditText;
import android.widget.Toast;

public class TestDialerActivity extends Activity {
    private static final String TAG = TestDialerActivity.class.getSimpleName();
    private static final int REQUEST_CODE_SET_DEFAULT_DIALER = 1;

    private EditText mNumberView;
    private EditText mCallComposerView;
    private CheckBox mRttCheckbox;
    private CheckBox mComposerCheckbox;
    private EditText mPriorityView;
@@ -57,6 +60,13 @@ public class TestDialerActivity extends Activity {
            }
        });

        findViewById(R.id.submit_composer_value).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                setCallComposer();
            }
        });

        findViewById(R.id.place_call_button).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
@@ -79,6 +89,7 @@ public class TestDialerActivity extends Activity {
        });

        mNumberView = (EditText) findViewById(R.id.number);
        mCallComposerView = (EditText) findViewById(R.id.set_composer_edit_text);
        mRttCheckbox = (CheckBox) findViewById(R.id.call_with_rtt_checkbox);
        mComposerCheckbox = (CheckBox) findViewById(R.id.add_composer_attachments_checkbox);
        findViewById(R.id.enable_car_mode).setOnClickListener(new OnClickListener() {
@@ -141,6 +152,23 @@ public class TestDialerActivity extends Activity {
        }
    }

    // Testers need a way of setting the call composer since this is currently not supported by
    // Dialer.  In the future, this will be a Dialer setting that users can enable/disable.
    private void setCallComposer() {
        final TelephonyManager telephonyManager =
                (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String number = mCallComposerView.getText().toString();
        try {
            Log.i(TAG, "setCallComposer: value=[" + number + "]");
            telephonyManager.setCallComposerStatus(Integer.parseInt(number));
            Log.i(TAG, "setCallComposer: successfully set composer");
        } catch (Exception e) {
            Log.i(TAG, "setCallComposer: hit exception while setting the call composer."
                    + " See stack trace below for more info!");
            e.printStackTrace();
        }
    }

    private void placeCall() {
        final TelecomManager telecomManager =
                (TelecomManager) getSystemService(Context.TELECOM_SERVICE);