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

Commit 86ab6968 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Change to make pause dialing same for GSM and CDMA.

Earlier this change was made only for CDMA. GSM should also have
those changes and this helps simplify the code too.

Bug: 27790907
Change-Id: I83bdb239813f93251a25d563d2a7129566e0a604
parent af59a35e
Loading
Loading
Loading
Loading
+17 −41
Original line number Diff line number Diff line
@@ -702,18 +702,12 @@ public class GsmCdmaConnection extends Connection {
            // outgoing calls only
            processNextPostDialChar();
        } else {
            if (!isPhoneTypeGsm()) {
            // Only release wake lock for incoming calls, for outgoing calls the wake lock
            // will be released after any pause-dial is completed
            releaseWakeLock();
        }
    }

        if (isPhoneTypeGsm()) {
            releaseWakeLock();
        }
    }

    private void
    doDisconnect() {
        mIndex = -1;
@@ -816,10 +810,7 @@ public class GsmCdmaConnection extends Connection {
        Registrant postDialHandler;

        if (mPostDialState == PostDialState.CANCELLED) {
            if (!isPhoneTypeGsm()) {
            releaseWakeLock();
            }
            //Rlog.v("GsmCdma", "##### processNextPostDialChar: postDialState == CANCELLED, bail");
            return;
        }

@@ -827,10 +818,8 @@ public class GsmCdmaConnection extends Connection {
                mPostDialString.length() <= mNextPostDialChar) {
            setPostDialState(PostDialState.COMPLETE);

            if (!isPhoneTypeGsm()) {
            // We were holding a wake lock until pause-dial was complete, so give it up now
            releaseWakeLock();
            }

            // notifyMessage.arg1 is 0 on complete
            c = 0;
@@ -909,24 +898,12 @@ public class GsmCdmaConnection extends Connection {
    }

    /**
     * Set post dial state and acquire wake lock while switching to "started"
     * state, the wake lock will be released if state switches out of "started"
     * Set post dial state and acquire wake lock while switching to "started" or "pause"
     * state, the wake lock will be released if state switches out of "started" or "pause"
     * state or after WAKE_LOCK_TIMEOUT_MILLIS.
     * @param s new PostDialState
     */
    private void setPostDialState(PostDialState s) {
        if (isPhoneTypeGsm()) {
            if (mPostDialState != PostDialState.STARTED
                    && s == PostDialState.STARTED) {
                acquireWakeLock();
                Message msg = mHandler.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
                mHandler.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
            } else if (mPostDialState == PostDialState.STARTED
                    && s != PostDialState.STARTED) {
                mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
                releaseWakeLock();
            }
        } else {
        if (s == PostDialState.STARTED ||
                s == PostDialState.PAUSE) {
            synchronized (mPartialWakeLock) {
@@ -942,7 +919,6 @@ public class GsmCdmaConnection extends Connection {
            mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
            releaseWakeLock();
        }
        }
        mPostDialState = s;
        notifyPostDialListeners();
    }