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

Commit 52a28f61 authored by Ihab Awad's avatar Ihab Awad
Browse files

Replace CallServiceSelectors with Subscriptions (1/3)

Remove CallServiceSelectors and replace them with comprehensive
support for Subscriptions as the means of selecting ways of making
phone calls. After this change, a ConnectionService is not a
semantically meaningful "way of making a call" -- it's more like the
mechanism whereby the Android system communicates with a 3rd party
process to ask for phone services. We anticipate each process having
only one ConnectionService.

Change-Id: I11e6e246ae999683b3800496e98c93c3351aca7b
parent 43015f24
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -330,8 +330,6 @@ LOCAL_SRC_FILES += \
	telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl \
	telecomm/java/com/android/internal/telecomm/ICallServiceLookupResponse.aidl \
	telecomm/java/com/android/internal/telecomm/ICallServiceProvider.aidl \
	telecomm/java/com/android/internal/telecomm/ICallServiceSelector.aidl \
	telecomm/java/com/android/internal/telecomm/ICallServiceSelectorAdapter.aidl \
	telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl \
	telecomm/java/com/android/internal/telecomm/IInCallService.aidl \
	telecomm/java/com/android/internal/telecomm/ITelecommService.aidl \
+1 −21
Original line number Diff line number Diff line
@@ -27562,7 +27562,6 @@ package android.telecomm {
    method protected final android.telecomm.CallServiceAdapter getAdapter();
    method public final android.os.IBinder getBinder();
    method public abstract void hold(java.lang.String);
    method public abstract void isCompatibleWith(android.telecomm.CallInfo);
    method protected void onAdapterAttached(android.telecomm.CallServiceAdapter);
    method public abstract void onAudioStateChanged(java.lang.String, android.telecomm.CallAudioState);
    method public final android.os.IBinder onBind(android.content.Intent);
@@ -27585,7 +27584,6 @@ package android.telecomm {
    method public void setActive(java.lang.String);
    method public void setDialing(java.lang.String);
    method public void setDisconnected(java.lang.String, int, java.lang.String);
    method public void setIsCompatibleWith(java.lang.String, boolean);
    method public void setOnHold(java.lang.String);
    method public void setRequestingRingback(java.lang.String, boolean);
    method public void setRinging(java.lang.String);
@@ -27620,22 +27618,6 @@ package android.telecomm {
    method public android.os.IBinder onBind(android.content.Intent);
  }
  public abstract class CallServiceSelector extends android.app.Service {
    ctor protected CallServiceSelector();
    method protected final void cancelOutgoingCall(android.telecomm.CallInfo);
    method protected final android.telecomm.CallServiceSelectorAdapter getAdapter();
    method protected final java.util.Collection<android.telecomm.CallInfo> getCalls();
    method protected void onAdapterAttached(android.telecomm.CallServiceSelectorAdapter);
    method public final android.os.IBinder onBind(android.content.Intent);
    method protected abstract void select(android.telecomm.CallInfo, java.util.List<android.telecomm.CallServiceDescriptor>);
  }
  public final class CallServiceSelectorAdapter {
    method public void cancelOutgoingCall(java.lang.String);
    method public void setHandoffInfo(java.lang.String, android.net.Uri, android.os.Bundle);
    method public void setSelectedCallServices(java.lang.String, java.util.List<android.telecomm.CallServiceDescriptor>);
  }
  public final class CallState extends java.lang.Enum {
    method public static android.telecomm.CallState valueOf(java.lang.String);
    method public static final android.telecomm.CallState[] values();
@@ -27656,6 +27638,7 @@ package android.telecomm {
    method public java.util.List<android.telecomm.Connection> getChildConnections();
    method public final android.net.Uri getHandle();
    method public android.telecomm.Connection getParentConnection();
    method public boolean isConferenceCapable();
    method public boolean isConferenceConnection();
    method public boolean isRequestingRingback();
    method protected void onAbort();
@@ -27740,14 +27723,12 @@ package android.telecomm {
    method public final void disconnect(java.lang.String);
    method public java.util.Collection<android.telecomm.Connection> getAllConnections();
    method public final void hold(java.lang.String);
    method public final void isCompatibleWith(android.telecomm.CallInfo);
    method public final void onAudioStateChanged(java.lang.String, android.telecomm.CallAudioState);
    method public void onConnectionAdded(android.telecomm.Connection);
    method public void onConnectionRemoved(android.telecomm.Connection);
    method public void onCreateConferenceConnection(java.lang.String, android.telecomm.Connection, android.telecomm.Response<java.lang.String, android.telecomm.Connection>);
    method public void onCreateConnections(android.telecomm.ConnectionRequest, android.telecomm.Response<android.telecomm.ConnectionRequest, android.telecomm.Connection>);
    method public void onCreateIncomingConnection(android.telecomm.ConnectionRequest, android.telecomm.Response<android.telecomm.ConnectionRequest, android.telecomm.Connection>);
    method public void onFindSubscriptions(android.net.Uri, android.telecomm.Response<android.net.Uri, android.telecomm.Subscription>);
    method public final void onPostDialContinue(java.lang.String, boolean);
    method public final void onPostDialWait(android.telecomm.Connection, java.lang.String);
    method public final void playDtmfTone(java.lang.String, char);
@@ -27836,7 +27817,6 @@ package android.telecomm {
    ctor public TelecommConstants();
    field public static final java.lang.String ACTION_CALL_SERVICE;
    field public static final java.lang.String ACTION_CALL_SERVICE_PROVIDER;
    field public static final java.lang.String ACTION_CALL_SERVICE_SELECTOR;
    field public static final java.lang.String ACTION_INCOMING_CALL = "android.intent.action.INCOMING_CALL";
    field public static final char DTMF_CHARACTER_PAUSE = 44; // 0x002c ','
    field public static final char DTMF_CHARACTER_WAIT = 59; // 0x003b ';'
+1 −2
Original line number Diff line number Diff line
@@ -52,8 +52,7 @@ public final class CallInfo implements Parcelable {
    private final GatewayInfo mGatewayInfo;

    /**
     * Additional information that can be persisted. For example, extra handoff information can
     * attached to a call using {@link CallServiceSelectorAdapter#setHandoffInfo(String,Uri,Bundle).
     * Additional information that can be persisted.
     */
    private final Bundle mExtras;

+15 −35
Original line number Diff line number Diff line
@@ -49,21 +49,20 @@ import java.util.List;
public abstract class CallService extends Service {

    private static final int MSG_SET_CALL_SERVICE_ADAPTER = 1;
    private static final int MSG_IS_COMPATIBLE_WITH = 2;
    private static final int MSG_CALL = 3;
    private static final int MSG_ABORT = 4;
    private static final int MSG_SET_INCOMING_CALL_ID = 5;
    private static final int MSG_ANSWER = 6;
    private static final int MSG_REJECT = 7;
    private static final int MSG_DISCONNECT = 8;
    private static final int MSG_HOLD = 9;
    private static final int MSG_UNHOLD = 10;
    private static final int MSG_ON_AUDIO_STATE_CHANGED = 11;
    private static final int MSG_PLAY_DTMF_TONE = 12;
    private static final int MSG_STOP_DTMF_TONE = 13;
    private static final int MSG_CONFERENCE = 14;
    private static final int MSG_SPLIT_FROM_CONFERENCE = 15;
    private static final int MSG_ON_POST_DIAL_CONTINUE = 16;
    private static final int MSG_CALL = 2;
    private static final int MSG_ABORT = 3;
    private static final int MSG_SET_INCOMING_CALL_ID = 4;
    private static final int MSG_ANSWER = 5;
    private static final int MSG_REJECT = 6;
    private static final int MSG_DISCONNECT = 7;
    private static final int MSG_HOLD = 8;
    private static final int MSG_UNHOLD = 9;
    private static final int MSG_ON_AUDIO_STATE_CHANGED = 10;
    private static final int MSG_PLAY_DTMF_TONE = 11;
    private static final int MSG_STOP_DTMF_TONE = 12;
    private static final int MSG_CONFERENCE = 13;
    private static final int MSG_SPLIT_FROM_CONFERENCE = 14;
    private static final int MSG_ON_POST_DIAL_CONTINUE = 15;

    /**
     * Default Handler used to consolidate binder method calls onto a single thread.
@@ -76,9 +75,6 @@ public abstract class CallService extends Service {
                    mAdapter = new CallServiceAdapter((ICallServiceAdapter) msg.obj);
                    onAdapterAttached(mAdapter);
                    break;
                case MSG_IS_COMPATIBLE_WITH:
                    isCompatibleWith((CallInfo) msg.obj);
                    break;
                case MSG_CALL:
                    call((CallInfo) msg.obj);
                    break;
@@ -169,11 +165,6 @@ public abstract class CallService extends Service {
                    .sendToTarget();
        }

        @Override
        public void isCompatibleWith(CallInfo callInfo) {
            mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, callInfo).sendToTarget();
        }

        @Override
        public void call(CallInfo callInfo) {
            mMessageHandler.obtainMessage(MSG_CALL, callInfo).sendToTarget();
@@ -299,22 +290,11 @@ public abstract class CallService extends Service {
    protected void onAdapterAttached(CallServiceAdapter adapter) {
    }

    /**
     * Determines if the CallService can place the specified call. Response is sent via
     * {@link CallServiceAdapter#setIsCompatibleWith}. When responding, the correct call ID must be
     * specified.  Only used in the context of outgoing calls and call switching (handoff).
     *
     * @param callInfo The details of the relevant call.
     */
    public abstract void isCompatibleWith(CallInfo callInfo);

    /**
     * Attempts to call the relevant party using the specified call's handle, be it a phone number,
     * SIP address, or some other kind of user ID.  Note that the set of handle types is
     * dynamically extensible since call providers should be able to implement arbitrary
     * handle-calling systems.  See {@link #isCompatibleWith}. It is expected that the
     * call service respond via {@link CallServiceAdapter#handleSuccessfulOutgoingCall(String)}
     * if it can successfully make the call.  Only used in the context of outgoing calls.
     * handle-calling systems.
     *
     * @param callInfo The details of the relevant call.
     */
+0 −16
Original line number Diff line number Diff line
@@ -36,22 +36,6 @@ public final class CallServiceAdapter {
        mAdapter = adapter;
    }

    /**
     * Receives confirmation of a call service's ability to place a call. This method is used in
     * response to {@link CallService#isCompatibleWith}.
     *
     * @param callId The identifier of the call for which compatibility is being received. This ID
     *     should correspond to the ID given as part of the call information in
     *     {@link CallService#isCompatibleWith}.
     * @param isCompatible True if the call service can place the call.
     */
    public void setIsCompatibleWith(String callId, boolean isCompatible) {
        try {
            mAdapter.setIsCompatibleWith(callId, isCompatible);
        } catch (RemoteException e) {
        }
    }

    /**
     * Provides Telecomm with the details of an incoming call. An invocation of this method must
     * follow {@link CallService#setIncomingCallId} and use the call ID specified therein. Upon
Loading