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

Commit 2bed9563 authored by Sailesh Nepal's avatar Sailesh Nepal
Browse files

Remove handoff APIs

This CL removes the old handoff APIs and renames
handoffCall() to phoneAccountClicked().

Change-Id: Iab1595faaadcdfe428d97891d314babea21e9633
parent 2ad3c597
Loading
Loading
Loading
Loading
+3 −51
Original line number Diff line number Diff line
@@ -27472,8 +27472,7 @@ package android.telecomm {
  public final class CallCapabilities {
    method public static java.lang.String toString(int);
    field public static final int ADD_CALL = 16; // 0x10
    field public static final int ALL = 511; // 0x1ff
    field public static final int CONNECTION_HANDOFF = 256; // 0x100
    field public static final int ALL = 255; // 0xff
    field public static final int GENERIC_CONFERENCE = 128; // 0x80
    field public static final int HOLD = 1; // 0x1
    field public static final int MERGE_CALLS = 4; // 0x4
@@ -27515,43 +27514,8 @@ package android.telecomm {
  public abstract class CallService extends android.app.Service {
    ctor public CallService();
    method public abstract void abort(java.lang.String);
    method public abstract void answer(java.lang.String);
    method public abstract void call(android.telecomm.CallInfo);
    method public abstract void disconnect(java.lang.String);
    method protected final android.telecomm.CallServiceAdapter getAdapter();
    method public final android.os.IBinder getBinder();
    method public abstract void hold(java.lang.String);
    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);
    method public abstract void onFeaturesChanged(java.lang.String, int);
    method public void onPostDialContinue(java.lang.String, boolean);
    method public void onPostDialWait(android.telecomm.Connection, java.lang.String);
    method public abstract void playDtmfTone(java.lang.String, char);
    method public abstract void reject(java.lang.String);
    method public abstract void setIncomingCallId(java.lang.String, android.os.Bundle);
    method public abstract void stopDtmfTone(java.lang.String);
    method public abstract void unhold(java.lang.String);
  }
  public final class CallServiceAdapter implements android.os.IBinder.DeathRecipient {
    method public void addConferenceCall(java.lang.String);
    method public void binderDied();
    method public void cancelOutgoingCall(java.lang.String);
    method public void handleFailedOutgoingCall(android.telecomm.ConnectionRequest, int, java.lang.String);
    method public void handleSuccessfulOutgoingCall(java.lang.String);
    method public void handoffCall(java.lang.String);
    method public void notifyIncomingCall(android.telecomm.CallInfo);
    method public void onPostDialWait(java.lang.String, java.lang.String);
    method public void setActive(java.lang.String);
    method public void setCallVideoProvider(java.lang.String, android.telecomm.CallVideoProvider);
    method public void setDialing(java.lang.String);
    method public void setDisconnected(java.lang.String, int, java.lang.String);
    method public void setFeatures(java.lang.String, int);
    method public void setOnHold(java.lang.String);
    method public void setRequestingRingback(java.lang.String, boolean);
    method public void setRinging(java.lang.String);
  }
  public final class CallServiceDescriptor implements android.os.Parcelable {
@@ -27645,6 +27609,7 @@ package android.telecomm {
    method protected void onConference();
    method protected void onDisconnect();
    method protected void onHold();
    method protected void onPhoneAccountClicked();
    method protected void onPlayDtmfTone(char);
    method protected void onPostDialContinue(boolean);
    method protected void onReject();
@@ -27694,27 +27659,15 @@ package android.telecomm {
  public abstract class ConnectionService extends android.telecomm.CallService {
    ctor public ConnectionService();
    method public final void abort(java.lang.String);
    method public final void answer(java.lang.String);
    method public final void call(android.telecomm.CallInfo);
    method public final void createRemoteOutgoingConnection(android.telecomm.ConnectionRequest, android.telecomm.ConnectionService.OutgoingCallResponse<android.telecomm.RemoteConnection>);
    method public final void disconnect(java.lang.String);
    method public final java.util.Collection<android.telecomm.Connection> getAllConnections();
    method public final void hold(java.lang.String);
    method public final void lookupRemoteAccounts(android.net.Uri, android.telecomm.SimpleResponse<android.net.Uri, java.util.List<android.telecomm.PhoneAccount>>);
    method public final void maybeRespondToAccountLookup();
    method public final void onAudioStateChanged(java.lang.String, android.telecomm.CallAudioState);
    method protected void onConnectionAdded(android.telecomm.Connection);
    method protected void onConnectionRemoved(android.telecomm.Connection);
    method protected void onCreateConferenceConnection(java.lang.String, android.telecomm.Connection, android.telecomm.Response<java.lang.String, android.telecomm.Connection>);
    method protected void onCreateConnections(android.telecomm.ConnectionRequest, android.telecomm.ConnectionService.OutgoingCallResponse<android.telecomm.Connection>);
    method protected void onCreateIncomingConnection(android.telecomm.ConnectionRequest, android.telecomm.Response<android.telecomm.ConnectionRequest, android.telecomm.Connection>);
    method public final void onFeaturesChanged(java.lang.String, int);
    method public final void playDtmfTone(java.lang.String, char);
    method public final void reject(java.lang.String);
    method public final void setIncomingCallId(java.lang.String, android.os.Bundle);
    method public final void stopDtmfTone(java.lang.String);
    method public final void unhold(java.lang.String);
  }
  public static abstract interface ConnectionService.OutgoingCallResponse {
@@ -27736,9 +27689,9 @@ package android.telecomm {
  public final class InCallAdapter {
    method public void answerCall(java.lang.String);
    method public void disconnectCall(java.lang.String);
    method public void handoffCall(java.lang.String);
    method public void holdCall(java.lang.String);
    method public void mute(boolean);
    method public void phoneAccountClicked(java.lang.String);
    method public void playDtmfTone(java.lang.String, char);
    method public void postDialContinue(java.lang.String, boolean);
    method public void rejectCall(java.lang.String, boolean, java.lang.String);
@@ -27760,7 +27713,6 @@ package android.telecomm {
    method public int getFeatures();
    method public android.telecomm.GatewayInfo getGatewayInfo();
    method public android.net.Uri getHandle();
    method public android.telecomm.CallServiceDescriptor getHandoffCallServiceDescriptor();
    method public java.lang.String getId();
    method public android.telecomm.CallState getState();
    method public void writeToParcel(android.os.Parcel, int);
+1 −7
Original line number Diff line number Diff line
@@ -42,11 +42,8 @@ public final class CallCapabilities {
    /** Call supports generic conference mode. */
    public static final int GENERIC_CONFERENCE = 0x00000080;

    /** Call currently supports switch between connections. */
    public static final int CONNECTION_HANDOFF = 0x00000100;

    public static final int ALL = HOLD | SUPPORT_HOLD | MERGE_CALLS | SWAP_CALLS | ADD_CALL
            | RESPOND_VIA_TEXT | MUTE | GENERIC_CONFERENCE | CONNECTION_HANDOFF;
            | RESPOND_VIA_TEXT | MUTE | GENERIC_CONFERENCE;

    public static String toString(int capabilities) {
        StringBuilder builder = new StringBuilder();
@@ -75,9 +72,6 @@ public final class CallCapabilities {
        if ((capabilities & GENERIC_CONFERENCE) != 0) {
            builder.append(" GENERIC_CONFERENCE");
        }
        if ((capabilities & CONNECTION_HANDOFF) != 0) {
            builder.append(" HANDOFF");
        }
        builder.append("]");
        return builder.toString();
    }
+45 −133
Original line number Diff line number Diff line
@@ -31,11 +31,6 @@ import com.android.internal.telecomm.ICallServiceAdapter;
 * Base implementation of CallService which can be used to provide calls for the system
 * in-call UI. CallService is a one-way service from the framework's CallsManager to any app
 * that would like to provide calls managed by the default system in-call user interface.
 * When the service is bound by the framework, CallsManager will call setCallServiceAdapter
 * which will provide CallService with an instance of {@link CallServiceAdapter} to be used
 * for communicating back to CallsManager. Subsequently, more specific methods of the service
 * will be called to perform various call actions including making an outgoing call and
 * disconnected existing calls.
 * TODO(santoscordon): Needs more about AndroidManifest.xml service registrations before
 * we can unhide this API.
 *
@@ -61,6 +56,7 @@ public abstract class CallService extends Service {
    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;
    private static final int MSG_ON_PHONE_ACCOUNT_CLICKED = 16;

    /**
     * Default Handler used to consolidate binder method calls onto a single thread.
@@ -147,6 +143,9 @@ public abstract class CallService extends Service {
                case MSG_SPLIT_FROM_CONFERENCE:
                    splitFromConference((String) msg.obj);
                    break;
                case MSG_ON_PHONE_ACCOUNT_CLICKED:
                    onPhoneAccountClicked((String) msg.obj);
                    break;
                default:
                    break;
            }
@@ -244,6 +243,12 @@ public abstract class CallService extends Service {
            args.argi1 = proceed ? 1 : 0;
            mMessageHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
        }

        @Override
        public void onPhoneAccountClicked(String callId) {
            mMessageHandler.obtainMessage(MSG_ON_PHONE_ACCOUNT_CLICKED, callId).sendToTarget();
        }

    }

    /**
@@ -272,152 +277,59 @@ public abstract class CallService extends Service {
        return mBinder;
    }

    /**
     * @return The attached {@link CallServiceAdapter} if the service is bound, null otherwise.
     */
    /** @hide */
    protected final CallServiceAdapter getAdapter() {
        return mAdapter;
    }

    /**
     * Lifecycle callback which is called when this {@link CallService} has been attached to a
     * {@link CallServiceAdapter}, indicating {@link #getAdapter()} is now safe to use.
     *
     * @param adapter The adapter now attached to this call service.
     */
    protected void onAdapterAttached(CallServiceAdapter adapter) {
    }
    /** @hide */
    protected abstract void onAdapterAttached(CallServiceAdapter adapter);

    /**
     * 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.
     *
     * @param callInfo The details of the relevant call.
     */
    public abstract void call(CallInfo callInfo);
    /** @hide */
    protected abstract void call(CallInfo callInfo);

    /**
     * Aborts the outgoing call attempt. Invoked in the unlikely event that Telecomm decides to
     * abort an attempt to place a call.  Only ever be invoked after {@link #call} invocations.
     * After this is invoked, Telecomm does not expect any more updates about the call and will
     * actively ignore any such update. This is different from {@link #disconnect} where Telecomm
     * expects confirmation via CallServiceAdapter.markCallAsDisconnected.
     *
     * @param callId The identifier of the call to abort.
     */
    public abstract void abort(String callId);
    /** @hide */
    protected abstract void abort(String callId);

    /**
     * Receives a new call ID to use with an incoming call. Invoked by Telecomm after it is notified
     * that this call service has a pending incoming call, see
     * {@link TelecommConstants#ACTION_INCOMING_CALL}. The call service must first give Telecomm
     * additional information about the call through {@link CallServiceAdapter#notifyIncomingCall}.
     * Following that, the call service can update the call at will using the specified call ID.
     *
     * If a {@link Bundle} was passed (via {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}) in
     * with the {@link TelecommConstants#ACTION_INCOMING_CALL} intent, <code>extras</code> will be
     * populated with this {@link Bundle}. Otherwise, an empty Bundle will be returned.
     *
     * @param callId The ID of the call.
     * @param extras The optional extras which were passed in with the intent, or an empty Bundle.
     */
    public abstract void setIncomingCallId(String callId, Bundle extras);
    /** @hide */
    protected abstract void setIncomingCallId(String callId, Bundle extras);

    /**
     * Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
     * user hitting the "answer" button in the incoming call screen.
     *
     * @param callId The ID of the call.
     */
    public abstract void answer(String callId);
    /** @hide */
    protected abstract void answer(String callId);

    /**
     * Rejects a ringing call identified by callId. Telecomm invokes this method as a result of the
     * user hitting the "reject" button in the incoming call screen.
     *
     * @param callId The ID of the call.
     */
    public abstract void reject(String callId);
    /** @hide */
    protected abstract void reject(String callId);

    /**
     * Disconnects the specified call.
     *
     * @param callId The ID of the call to disconnect.
     */
    public abstract void disconnect(String callId);
    /** @hide */
    protected abstract void disconnect(String callId);

    /**
     * Puts the specified call on hold.
     *
     * @param callId The ID of the call to put on hold.
     */
    public abstract void hold(String callId);
    /** @hide */
    protected abstract void hold(String callId);

    /**
     * Removes the specified call from hold.
     *
     * @param callId The ID of the call to unhold.
     */
    public abstract void unhold(String callId);
    /** @hide */
    protected abstract void unhold(String callId);

    /**
     * Plays a dual-tone multi-frequency signaling (DTMF) tone in a call.
     *
     * @param callId The unique ID of the call in which the tone will be played.
     * @param digit A character representing the DTMF digit for which to play the tone. This
     *         value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}.
     */
    public abstract void playDtmfTone(String callId, char digit);
    /** @hide */
    protected abstract void playDtmfTone(String callId, char digit);

    /**
     * Stops any dual-tone multi-frequency sinaling (DTMF) tone currently playing.
     *
     * DTMF tones are played by calling {@link #playDtmfTone(String,char)}. If no DTMF tone is
     * currently playing, this method will do nothing.
     *
     * @param callId The unique ID of the call in which any currently playing tone will be stopped.
     */
    public abstract void stopDtmfTone(String callId);
    /** @hide */
    protected abstract void stopDtmfTone(String callId);

    /**
     * Called when the audio state changes.
     *
     * @param activeCallId The identifier of the call that was active during the state change.
     * @param audioState The new {@link CallAudioState}.
     */
    public abstract void onAudioStateChanged(String activeCallId, CallAudioState audioState);
    /** @hide */
    protected abstract void onAudioStateChanged(String activeCallId, CallAudioState audioState);

    /**
     * Conferences the specified call.
     *
     * @param conferenceCallId The unique ID of the conference call onto which the specified calls
     *         should be added.
     * @param callId The call to conference.
     * @hide
     */
    public abstract void conference(String conferenceCallId, String callId);
    /** @hide */
    protected abstract void conference(String conferenceCallId, String callId);

    /**
     * Removes the specified call from a conference call.
     *
     * @param callId The call to remove from the conference call
     * @hide
     */
    public abstract void splitFromConference(String callId);
    /** @hide */
    protected abstract void splitFromConference(String callId);

    public void onPostDialContinue(String callId, boolean proceed) {}
    /** @hide */
    protected abstract void onPostDialContinue(String callId, boolean proceed);

    public void onPostDialWait(Connection conn, String remaining) {}
    /** @hide */
    protected abstract void onFeaturesChanged(String callId, int features);

    /**
     * Called when changes to the features of a call occurs. Features are defined in
     * {@link android.telecomm.CallFeatures}.  The active features for the call are represented as
     * bits in the features bit-mask.
     *
     * @param callId The call to set the features for.
     * @param features The new features of the call.
     */
    public abstract void onFeaturesChanged(String callId, int features);
    /** @hide */
    protected abstract void onPhoneAccountClicked(String callId);
}
+2 −15
Original line number Diff line number Diff line
@@ -33,8 +33,9 @@ import java.util.Set;

/**
 * Provides methods for ICallService implementations to interact with the system phone app.
 * TODO(santoscordon): Need final public-facing comments in this file.
 * TODO(santoscordon): Rename this to CallServiceAdapterDemultiplexer (or something).
 *
 * @hide
 */
public final class CallServiceAdapter implements DeathRecipient {
    private final Set<ICallServiceAdapter> mAdapters = new HashSet<>();
@@ -297,20 +298,6 @@ public final class CallServiceAdapter implements DeathRecipient {
        }
    }

    /**
     * Instructs Telecomm to handoff the call to another call service.
     *
     * @param callId The identifier of the call to handoff.
     */
    public void handoffCall(String callId) {
        for (ICallServiceAdapter adapter : mAdapters) {
            try {
                adapter.handoffCall(callId);
            } catch (RemoteException e) {
            }
        }
    }

    /**
     * Indicates that a new conference call has been created.
     *
+6 −0
Original line number Diff line number Diff line
@@ -611,6 +611,12 @@ public abstract class Connection {
     */
    protected void onChildrenChanged(List<Connection> children) {}

    /**
     * Called when the phone account UI was clicked.
     */
    protected void onPhoneAccountClicked() {}


    private void addChild(Connection connection) {
        Log.d(this, "adding child %s", connection);
        mChildConnections.add(connection);
Loading