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

Commit f7724ddc authored by Prerepa Viswanadham's avatar Prerepa Viswanadham
Browse files

Merge commit '781905d9' into merge_work

parents 22604f3b 781905d9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2652,6 +2652,16 @@ public final class Telephony {
         * @hide
         */
        public static final String MTU = "mtu";

        /**
         * Is this APN added/edited/deleted by a user or app?
         * TelephonyProvider.USER_EDITED_UNTOUCHED (0) indicates untouched by user/app
         * TelephonyProvider.USER_EDITED_EDITED (1) indicates added/edited by user/app
         * TelephonyProvider.USER_EDITED_DELETED (2) indicates deleted by user/app
         * <p>Type: INTEGER </p>
         * @hide
         */
        public static final String USER_EDITED = "user_edited";
    }

    /**
+18 −0
Original line number Diff line number Diff line
@@ -21,6 +21,13 @@ package com.android.internal.telephony;
 */
public class CallStateException extends Exception
{
    private int mError = ERROR_INVALID;

    /** The error code is not valid (Not received a disconnect cause) */
    public static final int ERROR_INVALID = -1;

    public static final int ERROR_DISCONNECTED = 1;

    public
    CallStateException()
    {
@@ -31,4 +38,15 @@ public class CallStateException extends Exception
    {
        super(string);
    }

    public
    CallStateException(int error, String string)
    {
        super(string);
        mError = error;
    }

    public int getError() {
        return mError;
    }
}
+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.
     *
+26 −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>
     *
@@ -1888,6 +1904,11 @@ public interface Phone {
     */
    public Phone getImsPhone();

    /**
     * Start listening for IMS service UP/DOWN events.
     */
    public void startMonitoringImsService();

    /**
     * Release the local instance of the ImsPhone and disconnect from
     * the phone.
@@ -2005,4 +2026,9 @@ public interface Phone {
     *@hide
     */
    public boolean isVolteEnabled();

    /**
     * @return {@code true} if video call is present, false otherwise.
     */
    public boolean isVideoCallPresent();
}
+121 −41
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;
@@ -86,6 +87,7 @@ import java.util.concurrent.atomic.AtomicReference;
public abstract class PhoneBase extends Handler implements Phone {
    private static final String LOG_TAG = "PhoneBase";

    private boolean mImsIntentReceiverRegistered = false;
    private BroadcastReceiver mImsIntentReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -100,6 +102,7 @@ public abstract class PhoneBase extends Handler implements Phone {
                }
            }

            synchronized (PhoneProxy.lockForRadioTechnologyChange) {
                if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_UP)) {
                    mImsServiceReady = true;
                    updateImsPhone();
@@ -108,6 +111,7 @@ public abstract class PhoneBase extends Handler implements Phone {
                    updateImsPhone();
                }
            }
        }
    };

    // Key used to read and write the saved network selection numeric value
@@ -204,6 +208,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;
@@ -218,7 +226,6 @@ public abstract class PhoneBase extends Handler implements Phone {

    protected int mPhoneId;

    private final Object mImsLock = new Object();
    private boolean mImsServiceReady = false;
    protected ImsPhone mImsPhone = null;

@@ -314,6 +321,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;
@@ -425,6 +436,19 @@ public abstract class PhoneBase extends Handler implements Phone {
        mUiccController = UiccController.getInstance();
        mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null);

        mCi.registerForSrvccStateChanged(this, EVENT_SRVCC_STATE_CHANGED, null);
        mCi.setOnUnsolOemHookRaw(this, EVENT_UNSOL_OEM_HOOK_RAW, null);
    }

    @Override
    public void startMonitoringImsService() {
        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
            IntentFilter filter = new IntentFilter();
            filter.addAction(ImsManager.ACTION_IMS_SERVICE_UP);
            filter.addAction(ImsManager.ACTION_IMS_SERVICE_DOWN);
            mContext.registerReceiver(mImsIntentReceiver, filter);
            mImsIntentReceiverRegistered = true;

            // Monitor IMS service - but first poll to see if already up (could miss
            // intent)
            ImsManager imsManager = ImsManager.getInstance(mContext, getPhoneId());
@@ -432,19 +456,16 @@ public abstract class PhoneBase extends Handler implements Phone {
                mImsServiceReady = true;
                updateImsPhone();
            }
        IntentFilter filter = new IntentFilter();
        filter.addAction(ImsManager.ACTION_IMS_SERVICE_UP);
        filter.addAction(ImsManager.ACTION_IMS_SERVICE_DOWN);
        mContext.registerReceiver(mImsIntentReceiver, filter);

        mCi.registerForSrvccStateChanged(this, EVENT_SRVCC_STATE_CHANGED, null);
        mCi.setOnUnsolOemHookRaw(this, EVENT_UNSOL_OEM_HOOK_RAW, null);
        }
    }

    @Override
    public void dispose() {
        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
            if (mImsIntentReceiverRegistered) {
                mContext.unregisterReceiver(mImsIntentReceiver);
                mImsIntentReceiverRegistered = false;
            }
            mCi.unSetOnCallRing(this);
            // Must cleanup all connectionS and needs to use sendMessage!
            mDcTracker.cleanUpAllConnections(null);
@@ -762,6 +783,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 +1494,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 +1824,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.
     */
@@ -1904,10 +1981,15 @@ public abstract class PhoneBase extends Handler implements Phone {

    @Override
    public ImsPhone relinquishOwnershipOfImsPhone() {
        synchronized (mImsLock) {
        synchronized (PhoneProxy.lockForRadioTechnologyChange) {
            if (mImsPhone == null)
                return null;

            if (mImsIntentReceiverRegistered) {
                mContext.unregisterReceiver(mImsIntentReceiver);
                mImsIntentReceiverRegistered = false;
            }

            ImsPhone imsPhone = mImsPhone;
            mImsPhone = null;

@@ -1920,7 +2002,7 @@ public abstract class PhoneBase extends Handler implements Phone {

    @Override
    public void acquireOwnershipOfImsPhone(ImsPhone imsPhone) {
        synchronized (mImsLock) {
        synchronized (PhoneProxy.lockForRadioTechnologyChange) {
            if (imsPhone == null)
                return;

@@ -1945,7 +2027,6 @@ public abstract class PhoneBase extends Handler implements Phone {
    }

    protected void updateImsPhone() {
        synchronized (mImsLock) {
        Rlog.d(LOG_TAG, "updateImsPhone"
                + " mImsServiceReady=" + mImsServiceReady);

@@ -1966,7 +2047,6 @@ public abstract class PhoneBase extends Handler implements Phone {
            mImsPhone = null;
        }
    }
    }

    /**
     * Dials a number.
Loading