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

Commit 61203864 authored by Sailesh Nepal's avatar Sailesh Nepal
Browse files

Misc Telecomm API changes

The CL contains the following Telecomm API changes:
  - move CallFeatures into CallCapabilities
  - add Connection.setHandle(URI, CallPropertyPresentation)
  - add Connection.setCallerDisplayName(String,
    CallPropertyPresentation)
  - add Connection.swapWithBackground: this is used to swap a
    CDMA call with its background call
  - add StatusHints.getExtras: this is used to display
    additional status info such as long distance rates
This CL also includes InCallServcie, and RemoteConnection
plumbing for the above.

Change-Id: Iaffe0b84cea6003f2a9b9d8b30676743d2b236d4
parent 94686d13
Loading
Loading
Loading
Loading
+32 −25
Original line number Diff line number Diff line
@@ -27583,7 +27583,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 = 255; // 0xff
    field public static final int ALL = 3327; // 0xcff
    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
@@ -27593,21 +27593,16 @@ package android.telecomm {
    field public static final int SUPPORTS_VT_REMOTE = 512; // 0x200
    field public static final int SUPPORT_HOLD = 2; // 0x2
    field public static final int SWAP_CALLS = 8; // 0x8
    field public static final int VoLTE = 1024; // 0x400
    field public static final int VoWIFI = 2048; // 0x800
  }
  public final class CallFeatures {
    field public static final int NONE = 0; // 0x0
    field public static final int VoLTE = 1; // 0x1
    field public static final int VoWIFI = 2; // 0x2
  }
  public final class CallNumberPresentation extends java.lang.Enum {
    method public static android.telecomm.CallNumberPresentation valueOf(java.lang.String);
    method public static final android.telecomm.CallNumberPresentation[] values();
    enum_constant public static final android.telecomm.CallNumberPresentation ALLOWED;
    enum_constant public static final android.telecomm.CallNumberPresentation PAYPHONE;
    enum_constant public static final android.telecomm.CallNumberPresentation RESTRICTED;
    enum_constant public static final android.telecomm.CallNumberPresentation UNKNOWN;
  public class CallPropertyPresentation {
    ctor public CallPropertyPresentation();
    field public static final int ALLOWED = 0; // 0x0
    field public static final int PAYPHONE = 3; // 0x3
    field public static final int RESTRICTED = 1; // 0x1
    field public static final int UNKNOWN = 2; // 0x2
  }
  public final class CallServiceDescriptor implements android.os.Parcelable {
@@ -27690,9 +27685,11 @@ package android.telecomm {
    method public final android.telecomm.CallAudioState getCallAudioState();
    method public final int getCallCapabilities();
    method public final android.telecomm.CallVideoProvider getCallVideoProvider();
    method public final java.lang.String getCallerDisplayName();
    method public final int getCallerDisplayNamePresentation();
    method public final java.util.List<android.telecomm.Connection> getChildConnections();
    method public final int getFeatures();
    method public final android.net.Uri getHandle();
    method public final int getHandlePresentation();
    method public final android.telecomm.Connection getParentConnection();
    method public final int getState();
    method public final android.telecomm.StatusHints getStatusHints();
@@ -27711,16 +27708,17 @@ package android.telecomm {
    method protected void onSetAudioState(android.telecomm.CallAudioState);
    method protected void onSetState(int);
    method protected void onStopDtmfTone();
    method protected void onSwapWithBackgroundCall();
    method protected void onUnhold();
    method public final void setActive();
    method public final void setAudioModeIsVoip(boolean);
    method public final void setCallCapabilities(int);
    method public final void setCallVideoProvider(android.telecomm.CallVideoProvider);
    method public final void setCallerDisplayName(java.lang.String, int);
    method public final void setDestroyed();
    method public final void setDialing();
    method public final void setDisconnected(int, java.lang.String);
    method public final void setFeatures(int);
    method public final void setHandle(android.net.Uri);
    method public final void setHandle(android.net.Uri, int);
    method public final void setOnHold();
    method public final void setParentConnection(android.telecomm.Connection);
    method public final void setPostDialWait(java.lang.String);
@@ -27741,13 +27739,13 @@ package android.telecomm {
  }
  public final class ConnectionRequest implements android.os.Parcelable {
    ctor public ConnectionRequest(java.lang.String, android.net.Uri, android.os.Bundle, int);
    ctor public ConnectionRequest(android.telecomm.PhoneAccount, java.lang.String, android.net.Uri, android.os.Bundle, int);
    ctor public ConnectionRequest(android.telecomm.PhoneAccount, java.lang.String, android.net.Uri, int, android.os.Bundle, int);
    method public int describeContents();
    method public android.telecomm.PhoneAccount getAccount();
    method public java.lang.String getCallId();
    method public android.os.Bundle getExtras();
    method public android.net.Uri getHandle();
    method public int getHandlePresentation();
    method public int getVideoState();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
@@ -27794,6 +27792,7 @@ package android.telecomm {
    method public void rejectCall(java.lang.String, boolean, java.lang.String);
    method public void setAudioRoute(int);
    method public void stopDtmfTone(java.lang.String);
    method public void swapWithBackgroundCall(java.lang.String);
    method public void unholdCall(java.lang.String);
  }
@@ -27801,15 +27800,17 @@ package android.telecomm {
    method public int describeContents();
    method public android.telecomm.PhoneAccount getAccount();
    method public android.telecomm.RemoteCallVideoProvider getCallVideoProvider() throws android.os.RemoteException;
    method public java.lang.String getCallerDisplayName();
    method public int getCallerDisplayNamePresentation();
    method public java.util.List<java.lang.String> getCannedSmsResponses();
    method public int getCapabilities();
    method public long getConnectTimeMillis();
    method public android.telecomm.CallServiceDescriptor getCurrentCallServiceDescriptor();
    method public int getDisconnectCauseCode();
    method public java.lang.String getDisconnectCauseMsg();
    method public int getFeatures();
    method public android.telecomm.GatewayInfo getGatewayInfo();
    method public android.net.Uri getHandle();
    method public int getHandlePresentation();
    method public java.lang.String getId();
    method public android.telecomm.CallState getState();
    method public android.telecomm.StatusHints getStatusHints();
@@ -27878,9 +27879,12 @@ package android.telecomm {
    method public void disconnect();
    method public boolean getAudioModeIsVoip();
    method public int getCallCapabilities();
    method public java.lang.String getCallerDisplayName();
    method public int getCallerDisplayNamePresentation();
    method public int getDisconnectCause();
    method public java.lang.String getDisconnectMessage();
    method public int getFeatures();
    method public android.net.Uri getHandle();
    method public int getHandlePresentation();
    method public int getState();
    method public android.telecomm.StatusHints getStatusHints();
    method public void hold();
@@ -27890,19 +27894,21 @@ package android.telecomm {
    method public void removeListener(android.telecomm.RemoteConnection.Listener);
    method public void setAudioState(android.telecomm.CallAudioState);
    method public void stopDtmf();
    method public void swapWithBackgroundCall();
    method public void unhold();
  }
  public static abstract interface RemoteConnection.Listener {
    method public abstract void onAudioModeIsVoipChanged(android.telecomm.RemoteConnection, boolean);
    method public abstract void onCallCapabilitiesChanged(android.telecomm.RemoteConnection, int);
    method public abstract void onCallerDisplayNameChanged(android.telecomm.RemoteConnection, java.lang.String, int);
    method public abstract void onDestroyed(android.telecomm.RemoteConnection);
    method public abstract void onDisconnected(android.telecomm.RemoteConnection, int, java.lang.String);
    method public abstract void onFeaturesChanged(android.telecomm.RemoteConnection, int);
    method public abstract void onHandleChanged(android.telecomm.RemoteConnection, android.net.Uri, int);
    method public abstract void onPostDialWait(android.telecomm.RemoteConnection, java.lang.String);
    method public abstract void onRequestingRingback(android.telecomm.RemoteConnection, boolean);
    method public abstract void onSetAudioModeIsVoip(android.telecomm.RemoteConnection, boolean);
    method public abstract void onSetStatusHints(android.telecomm.RemoteConnection, android.telecomm.StatusHints);
    method public abstract void onStateChanged(android.telecomm.RemoteConnection, int);
    method public abstract void onStatusHintsChanged(android.telecomm.RemoteConnection, android.telecomm.StatusHints);
  }
  public abstract interface Response {
@@ -27916,9 +27922,10 @@ package android.telecomm {
  }
  public final class StatusHints implements android.os.Parcelable {
    ctor public StatusHints(android.content.ComponentName, java.lang.String, int);
    ctor public StatusHints(android.content.ComponentName, java.lang.String, int, android.os.Bundle);
    method public int describeContents();
    method public android.content.ComponentName getComponentName();
    method public android.os.Bundle getExtras();
    method public android.graphics.drawable.Drawable getIcon(android.content.Context);
    method public int getIconId();
    method public java.lang.String getLabel();
+11 −1
Original line number Diff line number Diff line
@@ -48,8 +48,12 @@ public final class CallCapabilities {
    /** Remote device supports video telephony. */
    public static final int SUPPORTS_VT_REMOTE = 0x00000200;

    public static final int VoLTE = 0x00000400;

    public static final int VoWIFI = 0x00000800;

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

    public static String toString(int capabilities) {
        StringBuilder builder = new StringBuilder();
@@ -84,6 +88,12 @@ public final class CallCapabilities {
        if ((capabilities & SUPPORTS_VT_REMOTE) != 0) {
            builder.append(" SUPPORTS_VT_REMOTE");
        }
        if ((capabilities & VoLTE) != 0) {
            builder.append(" VoLTE");
        }
        if ((capabilities & VoWIFI) != 0) {
            builder.append(" VoWIFI");
        }
        builder.append("]");
        return builder.toString();
    }
+0 −29
Original line number Diff line number Diff line
/*
 * Copyright (C) 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;

/**
 * Defines features of a call.  These features represent properties of a call for which it may be
 * desirable to display an in-call indicator.
 */
public final class CallFeatures {
    private CallFeatures() {};

    public static final int NONE = 0x0;
    public static final int VoLTE = 0x1;
    public static final int VoWIFI = 0x2;
}
 No newline at end of file
+9 −9
Original line number Diff line number Diff line
@@ -16,17 +16,17 @@

package android.telecomm;

/** Defines how numbers are displayed in caller id. */
public enum CallNumberPresentation {
    /** Number is displayed normally. */
    ALLOWED,
/** Defines how numbers and names are displayed in caller id. */
public class CallPropertyPresentation {
    /** Property is displayed normally. */
    public static final int ALLOWED = 0;

    /** Number was blocked. */
    RESTRICTED,
    /** Property was blocked. */
    public static final int RESTRICTED = 1;

    /** Presentation was not specified or is unknown. */
    UNKNOWN,
    public static final int UNKNOWN = 2;

    /** Number should be displayed as a pay phone. */
    PAYPHONE
    /** Property should be displayed as a pay phone. */
    public static final int PAYPHONE = 3;
}
+54 −81
Original line number Diff line number Diff line
@@ -32,62 +32,20 @@ import java.util.Set;
public abstract class Connection {

    /** @hide */
    public interface Listener {
        void onStateChanged(Connection c, int state);
        void onFeaturesChanged(Connection c, int features);
        void onHandleChanged(Connection c, Uri newHandle);
        void onSignalChanged(Connection c, Bundle details);
        void onDisconnected(Connection c, int cause, String message);
        void onPostDialWait(Connection c, String remaining);
        void onRequestingRingback(Connection c, boolean ringback);
        void onDestroyed(Connection c);
        void onCallCapabilitiesChanged(Connection c, int callCapabilities);
        void onParentConnectionChanged(Connection c, Connection parent);
        void onSetCallVideoProvider(Connection c, CallVideoProvider callVideoProvider);
        void onSetAudioModeIsVoip(Connection c, boolean isVoip);
        void onSetStatusHints(Connection c, StatusHints statusHints);
    }

    /** @hide */
    public static class ListenerBase implements Listener {
        @Override
    public abstract static class Listener {
        public void onStateChanged(Connection c, int state) {}

        /** {@inheritDoc} */
        @Override
        public void onFeaturesChanged(Connection c, int features) {}

        @Override
        public void onHandleChanged(Connection c, Uri newHandle) {}

        @Override
        public void onHandleChanged(Connection c, Uri newHandle, int presentation) {}
        public void onCallerDisplayNameChanged(
                Connection c, String callerDisplayName, int presentation) {}
        public void onSignalChanged(Connection c, Bundle details) {}

        @Override
        public void onDisconnected(Connection c, int cause, String message) {}

        @Override
        public void onDestroyed(Connection c) {}

        @Override
        public void onPostDialWait(Connection c, String remaining) {}

        @Override
        public void onRequestingRingback(Connection c, boolean ringback) {}

        @Override
        public void onDestroyed(Connection c) {}
        public void onCallCapabilitiesChanged(Connection c, int callCapabilities) {}

        @Override
        public void onParentConnectionChanged(Connection c, Connection parent) {}

        @Override
        public void onSetCallVideoProvider(Connection c, CallVideoProvider callVideoProvider) {}

        @Override
        public void onSetAudioModeIsVoip(Connection c, boolean isVoip) {}

        @Override
        public void onSetStatusHints(Connection c, StatusHints statusHints) {}
    }

@@ -106,9 +64,11 @@ public abstract class Connection {
    private final List<Connection> mChildConnections = new ArrayList<>();

    private int mState = State.NEW;
    private int mFeatures = CallFeatures.NONE;
    private CallAudioState mCallAudioState;
    private Uri mHandle;
    private int mHandlePresentation;
    private String mCallerDisplayName;
    private int mCallerDisplayNamePresentation;
    private boolean mRequestingRingback = false;
    private int mCallCapabilities;
    private Connection mParentConnection;
@@ -122,33 +82,39 @@ public abstract class Connection {
    protected Connection() {}

    /**
     * The handle (e.g., phone number) to which this Connection is currently communicating.
     *
     * IMPORTANT: If an incoming connection has a phone number (or other handle) that the user
     * is not supposed to be able to see (e.g. it is PRESENTATION_RESTRICTED), then a compliant
     * ConnectionService implementation MUST NOT reveal this phone number and MUST return
     * {@code null} from this method.
     *
     * @return The handle (e.g., phone number) to which this Connection
     *         is currently communicating.
     * @return The handle (e.g., phone number) to which this Connection is currently communicating.
     */
    public final Uri getHandle() {
        return mHandle;
    }

    /**
     * @return The state of this Connection.
     * @return The {@link CallPropertyPresentation} which controls how the handle is shown.
     */
    public final int getState() {
        return mState;
    public final int getHandlePresentation() {
        return mHandlePresentation;
    }

    /**
     * @return The caller display name (CNAP).
     */
    public final String getCallerDisplayName() {
        return mCallerDisplayName;
    }

    /**
     * @return The {@link CallPropertyPresentation} which controls how the caller display name is
     *         shown.
     */
    public final int getCallerDisplayNamePresentation() {
        return mCallerDisplayNamePresentation;
    }

    /**
     * @return The features of the call.  These are items for which the InCall UI may wish to
     *         display a visual indicator.
     * @return The state of this Connection.
     */
    public final int getFeatures() {
        return mFeatures;
    public final int getState() {
        return mState;
    }

    /**
@@ -287,31 +253,34 @@ public abstract class Connection {
    }

    /**
     * Sets the value of the {@link #getHandle()} property and notifies listeners.
     * Sets the value of the {@link #getHandle()} property.
     *
     * @param handle The new handle.
     * @param presentation The {@link CallPropertyPresentation} which controls how the handle is
     *         shown.
     */
    public final void setHandle(Uri handle) {
    public final void setHandle(Uri handle, int presentation) {
        Log.d(this, "setHandle %s", handle);
        mHandle = handle;
        mHandlePresentation = presentation;
        for (Listener l : mListeners) {
            l.onHandleChanged(this, handle);
            l.onHandleChanged(this, handle, presentation);
        }
    }

    /**
     * Set the features applicable to the connection.  These are items for which the InCall UI may
     * wish to display a visual indicator.
     * Features are defined in {@link android.telecomm.CallFeatures} and are passed in as a
     * bit-mask.
     * Sets the caller display name (CNAP).
     *
     * @param features The features active.
     */
    public final void setFeatures(int features) {
        Log.d(this, "setFeatures %d", features);
        mFeatures = features;
     * @param callerDisplayName The new display name.
     * @param presentation The {@link CallPropertyPresentation} which controls how the name is
     *         shown.
     */
    public final void setCallerDisplayName(String callerDisplayName, int presentation) {
        Log.d(this, "setCallerDisplayName %s", callerDisplayName);
        mCallerDisplayName = callerDisplayName;
        mCallerDisplayNamePresentation = presentation;
        for (Listener l : mListeners) {
            l.onFeaturesChanged(this, mFeatures);
            l.onCallerDisplayNameChanged(this, callerDisplayName, presentation);
        }
    }

@@ -428,8 +397,7 @@ public abstract class Connection {
    }

    /**
     * Notifies this Connection and listeners of a change in the current signal levels
     * for the underlying data transport.
     * Sets the current signal levels for the underlying data transport.
     *
     * @param details A {@link android.os.Bundle} containing details of the current level.
     */
@@ -464,8 +432,7 @@ public abstract class Connection {
    }

    /**
     * Notifies this Connection and listeners that the {@link #getCallAudioState()} property
     * has a new value.
     * Notifies this Connection that the {@link #getCallAudioState()} property has a new value.
     *
     * @param state The new call audio state.
     */
@@ -533,6 +500,12 @@ public abstract class Connection {
     */
    protected void onPostDialContinue(boolean proceed) {}

    /**
     * Swap this call with a background call. This is used for calls that don't support hold,
     * e.g. CDMA.
     */
    protected void onSwapWithBackgroundCall() {}

    /**
     * TODO(santoscordon): Needs documentation.
     */
Loading