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

Commit fda8d6f0 authored by Amit Mahajan's avatar Amit Mahajan Committed by Android (Google) Code Review
Browse files

Merge "Change to dispose Gsm/CdmaConnection to make sure wakelock is released" into mnc-dr-dev

parents d0d5f17e 8f811769
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -124,6 +124,11 @@ public final class CdmaCallTracker extends CallTracker {

        clearDisconnected();

        for (CdmaConnection cdmaConnection : mConnections) {
            if (cdmaConnection != null) {
                cdmaConnection.dispose();
            }
        }
    }

    @Override
@@ -358,6 +363,7 @@ public final class CdmaCallTracker extends CallTracker {

        updatePhoneState();
        mPhone.notifyPreciseCallStateChanged();

    }

    boolean
+10 −0
Original line number Diff line number Diff line
@@ -186,6 +186,8 @@ public class CdmaConnection extends Connection {
    }

    public void dispose() {
        clearPostDialListeners();
        releaseAllWakeLocks();
    }

    static boolean
@@ -794,6 +796,14 @@ public class CdmaConnection extends Connection {
        }
    }

    private void releaseAllWakeLocks() {
        synchronized (mPartialWakeLock) {
            while (mPartialWakeLock.isHeld()) {
                mPartialWakeLock.release();
            }
        }
    }

    private static boolean isPause(char c) {
        return c == PhoneNumberUtils.PAUSE;
    }
+6 −1
Original line number Diff line number Diff line
@@ -119,8 +119,13 @@ public final class GsmCallTracker extends CallTracker {
        mCi.unregisterForOn(this);
        mCi.unregisterForNotAvailable(this);


        clearDisconnected();

        for (GsmConnection gsmConnection : mConnections) {
            if (gsmConnection != null) {
                gsmConnection.dispose();
            }
        }
    }

    @Override
+11 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ public class GsmConnection extends Connection {
    }

    public void dispose() {
        clearPostDialListeners();
        releaseAllWakeLocks();
    }

    static boolean
@@ -740,6 +742,15 @@ public class GsmConnection extends Connection {
        }
    }

    private void
    releaseAllWakeLocks() {
        synchronized(mPartialWakeLock) {
            while (mPartialWakeLock.isHeld()) {
                mPartialWakeLock.release();
            }
        }
    }

    private void log(String msg) {
        Rlog.d(LOG_TAG, "[GSMConn] " + msg);
    }