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

Commit e086d088 authored by Grace Jia's avatar Grace Jia
Browse files

Add API for cross device calling.

Test: CTS test
Change-Id: I1a3aa6c1ae6d445a2f3b55e5f0d11918da5bed33
parent 0ace72cb
Loading
Loading
Loading
Loading
+56 −2
Original line number Diff line number Diff line
@@ -40156,6 +40156,7 @@ package android.telecom {
  public final class Call {
    method public void addConferenceParticipants(@NonNull java.util.List<android.net.Uri>);
    method public void answer(int);
    method public void answerCall(@NonNull android.telecom.CallEndpoint, int);
    method public void conference(android.telecom.Call);
    method public void deflect(android.net.Uri);
    method public void disconnect();
@@ -40176,7 +40177,9 @@ package android.telecom {
    method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
    method public void playDtmfTone(char);
    method public void postDialContinue(boolean);
    method public void pullExternalCall();
    method public void pullCall();
    method @Deprecated public void pullExternalCall();
    method public void pushCall(@NonNull android.telecom.CallEndpoint);
    method public void putExtras(android.os.Bundle);
    method public void registerCallback(android.telecom.Call.Callback);
    method public void registerCallback(android.telecom.Call.Callback, android.os.Handler);
@@ -40219,7 +40222,10 @@ package android.telecom {
  public abstract static class Call.Callback {
    ctor public Call.Callback();
    method public void onAnswerFailed(@NonNull android.telecom.CallEndpoint, int);
    method public void onCallDestroyed(android.telecom.Call);
    method public void onCallPullFailed(int);
    method public void onCallPushFailed(@NonNull android.telecom.CallEndpoint, int);
    method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
    method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
    method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
@@ -40235,11 +40241,22 @@ package android.telecom {
    method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
    method public void onStateChanged(android.telecom.Call, int);
    method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
    field public static final int ANSWER_FAILED_ENDPOINT_REJECTED = 3; // 0x3
    field public static final int ANSWER_FAILED_ENDPOINT_TIMEOUT = 2; // 0x2
    field public static final int ANSWER_FAILED_ENDPOINT_UNAVAILABLE = 1; // 0x1
    field public static final int ANSWER_FAILED_UNKNOWN_REASON = 0; // 0x0
    field public static final int HANDOVER_FAILURE_DEST_APP_REJECTED = 1; // 0x1
    field public static final int HANDOVER_FAILURE_NOT_SUPPORTED = 2; // 0x2
    field public static final int HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL = 4; // 0x4
    field public static final int HANDOVER_FAILURE_UNKNOWN = 5; // 0x5
    field public static final int HANDOVER_FAILURE_USER_REJECTED = 3; // 0x3
    field public static final int PULL_FAILED_ENDPOINT_REJECTED = 2; // 0x2
    field public static final int PULL_FAILED_ENDPOINT_TIMEOUT = 1; // 0x1
    field public static final int PULL_FAILED_UNKNOWN_REASON = 0; // 0x0
    field public static final int PUSH_FAILED_ENDPOINT_REJECTED = 3; // 0x3
    field public static final int PUSH_FAILED_ENDPOINT_TIMEOUT = 2; // 0x2
    field public static final int PUSH_FAILED_ENDPOINT_UNAVAILABLE = 1; // 0x1
    field public static final int PUSH_FAILED_UNKNOWN_REASON = 0; // 0x0
  }
  public static class Call.Details {
@@ -40247,6 +40264,8 @@ package android.telecom {
    method public boolean can(int);
    method public static String capabilitiesToString(int);
    method public android.telecom.PhoneAccountHandle getAccountHandle();
    method @Nullable public android.telecom.CallEndpoint getActiveCallEndpoint();
    method @NonNull public java.util.Set<android.telecom.CallEndpoint> getAvailableCallEndpoints();
    method public int getCallCapabilities();
    method public int getCallDirection();
    method public int getCallProperties();
@@ -40340,6 +40359,34 @@ package android.telecom {
    field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5
  }
  public final class CallEndpoint implements android.os.Parcelable {
    ctor public CallEndpoint(@NonNull android.os.ParcelUuid, @NonNull CharSequence, int, @NonNull android.content.ComponentName);
    method public int describeContents();
    method @NonNull public CharSequence getDescription();
    method @NonNull public android.os.ParcelUuid getIdentifier();
    method public int getType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.CallEndpoint> CREATOR;
    field public static final int ENDPOINT_TYPE_TETHERED = 2; // 0x2
    field public static final int ENDPOINT_TYPE_UNTETHERED = 1; // 0x1
  }
  public interface CallEndpointCallback {
    method public void onCallEndpointSessionActivationTimeout();
    method public void onCallEndpointSessionDeactivated();
  }
  public class CallEndpointSession {
    method public void setCallEndpointSessionActivated();
    method public void setCallEndpointSessionActivationFailed(int);
    method public void setCallEndpointSessionDeactivated();
    field public static final int ACTIVATION_FAILURE_REJECTED = 1; // 0x1
    field public static final int ACTIVATION_FAILURE_UNAVAILABLE = 0; // 0x0
    field public static final int ANSWER_REQUEST = 1; // 0x1
    field public static final int PLACE_REQUEST = 3; // 0x3
    field public static final int PUSH_REQUEST = 2; // 0x2
  }
  public abstract class CallRedirectionService extends android.app.Service {
    ctor public CallRedirectionService();
    method public final void cancelCall();
@@ -40609,7 +40656,6 @@ package android.telecom {
    field public static final int PROPERTY_IS_RTT = 256; // 0x100
    field public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 1024; // 0x400
    field public static final int PROPERTY_SELF_MANAGED = 128; // 0x80
    field public static final int PROPERTY_TETHERED_CALL = 16384; // 0x4000
    field public static final int PROPERTY_WIFI = 8; // 0x8
    field public static final int STATE_ACTIVE = 4; // 0x4
    field public static final int STATE_DIALING = 3; // 0x3
@@ -40743,6 +40789,8 @@ package android.telecom {
    field public static final int OTHER = 9; // 0x9
    field public static final String REASON_EMERGENCY_CALL_PLACED = "REASON_EMERGENCY_CALL_PLACED";
    field public static final String REASON_EMULATING_SINGLE_CALL = "EMULATING_SINGLE_CALL";
    field public static final String REASON_ENDPOINT_REJECTED = "REASON_ENDPOINT_REJECTED";
    field public static final String REASON_ENDPOINT_SESSION_DEACTIVATED = "REASON_ENDPOINT_SESSION_DEACTIVATED";
    field public static final String REASON_IMS_ACCESS_BLOCKED = "REASON_IMS_ACCESS_BLOCKED";
    field public static final String REASON_WIFI_ON_BUT_WFC_OFF = "REASON_WIFI_ON_BUT_WFC_OFF";
    field public static final int REJECTED = 6; // 0x6
@@ -40771,6 +40819,7 @@ package android.telecom {
    method public void onBringToForeground(boolean);
    method public void onCallAdded(android.telecom.Call);
    method public void onCallAudioStateChanged(android.telecom.CallAudioState);
    method @NonNull public android.telecom.CallEndpointCallback onCallEndpointActivationRequested(@NonNull android.telecom.CallEndpoint, @NonNull android.telecom.CallEndpointSession) throws java.lang.UnsupportedOperationException;
    method public void onCallRemoved(android.telecom.Call);
    method public void onCanAddCallChanged(boolean);
    method public void onConnectionEvent(android.telecom.Call, String, android.os.Bundle);
@@ -41033,6 +41082,7 @@ package android.telecom {
    method @Deprecated @RequiresPermission(android.Manifest.permission.ANSWER_PHONE_CALLS) public boolean endCall();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.net.Uri getAdnUriForPhoneAccount(android.telecom.PhoneAccountHandle);
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts();
    method @NonNull public java.util.Set<android.telecom.CallEndpoint> getCallEndpoints();
    method public String getDefaultDialerPackage();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(String);
    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}, conditional=true) public String getLine1Number(android.telecom.PhoneAccountHandle);
@@ -41053,10 +41103,12 @@ package android.telecom {
    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public boolean isTtySupported();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, String);
    method @RequiresPermission(anyOf={android.Manifest.permission.CALL_PHONE, android.Manifest.permission.MANAGE_OWN_CALLS}) public void placeCall(android.net.Uri, android.os.Bundle);
    method public void registerCallEndpoints(@NonNull java.util.Set<android.telecom.CallEndpoint>);
    method public void registerPhoneAccount(android.telecom.PhoneAccount);
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void showInCallScreen(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void silenceRinger();
    method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void startConference(@NonNull java.util.List<android.net.Uri>, @NonNull android.os.Bundle);
    method public void unregisterCallEndpoints(@NonNull java.util.Set<android.telecom.CallEndpoint>);
    method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
    field public static final String ACTION_CHANGE_DEFAULT_DIALER = "android.telecom.action.CHANGE_DEFAULT_DIALER";
    field public static final String ACTION_CHANGE_PHONE_ACCOUNTS = "android.telecom.action.CHANGE_PHONE_ACCOUNTS";
@@ -41100,6 +41152,7 @@ package android.telecom {
    field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telecom.extra.PHONE_ACCOUNT_HANDLE";
    field public static final String EXTRA_PICTURE_URI = "android.telecom.extra.PICTURE_URI";
    field public static final String EXTRA_PRIORITY = "android.telecom.extra.PRIORITY";
    field public static final String EXTRA_START_CALL_ON_ENDPOINT = "android.telecom.extra.START_CALL_ON_ENDPOINT";
    field public static final String EXTRA_START_CALL_WITH_RTT = "android.telecom.extra.START_CALL_WITH_RTT";
    field public static final String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.telecom.extra.START_CALL_WITH_SPEAKERPHONE";
    field public static final String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE";
@@ -41111,6 +41164,7 @@ package android.telecom {
    field public static final String METADATA_IN_CALL_SERVICE_CAR_MODE_UI = "android.telecom.IN_CALL_SERVICE_CAR_MODE_UI";
    field public static final String METADATA_IN_CALL_SERVICE_RINGING = "android.telecom.IN_CALL_SERVICE_RINGING";
    field public static final String METADATA_IN_CALL_SERVICE_UI = "android.telecom.IN_CALL_SERVICE_UI";
    field public static final String METADATA_STREAMING_TETHERED_CALLS = "android.telecom.STREAMING_TETHERED_CALLS";
    field public static final int PRESENTATION_ALLOWED = 1; // 0x1
    field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
    field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
+268 −33

File changed.

Preview size limit exceeded, changes collapsed.

+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.telecom;

/**
 * {@hide}
  */
parcelable CallEndpoint;
+150 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.telecom;


import android.annotation.IntDef;
import android.annotation.NonNull;
import android.content.ComponentName;
import android.os.Parcel;
import android.os.ParcelUuid;
import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;

/**
 * Represents the endpoint on which a call can be carried by the user.
 *
 * For example, the user may be able to carry out a call on another device on their local network
 * using a call streaming solution, or may be able to carry out a call on another device registered
 * with the same mobile line of service.
 */
public final class CallEndpoint implements Parcelable {
    /**
     * @hide
     */
    @IntDef(prefix = {"ENDPOINT_TYPE_"},
            value = {ENDPOINT_TYPE_TETHERED, ENDPOINT_TYPE_UNTETHERED})
    @Retention(RetentionPolicy.SOURCE)
    public @interface EndpointType {}

    /** Indicates the endpoint contains a complete calling stack and is capable of carrying out a
     *  call on its own. Untethered endpoints are typically other devices which share the same
     *  mobile line of service as the current device.
     */
    public static final int ENDPOINT_TYPE_UNTETHERED = 1;

    /** Indicates the endpoint itself doesn't have the required calling infrastructure in order to
     *  complete a call on its own. Tethered endpoints depend on a call streaming solution to
     *  transport the media and control for a call to another device, while depending on the current
     *  device to connect the call to the mobile network.
     */
    public static final int ENDPOINT_TYPE_TETHERED = 2;

    private final ParcelUuid mUuid;
    private CharSequence mDescription;
    private final int mType;
    private final ComponentName mComponentName;

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

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        mUuid.writeToParcel(dest, flags);
        dest.writeCharSequence(mDescription);
        dest.writeInt(mType);
        mComponentName.writeToParcel(dest, flags);
    }

    public static final @android.annotation.NonNull Creator<CallEndpoint> CREATOR =
            new Creator<CallEndpoint>() {
                @Override
                public CallEndpoint createFromParcel(Parcel in) {
                    return new CallEndpoint(in);
                }

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

    public CallEndpoint(@NonNull ParcelUuid uuid, @NonNull CharSequence description, int type,
            @NonNull ComponentName componentName) {
        mUuid = uuid;
        mDescription = description;
        mType = type;
        mComponentName = componentName;
    }

    private CallEndpoint(@NonNull Parcel in) {
        this(ParcelUuid.CREATOR.createFromParcel(in), in.readCharSequence(), in.readInt(),
                ComponentName.CREATOR.createFromParcel(in));
    }

    /**
     * A unique identifier for this call endpoint. An endpoint provider should take care to use an
     * identifier which is stable for the current association between an endpoint and the current
     * device, but which is not globally identifying.
     * @return the unique identifier.
     */
    public @NonNull ParcelUuid getIdentifier() {
        return mUuid;
    }

    /**
     * A human-readable description of this {@link CallEndpoint}. An {@link InCallService} uses
     * when informing the user of the endpoint.
     * @return the description.
     */
    public @NonNull CharSequence getDescription() {
        return mDescription;
    }

    public @EndpointType int getType() {
        return mType;
    }

    /**
     * @hide
     */
    public @NonNull ComponentName getComponentName() {
        return mComponentName;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof CallEndpoint) {
            CallEndpoint d = (CallEndpoint) o;
            return Objects.equals(mUuid, d.mUuid)
                    && Objects.equals(mDescription, d.mDescription)
                    && Objects.equals(mType, d.mType)
                    && Objects.equals(mComponentName, d.mComponentName);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mUuid, mDescription, mType, mComponentName);
    }
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.telecom;

/**
 * Provides callbacks from telecom to the cross device call streaming app with lifecycle events
 * related to an {@link CallEndpointSession}.
 */
public interface CallEndpointCallback {
    /**
     * Invoked by telecom when a {@link CallEndpointSession} is started but the streaming app has
     * not activated the endpoint in a timely manner and the framework deems the activation request
     * to have timed out.
     */
    void onCallEndpointSessionActivationTimeout();

    /**
     * Invoked by telecom when {@link CallEndpointSession#setCallEndpointSessionDeactivated()}
     * called by a cross device call streaming app, or when the app uninstalled. When a tethered
     * {@link CallEndpoint} is deactivated, the call streaming app should clean up any
     * audio/network resources and stop relaying call controls from the endpoint.
     */
    void onCallEndpointSessionDeactivated();
}
Loading