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

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

Merge "Improve outgoing call UI responsiveness" into lmp-mr1-dev

parents e48121ed 9b71ea82
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -124,13 +124,7 @@ public class CallActivity extends Activity {

        intent.putExtra(CallReceiver.KEY_IS_DEFAULT_DIALER, isDefaultDialer());

        if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
            Trace.beginSection("processOutgoingCallIntent");
            CallReceiver.processOutgoingCallIntent(getApplicationContext(), intent);
            Trace.endSection();
        } else {
            sendBroadcastToReceiver(intent, false /* isIncoming */);
        }
        sendBroadcastToReceiver(intent);
    }

    private boolean isDefaultDialer() {
@@ -159,11 +153,11 @@ public class CallActivity extends Activity {
    /**
     * Trampolines the intent to the broadcast receiver that runs only as the primary user.
     */
    private boolean sendBroadcastToReceiver(Intent intent, boolean incoming) {
        intent.putExtra(CallReceiver.KEY_IS_INCOMING_CALL, incoming);
    private boolean sendBroadcastToReceiver(Intent intent) {
        intent.putExtra(CallReceiver.KEY_IS_INCOMING_CALL, false);
        intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.setClass(this, CallReceiver.class);
        Log.d(this, "Sending broadcast as user to CallReceiver- isIncoming: %s", incoming);
        Log.d(this, "Sending broadcast as user to CallReceiver");
        sendBroadcastAsUser(intent, UserHandle.OWNER);
        return true;
    }
+3 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Trace;
import android.os.UserHandle;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
@@ -33,11 +34,13 @@ public class CallReceiver extends BroadcastReceiver {
        final boolean isUnknownCall = intent.getBooleanExtra(KEY_IS_UNKNOWN_CALL, false);
        Log.i(this, "onReceive - isUnknownCall: %s", isUnknownCall);

        Trace.beginSection("processNewCallCallIntent");
        if (isUnknownCall) {
            processUnknownCallIntent(intent);
        } else {
            processOutgoingCallIntent(context, intent);
        }
        Trace.endSection();
    }

    /**
+17 −7
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ import android.telecom.ParcelableCall;
import android.telecom.TelecomManager;
import android.util.ArrayMap;



// TODO: Needed for move to system service: import com.android.internal.R;
import com.android.internal.telecom.IInCallService;
import com.android.internal.util.IndentingPrintWriter;
@@ -154,7 +152,7 @@ public final class InCallController extends CallsManagerListenerBase {
    @Override
    public void onCallAdded(Call call) {
        if (mInCallServices.isEmpty()) {
            bind();
            bind(call);
        } else {
            Log.i(this, "onCallAdded: %s", call);
            // Track the call if we don't already know about it.
@@ -274,8 +272,10 @@ public final class InCallController extends CallsManagerListenerBase {
    /**
     * Binds to the in-call app if not already connected by binding directly to the saved
     * component name of the {@link IInCallService} implementation.
     *
     * @param call The newly added call that triggered the binding to the in-call services.
     */
    private void bind() {
    private void bind(Call call) {
        ThreadUtil.checkOnMainThread();
        if (mInCallServices.isEmpty()) {
            PackageManager packageManager = mContext.getPackageManager();
@@ -316,9 +316,19 @@ public final class InCallController extends CallsManagerListenerBase {
                        Intent intent = new Intent(InCallService.SERVICE_INTERFACE);
                        intent.setComponent(componentName);

                        final int bindFlags = mInCallComponentName.equals(componentName)
                                ? Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT
                                : Context.BIND_AUTO_CREATE;
                        final int bindFlags;
                        if (mInCallComponentName.equals(componentName)) {
                            bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT;
                            if (!call.isIncoming()) {
                                intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS,
                                        call.getExtras());
                                intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,
                                        call.getTargetPhoneAccount());
                            }
                        } else {
                            bindFlags = Context.BIND_AUTO_CREATE;
                        }

                        if (mContext.bindServiceAsUser(intent, inCallServiceConnection, bindFlags,
                                UserHandle.CURRENT)) {
                            mServiceConnections.put(componentName, inCallServiceConnection);
+1 −1
Original line number Diff line number Diff line
@@ -60,6 +60,6 @@ public final class Timeouts {
     * in-call UI.
     */
    public static long getNewOutgoingCallCancelMillis(ContentResolver contentResolver) {
        return get(contentResolver, "new_outgoing_call_cancel_ms", 200L);
        return get(contentResolver, "new_outgoing_call_cancel_ms", 300L);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class CallServiceNotifier {
                .setSubscriptionAddress(Uri.parse("tel:555-TEST"))
                .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
                .setIcon(context, R.drawable.stat_sys_phone_call, Color.RED)
                .setHighlightColor(Color.RED)
                .setShortDescription("a short description for the call provider")
                .setSupportedUriSchemes(Arrays.asList("tel"))
                .build());
@@ -125,6 +126,7 @@ public class CallServiceNotifier {
                .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER |
                        PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)
                .setIcon(context, R.drawable.stat_sys_phone_call, Color.GREEN)
                .setHighlightColor(Color.GREEN)
                .setShortDescription("a short description for the sim subscription")
                .build());