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

Commit aa07df84 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Wiring video state through from Connection

Bug: 16285417
Bug: 16013178
Change-Id: Ia48959248ca22f4569b0ffd01a1716470aa0a711
parent 3ee06efe
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -28224,6 +28224,7 @@ package android.telecomm {
    method public final android.telecomm.Connection getParentConnection();
    method public final int getState();
    method public final android.telecomm.StatusHints getStatusHints();
    method public final int getVideoState();
    method public final boolean isConferenceConnection();
    method public final boolean isRequestingRingback();
    method protected void onAbort();
@@ -28257,6 +28258,7 @@ package android.telecomm {
    method public final void setRinging();
    method public final void setSignal(android.os.Bundle);
    method public final void setStatusHints(android.telecomm.StatusHints);
    method public final void setVideoState(int);
    method public static java.lang.String stateToString(int);
  }
@@ -28391,12 +28393,13 @@ package android.telecomm {
  }
  public class PhoneAccountMetadata implements android.os.Parcelable {
    ctor public PhoneAccountMetadata(android.telecomm.PhoneAccount, int, java.lang.String, java.lang.String);
    ctor public PhoneAccountMetadata(android.telecomm.PhoneAccount, int, java.lang.String, java.lang.String, boolean);
    method public int describeContents();
    method public android.telecomm.PhoneAccount getAccount();
    method public android.graphics.drawable.Drawable getIcon(android.content.Context);
    method public java.lang.String getLabel();
    method public java.lang.String getShortDescription();
    method public boolean isVideoCallingSupported();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
@@ -28440,6 +28443,7 @@ package android.telecomm {
    method public int getHandlePresentation();
    method public int getState();
    method public android.telecomm.StatusHints getStatusHints();
    method public int getVideoState();
    method public void hold();
    method public void playDtmf(char);
    method public void postDialContinue(boolean);
@@ -28462,6 +28466,7 @@ package android.telecomm {
    method public abstract void onRequestingRingback(android.telecomm.RemoteConnection, boolean);
    method public abstract void onStateChanged(android.telecomm.RemoteConnection, int);
    method public abstract void onStatusHintsChanged(android.telecomm.RemoteConnection, android.telecomm.StatusHints);
    method public abstract void onVideoStateChanged(android.telecomm.RemoteConnection, int);
  }
  public abstract interface Response {
+32 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public abstract class Connection {
        public void onHandleChanged(Connection c, Uri newHandle, int presentation) {}
        public void onCallerDisplayNameChanged(
                Connection c, String callerDisplayName, int presentation) {}
        public void onVideoStateChanged(Connection c, int videoState) {}
        public void onSignalChanged(Connection c, Bundle details) {}
        public void onDisconnected(Connection c, int cause, String message) {}
        public void onPostDialWait(Connection c, String remaining) {}
@@ -75,6 +76,7 @@ public abstract class Connection {
    private CallVideoProvider mCallVideoProvider;
    private boolean mAudioModeIsVoip;
    private StatusHints mStatusHints;
    private int mVideoState;

    /**
     * Create a new Connection.
@@ -117,6 +119,19 @@ public abstract class Connection {
        return mState;
    }

    /**
     * Returns the video state of the call.
     * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
     *
     * @return The video state of the call.
     */
    public final int getVideoState() {
        return mVideoState;
    }

    /**
     * @return The audio state of the call, describing how its audio is currently
     *         being routed by the system. This is {@code null} if this Connection
@@ -284,6 +299,23 @@ public abstract class Connection {
        }
    }

    /**
     * Set the video state for the connection.
     * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
     *
     * @param videoState The new video state.
     */
    public final void setVideoState(int videoState) {
        Log.d(this, "setVideoState %d", videoState);
        mVideoState = videoState;
        for (Listener l : mListeners) {
            l.onVideoStateChanged(this, mVideoState);
        }
    }

    /**
     * Sets state to active (e.g., an ongoing call where two or more parties can actively
     * communicate).
+7 −0
Original line number Diff line number Diff line
@@ -323,6 +323,13 @@ public abstract class ConnectionService extends Service {
            mAdapter.setDisconnected(id, cause, message);
        }

        @Override
        public void onVideoStateChanged(Connection c, int videoState) {
            String id = mIdByConnection.get(c);
            Log.d(this, "Adapter set video state %d", videoState);
            mAdapter.setVideoState(id, videoState);
        }

        @Override
        public void onHandleChanged(Connection c, Uri handle, int presentation) {
            String id = mIdByConnection.get(c);
+21 −0
Original line number Diff line number Diff line
@@ -323,4 +323,25 @@ final class ConnectionServiceAdapter implements DeathRecipient {
            }
        }
    }

    /**
     * Sets the video state associated with a call.
     *
     * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
     * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
     *
     * @param callId The unique ID of the call to set the video state for.
     * @param videoState The video state.
     */
    void setVideoState(String callId, int videoState) {
        Log.v(this, "setVideoState: %d", videoState);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setVideoState(callId, videoState);
            } catch (RemoteException ignored) {
            }
        }
    }
}
+15 −4
Original line number Diff line number Diff line
@@ -22,9 +22,6 @@ import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;

import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.MissingResourceException;

/**
@@ -35,16 +32,19 @@ public class PhoneAccountMetadata implements Parcelable {
    private int mIconResId;
    private String mLabel;
    private String mShortDescription;
    private boolean mVideoCallingSupported;

    public PhoneAccountMetadata(
            PhoneAccount account,
            int iconResId,
            String label,
            String shortDescription) {
            String shortDescription,
            boolean supportsVideoCalling) {
        mAccount = account;
        mIconResId = iconResId;
        mLabel = label;
        mShortDescription = shortDescription;
        mVideoCallingSupported = supportsVideoCalling;
    }

    /**
@@ -101,6 +101,15 @@ public class PhoneAccountMetadata implements Parcelable {
        }
    }

    /**
     * Determines whether this {@code PhoneAccount} supports video calling.
     *
     * @return {@code true} if this {@code PhoneAccount} supports video calling.
     */
    public boolean isVideoCallingSupported() {
        return mVideoCallingSupported;
    }

    //
    // Parcelable implementation
    //
@@ -116,6 +125,7 @@ public class PhoneAccountMetadata implements Parcelable {
        out.writeInt(mIconResId);
        out.writeString(mLabel);
        out.writeString(mShortDescription);
        out.writeInt(mVideoCallingSupported ? 1: 0);
    }

    public static final Creator<PhoneAccountMetadata> CREATOR
@@ -136,5 +146,6 @@ public class PhoneAccountMetadata implements Parcelable {
        mIconResId = in.readInt();
        mLabel = in.readString();
        mShortDescription = in.readString();
        mVideoCallingSupported = in.readInt() == 1;
    }
}
Loading