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

Commit 288268d5 authored by Rekha Kumar's avatar Rekha Kumar
Browse files

IMS-VT: Propagate video capability of phone to telecomm.

To dynamcally enable/disable Make Video Call button in dialer,
the phone capabilities need to be propagate to TelecommMgr.
Propagate video capability of phone to telecomm layer.

IMS-VT: Notify call updates
-When call type is updated from VoLTE to VT, this notification
 does not reach UI. Fix this

Fix the issue - Unable to add second VT call when first call is active
- Cache the video state of the new pending call when the foreground
  call is HOLDING.
- Use the cached video state when dialing the pending MO call or
  accepting the pending MT call after the first call is put on HOLD.

Ims: Add support for WIFI network mode notifications
Added support for enabling and disabling features for Voice and
Video when network mode is WIFI or IWLAN

IMS-VT: Peer capabilities
-Add support for peer capabilities
Change-Id: I44177dd6804b69a7b790021502eda0eb3bea3cab

IMS-VT: Do not allow changing the TTY mode during a Video call
When the device is already in a video call, the user SHOULD NOT
be allowed to change the TTY mode. If the user tries to change,
then an UI alert message will be displayed explaining it cannot
be changed during video calls.

Propagate the call substate changed message to the UI

Notify video capability to listeners in certain new scenarios
- In certain cases, we have seen that when the phone
  object is deleted/re-created, we fail to notify the
  video capability to the listeners.
- There also seemed to be a race condition when the
  time a listener registers is not in sync with
  the time we are notified of the video capability.
- In order to fix the above two issues, we notify
  registrants when a new phone is created and
  updateParentPhone is called. Also, when a new
  registrant registers with us for video capability
  changed, we immediately notify them of our cached
  capability.

Change-Id: Ic6002c2518104c20b5de10d1081af4559f506ace

IMS-VT: Enable Video conferencing.
Enable Video conferencing.

Change-Id: Ia1155960492165cff7f4993a4bf98ecc920ebf41
parent 2cf01103
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ public abstract class Connection {
                android.telecom.Connection.VideoProvider videoProvider);
        public void onAudioQualityChanged(int audioQuality);
        public void onConferenceParticipantsChanged(List<ConferenceParticipant> participants);
        public void onCallSubstateChanged(int callSubstate);
    }

    /**
@@ -71,6 +72,7 @@ public abstract class Connection {
        public void onAudioQualityChanged(int audioQuality) {}
        @Override
        public void onConferenceParticipantsChanged(List<ConferenceParticipant> participants) {}
        public void onCallSubstateChanged(int callSubstate) {}
    }

    public static final int AUDIO_QUALITY_STANDARD = 1;
@@ -113,6 +115,7 @@ public abstract class Connection {
    private boolean mRemoteVideoCapable;
    private boolean mIsWifi;
    private int mAudioQuality;
    private int mCallSubstate;
    private android.telecom.Connection.VideoProvider mVideoProvider;
    public Call.State mPreHandoverState = Call.State.IDLE;

@@ -517,6 +520,17 @@ public abstract class Connection {
        return mAudioQuality;
    }


    /**
     * Returns the current call substate of the connection.
     *
     * @return The call substate of the connection.
     */
    public int getCallSubstate() {
        return mCallSubstate;
    }


    /**
     * Sets the videoState for the current connection and reports the changes to all listeners.
     * Valid video states are defined in {@link android.telecom.VideoProfile}.
@@ -578,6 +592,19 @@ public abstract class Connection {
        }
    }

    /**
     * Sets the call substate for the current connection and reports the changes to all listeners.
     * Valid call substates are defined in {@link android.telecom.Connection}.
     *
     * @return The call substate.
     */
    public void setCallSubstate(int callSubstate) {
        mCallSubstate = callSubstate;
        for (Listener l : mListeners) {
            l.onCallSubstateChanged(mCallSubstate);
        }
    }

    /**
     * Sets the {@link android.telecom.Connection.VideoProvider} for the connection.
     *
+21 −0
Original line number Diff line number Diff line
@@ -372,6 +372,22 @@ public interface Phone {

    void unregisterForNewRingingConnection(Handler h);

    /**
     * Notifies when phone's video capabilities changes <p>
     *
     *  Messages received from this:
     *  Message.obj will be an AsyncResult
     *  AsyncResult.userObj = obj
     *  AsyncResult.result = true if phone supports video calling <p>
     */
    public void registerForVideoCapabilityChanged(Handler h, int what, Object obj);

    /**
     * Unregisters for video capability changed notification.
     * Extraneous calls are tolerated silently
     */
    public void unregisterForVideoCapabilityChanged(Handler h);

    /**
     * Notifies when an incoming call rings.<p>
     *
@@ -2005,4 +2021,9 @@ public interface Phone {
     *@hide
     */
    public boolean isVolteEnabled();

    /**
     * @return {@code true} if video call is present, false otherwise.
     */
    public boolean isVideoCallPresent();
}
+65 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.ims.ImsManager;
import com.android.internal.R;
import com.android.internal.telephony.dataconnection.DcTrackerBase;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneConnection;
import com.android.internal.telephony.RadioCapability;
import com.android.internal.telephony.test.SimulatedRadioControl;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
@@ -204,6 +205,10 @@ public abstract class PhoneBase extends Handler implements Phone {
    int mCallRingDelay;
    public boolean mIsTheCurrentActivePhone = true;
    boolean mIsVoiceCapable = true;

    // Variable to cache the video capability. When RAT changes, we lose this info and are unable
    // to recover from the state. We cache it and notify listeners when they register.
    protected boolean mIsVideoCapable = false;
    protected UiccController mUiccController = null;
    public AtomicReference<IccRecords> mIccRecords = new AtomicReference<IccRecords>();
    public SmsStorageMonitor mSmsStorageMonitor;
@@ -314,6 +319,10 @@ public abstract class PhoneBase extends Handler implements Phone {
    protected final RegistrantList mSimRecordsLoadedRegistrants
            = new RegistrantList();

    protected final RegistrantList mVideoCapabilityChangedRegistrants
            = new RegistrantList();


    protected Looper mLooper; /* to insure registrants are in correct thread*/

    protected final Context mContext;
@@ -762,6 +771,24 @@ public abstract class PhoneBase extends Handler implements Phone {
        mNewRingingConnectionRegistrants.remove(h);
    }

    // Inherited documentation suffices.
    @Override
    public void registerForVideoCapabilityChanged(
            Handler h, int what, Object obj) {
        checkCorrectThread(h);

        mVideoCapabilityChangedRegistrants.addUnique(h, what, obj);

        // Notify any registrants of the cached video capability as soon as they register.
        notifyForVideoCapabilityChanged(mIsVideoCapable);
    }

    // Inherited documentation suffices.
    @Override
    public void unregisterForVideoCapabilityChanged(Handler h) {
        mVideoCapabilityChangedRegistrants.remove(h);
    }

    // Inherited documentation suffices.
    @Override
    public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj){
@@ -1455,6 +1482,32 @@ public abstract class PhoneBase extends Handler implements Phone {
        return false;
    }

    private static int getVideoState(Call call) {
        int videoState = VideoProfile.VideoState.AUDIO_ONLY;
        ImsPhoneConnection conn = (ImsPhoneConnection) call.getEarliestConnection();
        if (conn != null) {
            videoState = conn.getVideoState();
        }
        return videoState;
    }

    private boolean isVideoCall(Call call) {
        int videoState = getVideoState(call);
        return (VideoProfile.VideoState.isVideo(videoState));
    }

    @Override
    public boolean isVideoCallPresent() {
        boolean isVideoCallActive = false;
        if (mImsPhone != null) {
            isVideoCallActive = isVideoCall(mImsPhone.getForegroundCall()) ||
                    isVideoCall(mImsPhone.getBackgroundCall()) ||
                    isVideoCall(mImsPhone.getRingingCall());
        }
        Rlog.d(LOG_TAG, "isVideoCallActive: " + isVideoCallActive);
        return isVideoCallActive;
    }

    @Override
    public abstract int getPhoneType();

@@ -1759,6 +1812,18 @@ public abstract class PhoneBase extends Handler implements Phone {
        mNewRingingConnectionRegistrants.notifyRegistrants(ar);
    }


    /**
     * Notify registrants if phone is video capable.
     */
    public void notifyForVideoCapabilityChanged(boolean isVideoCallCapable) {
        // Cache the current video capability so that we don't lose the information.
        mIsVideoCapable = isVideoCallCapable;

        AsyncResult ar = new AsyncResult(null, isVideoCallCapable, null);
        mVideoCapabilityChangedRegistrants.notifyRegistrants(ar);
    }

    /**
     * Notify registrants of a RING event.
     */
+16 −0
Original line number Diff line number Diff line
@@ -332,6 +332,11 @@ public class PhoneProxy extends Handler implements Phone {
        return ((PhoneBase)mActivePhone).getIccFileHandler();
    }

    @Override
    public boolean isVideoCallPresent() {
        return mActivePhone.isVideoCallPresent();
    }

    @Override
    public void updatePhoneObject(int voiceRadioTech) {
        logd("updatePhoneObject: radioTechnology=" + voiceRadioTech);
@@ -479,6 +484,17 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.unregisterForNewRingingConnection(h);
    }

    @Override
    public void registerForVideoCapabilityChanged(
            Handler h, int what, Object obj) {
        mActivePhone.registerForVideoCapabilityChanged(h, what, obj);
    }

    @Override
    public void unregisterForVideoCapabilityChanged(Handler h) {
        mActivePhone.unregisterForVideoCapabilityChanged(h);
    }

    @Override
    public void registerForIncomingRing(Handler h, int what, Object obj) {
        mActivePhone.registerForIncomingRing(h, what, obj);
+13 −2
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ public class ImsPhone extends ImsPhoneBase {
    private final RegistrantList mSilentRedialRegistrants = new RegistrantList();

    private boolean mImsRegistered = false;

    // A runnable which is used to automatically exit from Ecm after a period of time.
    private Runnable mExitEcmRunnable = new Runnable() {
        @Override
@@ -190,6 +191,11 @@ public class ImsPhone extends ImsPhoneBase {
        // synchronization is managed at the PhoneBase scope (which calls this function)
        mDefaultPhone = parentPhone;
        mPhoneId = mDefaultPhone.getPhoneId();

        // When the parent phone is updated, we need to notify listeners of the cached video
        // capability.
        Rlog.d(LOG_TAG, "updateParentPhone - Notify video capability changed " + mIsVideoCapable);
        notifyForVideoCapabilityChanged(mIsVideoCapable);
    }

    @Override
@@ -492,6 +498,11 @@ public class ImsPhone extends ImsPhoneBase {
        }
    }

    public void notifyForVideoCapabilityChanged(boolean isVideoCapable) {
        mIsVideoCapable = isVideoCapable;
        mDefaultPhone.notifyForVideoCapabilityChanged(isVideoCapable);
    }

    @Override
    public Connection
    dial(String dialString, int videoState) throws CallStateException {
@@ -1289,8 +1300,8 @@ public class ImsPhone extends ImsPhoneBase {
        return mCT.isVowifiEnabled();
    }

    public boolean isVtEnabled() {
        return mCT.isVtEnabled();
    public boolean isVideoCallEnabled() {
        return mCT.isVideoCallEnabled();
    }

    public Phone getDefaultPhone() {
Loading