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

Commit f73b23e7 authored by Ihab Awad's avatar Ihab Awad Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE. Implement connection error dialogs (1/4)" into lmp-preview-dev

parents 35066c38 fc91b7d4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -27440,6 +27440,7 @@ package android.telephony {
    field public static final int CALL_BARRED = 20; // 0x14
    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
    field public static final int CDMA_CALL_LOST = 41; // 0x29
    field public static final int CDMA_DROP = 27; // 0x1b
    field public static final int CDMA_INTERCEPT = 28; // 0x1c
    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
@@ -27452,6 +27453,8 @@ package android.telephony {
    field public static final int CS_RESTRICTED = 22; // 0x16
    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
    field public static final int DIALED_MMI = 39; // 0x27
    field public static final int EMERGENCY_ONLY = 37; // 0x25
    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
    field public static final int FDN_BLOCKED = 21; // 0x15
    field public static final int ICC_ERROR = 19; // 0x13
@@ -27462,12 +27465,13 @@ package android.telephony {
    field public static final int LIMIT_EXCEEDED = 15; // 0xf
    field public static final int LOCAL = 3; // 0x3
    field public static final int LOST_SIGNAL = 14; // 0xe
    field public static final int MAXIMUM_VALID_VALUE = 36; // 0x24
    field public static final int MAXIMUM_VALID_VALUE = 42; // 0x2a
    field public static final int MINIMUM_VALID_VALUE = 0; // 0x0
    field public static final int MMI = 6; // 0x6
    field public static final int NORMAL = 2; // 0x2
    field public static final int NOT_DISCONNECTED = 0; // 0x0
    field public static final int NOT_VALID = -1; // 0xffffffff
    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
    field public static final int OUT_OF_NETWORK = 11; // 0xb
    field public static final int OUT_OF_SERVICE = 18; // 0x12
@@ -27476,6 +27480,7 @@ package android.telephony {
    field public static final int SERVER_UNREACHABLE = 9; // 0x9
    field public static final int TIMED_OUT = 13; // 0xd
    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
  }
  public class NeighboringCellInfo implements android.os.Parcelable {
+8 −4
Original line number Diff line number Diff line
@@ -84,12 +84,16 @@ public final class CallServiceAdapter {
    /**
     * Tells Telecomm that an attempt to place the specified outgoing call failed.
     *
     * @param callId The ID of the outgoing call.
     * @param errorMessage The error associated with the failed call attempt.
     */
    public void handleFailedOutgoingCall(String callId, String errorMessage) {
     * @param request The originating request for a connection.
     * @param errorCode The error code associated with the failed call attempt.
     * @param errorMsg The error message associated with the failed call attempt.
     */
    public void handleFailedOutgoingCall(
            ConnectionRequest request,
            int errorCode,
            String errorMsg) {
        try {
            mAdapter.handleFailedOutgoingCall(callId, errorMessage);
            mAdapter.handleFailedOutgoingCall(request, errorCode, errorMsg);
        } catch (RemoteException e) {
        }
    }
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright 2014, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telecomm;

parcelable ConnectionRequest;
+53 −3
Original line number Diff line number Diff line
@@ -18,23 +18,37 @@ package android.telecomm;

import android.os.Bundle;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Simple data container encapsulating a request to some entity to
 * create a new {@link Connection}.
 */
public final class ConnectionRequest {
public final class ConnectionRequest implements Parcelable {

    // TODO: Token to limit recursive invocations
    // TODO: Consider upgrading "mHandle" to ordered list of handles, indicating a set of phone
    //         numbers that would satisfy the client's needs, in order of preference
    private final String mCallId;
    private final Uri mHandle;
    private final Bundle mExtras;

    public ConnectionRequest(Uri handle, Bundle extras) {
        mHandle = handle; mExtras = extras;
        this(null, handle, extras);
    }

    public ConnectionRequest(String callId, Uri handle, Bundle extras) {
        mCallId = callId;
        mHandle = handle;
        mExtras = extras;
    }

    /**
     * An identifier for this call.
     */
    public String getCallId() { return mCallId; }

    /**
     * The handle (e.g., phone number) to which the {@link Connection} is to connect.
     */
@@ -54,4 +68,40 @@ public final class ConnectionRequest {
                        : ConnectionService.toLogSafePhoneNumber(mHandle.toString()),
                mExtras == null ? "" : mExtras);
    }

    /**
     * Responsible for creating CallInfo objects for deserialized Parcels.
     */
    public static final Parcelable.Creator<ConnectionRequest> CREATOR =
            new Parcelable.Creator<ConnectionRequest> () {
                @Override
                public ConnectionRequest createFromParcel(Parcel source) {
                    String callId = source.readString();
                    Uri handle = (Uri) source.readParcelable(getClass().getClassLoader());
                    Bundle extras = (Bundle) source.readParcelable(getClass().getClassLoader());
                    return new ConnectionRequest(callId, handle, extras);
                }

                @Override
                public ConnectionRequest[] newArray(int size) {
                    return new ConnectionRequest[size];
                }
            };

    /**
     * {@inheritDoc}
     */
    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * Writes CallInfo object into a serializeable Parcel.
     */
    @Override
    public void writeToParcel(Parcel destination, int flags) {
        destination.writeString(mCallId);
        destination.writeParcelable(mHandle, 0);
        destination.writeParcelable(mExtras, 0);
    }}
+14 −9
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telecomm;

import android.net.Uri;
import android.os.Bundle;
import android.telephony.DisconnectCause;

import java.util.HashMap;
import java.util.LinkedList;
@@ -115,9 +116,8 @@ public abstract class ConnectionService extends CallService {
                    }

                    @Override
                    public void onError(Uri handle, String reason) {
                        Log.w(this, "Error in onFindSubscriptions " + callInfo.getHandle()
                                + " error: " + reason);
                    public void onError(Uri handle, int code, String msg) {
                        Log.w(this, "Error in onFindSubscriptions %s %d %s", handle, code, msg);
                        getAdapter().setIsCompatibleWith(callInfo.getId(), false);
                    }
                }
@@ -129,6 +129,7 @@ public abstract class ConnectionService extends CallService {
        Log.d(this, "call %s", callInfo);
        onCreateConnections(
                new ConnectionRequest(
                        callInfo.getId(),
                        callInfo.getHandle(),
                        callInfo.getExtras()),
                new Response<ConnectionRequest, Connection>() {
@@ -137,7 +138,8 @@ public abstract class ConnectionService extends CallService {
                        if (result.length != 1) {
                            Log.d(this, "adapter handleFailedOutgoingCall %s", callInfo);
                            getAdapter().handleFailedOutgoingCall(
                                    callInfo.getId(),
                                    request,
                                    DisconnectCause.ERROR_UNSPECIFIED,
                                    "Created " + result.length + " Connections, expected 1");
                            for (Connection c : result) {
                                c.abort();
@@ -150,8 +152,8 @@ public abstract class ConnectionService extends CallService {
                    }

                    @Override
                    public void onError(ConnectionRequest request, String reason) {
                        getAdapter().handleFailedOutgoingCall(callInfo.getId(), reason);
                    public void onError(ConnectionRequest request, int code, String msg) {
                        getAdapter().handleFailedOutgoingCall(request, code, msg);
                    }
                }
        );
@@ -168,6 +170,7 @@ public abstract class ConnectionService extends CallService {
        Log.d(this, "setIncomingCallId %s %s", callId, extras);
        onCreateIncomingConnection(
                new ConnectionRequest(
                        callId,
                        null,  // TODO: Can we obtain this from "extras"?
                        extras),
                new Response<ConnectionRequest, Connection>() {
@@ -176,7 +179,8 @@ public abstract class ConnectionService extends CallService {
                        if (result.length != 1) {
                            Log.d(this, "adapter handleFailedOutgoingCall %s", callId);
                            getAdapter().handleFailedOutgoingCall(
                                    callId,
                                    request,
                                    DisconnectCause.ERROR_UNSPECIFIED,
                                    "Created " + result.length + " Connections, expected 1");
                            for (Connection c : result) {
                                c.abort();
@@ -195,8 +199,9 @@ public abstract class ConnectionService extends CallService {
                    }

                    @Override
                    public void onError(ConnectionRequest request, String reason) {
                        Log.d(this, "adapter failed setIncomingCallId %s %s", request, reason);
                    public void onError(ConnectionRequest request, int code, String msg) {
                        Log.d(this, "adapter failed setIncomingCallId %s %d %s",
                                request, code, msg);
                    }
                }
        );
Loading