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

Commit 4e0f11c6 authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "RTT bugfixes, part 5"

parents 9c8c4dfa a549fed5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -36640,6 +36640,7 @@ package android.provider {
    field public static final deprecated java.lang.String RADIO_NFC = "nfc";
    field public static final deprecated java.lang.String RADIO_WIFI = "wifi";
    field public static final java.lang.String RINGTONE = "ringtone";
    field public static final java.lang.String RTT_CALLING_MODE = "rtt_calling_mode";
    field public static final java.lang.String SCREEN_BRIGHTNESS = "screen_brightness";
    field public static final java.lang.String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
    field public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; // 0x1
@@ -40645,6 +40646,7 @@ package android.telecom {
    field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 128; // 0x80
    field public static final int PROPERTY_HIGH_DEF_AUDIO = 16; // 0x10
    field public static final int PROPERTY_IS_EXTERNAL_CALL = 64; // 0x40
    field public static final int PROPERTY_RTT = 1024; // 0x400
    field public static final int PROPERTY_SELF_MANAGED = 256; // 0x100
    field public static final int PROPERTY_WIFI = 8; // 0x8
  }
+4 −7
Original line number Diff line number Diff line
@@ -3692,18 +3692,15 @@ public final class Settings {
                new SettingsValidators.InclusiveIntegerRangeValidator(0, 3);

        /**
         * User-selected RTT mode
         * User-selected RTT mode. When on, outgoing and incoming calls will be answered as RTT
         * calls when supported by the device and carrier. Boolean value.
         * 0 = OFF
         * 1 = FULL
         * 2 = VCO
         * 3 = HCO
         * Uses the same constants as TTY (e.g. {@link android.telecom.TelecomManager#TTY_MODE_OFF})
         * @hide
         * 1 = ON
         */
        public static final String RTT_CALLING_MODE = "rtt_calling_mode";

        /** @hide */
        public static final Validator RTT_CALLING_MODE_VALIDATOR = TTY_MODE_VALIDATOR;
        public static final Validator RTT_CALLING_MODE_VALIDATOR = BOOLEAN_VALIDATOR;

        /**
         * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
+27 −3
Original line number Diff line number Diff line
@@ -425,8 +425,14 @@ public final class Call {
         */
        public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200;

        /**
         * Indicates that the call is an RTT call. Use {@link #getRttCall()} to get the
         * {@link RttCall} object that is used to send and receive text.
         */
        public static final int PROPERTY_RTT = 0x00000400;

        //******************************************************************************************
        // Next PROPERTY value: 0x00000400
        // Next PROPERTY value: 0x00000800
        //******************************************************************************************

        private final String mTelecomCallId;
@@ -1189,6 +1195,23 @@ public final class Call {
                return null;
            }
        }

        /**
         * Closes the underlying file descriptors
         * @hide
         */
        public void close() {
            try {
                mReceiveStream.close();
            } catch (IOException e) {
                // ignore
            }
            try {
                mTransmitStream.close();
            } catch (IOException e) {
                // ignore
            }
        }
    }

    /**
@@ -1664,7 +1687,7 @@ public final class Call {
     * @return true if there is a connection, false otherwise.
     */
    public boolean isRttActive() {
        return mRttCall != null;
        return mRttCall != null && mDetails.hasProperty(Details.PROPERTY_RTT);
    }

    /**
@@ -1867,7 +1890,8 @@ public final class Call {

        boolean isRttChanged = false;
        boolean rttModeChanged = false;
        if (parcelableCall.getParcelableRttCall() != null && parcelableCall.getIsRttCallChanged()) {
        if (parcelableCall.getIsRttCallChanged()
                && mDetails.hasProperty(Details.PROPERTY_RTT)) {
            ParcelableRttCall parcelableRttCall = parcelableCall.getParcelableRttCall();
            InputStreamReader receiveStream = new InputStreamReader(
                    new ParcelFileDescriptor.AutoCloseInputStream(
+9 −23
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ import android.os.SystemClock;
import android.util.ArraySet;
import android.view.Surface;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
@@ -860,18 +862,19 @@ public abstract class Connection extends Conferenceable {
            mFdFromInCall = fromInCall;
            mFdToInCall = toInCall;
            mPipeFromInCall = new InputStreamReader(
                    new ParcelFileDescriptor.AutoCloseInputStream(fromInCall));
                    new FileInputStream(fromInCall.getFileDescriptor()));
            mPipeToInCall = new OutputStreamWriter(
                    new ParcelFileDescriptor.AutoCloseOutputStream(toInCall));
                    new FileOutputStream(toInCall.getFileDescriptor()));
        }

        /**
         * Writes the string {@param input} into the text stream to the UI for this RTT call. Since
         * RTT transmits text in real-time, this method should be called as often as text snippets
         * are received from the remote user, even if it is only one character.
         *
         * <p>
         * This method is not thread-safe -- calling it from multiple threads simultaneously may
         * lead to interleaved text.
         *
         * @param input The message to send to the in-call app.
         */
        public void write(String input) throws IOException {
@@ -884,9 +887,10 @@ public abstract class Connection extends Conferenceable {
         * Reads a string from the in-call app, blocking if there is no data available. Returns
         * {@code null} if the RTT conversation has been terminated and there is no further data
         * to read.
         *
         * <p>
         * This method is not thread-safe -- calling it from multiple threads simultaneously may
         * lead to interleaved text.
         *
         * @return A string containing text entered by the user, or {@code null} if the
         * conversation has been terminated or if there was an error while reading.
         */
@@ -901,6 +905,7 @@ public abstract class Connection extends Conferenceable {
        /**
         * Non-blocking version of {@link #read()}. Returns {@code null} if there is nothing to
         * be read.
         *
         * @return A string containing text entered by the user, or {@code null} if the user has
         * not entered any new text yet.
         */
@@ -2635,7 +2640,6 @@ public abstract class Connection extends Conferenceable {
     * {@link #onStartRtt(RttTextStream)} has succeeded.
     */
    public final void sendRttInitiationSuccess() {
        setRttProperty();
        mListeners.forEach((l) -> l.onRttInitiationSuccess(Connection.this));
    }

@@ -2647,7 +2651,6 @@ public abstract class Connection extends Conferenceable {
     *               exception of {@link RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS}.
     */
    public final void sendRttInitiationFailure(int reason) {
        unsetRttProperty();
        mListeners.forEach((l) -> l.onRttInitiationFailure(Connection.this, reason));
    }

@@ -2656,7 +2659,6 @@ public abstract class Connection extends Conferenceable {
     * side of the coll.
     */
    public final void sendRttSessionRemotelyTerminated() {
        unsetRttProperty();
        mListeners.forEach((l) -> l.onRttSessionRemotelyTerminated(Connection.this));
    }

@@ -2956,22 +2958,6 @@ public abstract class Connection extends Conferenceable {
     */
    public void handleRttUpgradeResponse(@Nullable RttTextStream rttTextStream) {}

    /**
     * Internal method to set {@link #PROPERTY_IS_RTT}.
     * @hide
     */
    void setRttProperty() {
        setConnectionProperties(getConnectionProperties() | PROPERTY_IS_RTT);
    }

    /**
     * Internal method to un-set {@link #PROPERTY_IS_RTT}.
     * @hide
     */
    void unsetRttProperty() {
        setConnectionProperties(getConnectionProperties() & (~PROPERTY_IS_RTT));
    }

    static String toLogSafePhoneNumber(String number) {
        // For unknown number, log empty string.
        if (number == null) {
+6 −1
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ public final class ConnectionRequest implements Parcelable {
    private final boolean mShouldShowIncomingCallUi;
    private final ParcelFileDescriptor mRttPipeToInCall;
    private final ParcelFileDescriptor mRttPipeFromInCall;
    // Cached return value of getRttTextStream -- we don't want to wrap it more than once.
    private Connection.RttTextStream mRttTextStream;

    /**
     * @param accountHandle The accountHandle which should be used to place the call.
@@ -312,7 +314,10 @@ public final class ConnectionRequest implements Parcelable {
     */
    public Connection.RttTextStream getRttTextStream() {
        if (isRequestingRtt()) {
            return new Connection.RttTextStream(mRttPipeToInCall, mRttPipeFromInCall);
            if (mRttTextStream == null) {
                mRttTextStream = new Connection.RttTextStream(mRttPipeToInCall, mRttPipeFromInCall);
            }
            return mRttTextStream;
        } else {
            return null;
        }
Loading