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

Commit 0963e413 authored by Calvin On's avatar Calvin On
Browse files

Fix synchronization of mPendingRadioPowerOffAfterDataOff.

- Synchronize variable accesses in the event handler
- Mark as volatile to ensure correct visiblity in its
unsynchronized access in dumpstate

Test: make
Test: manual -- validated on Wear builds

Change-Id: I73904e246fef10554d299eb6c8248c1ae3bcc0d6
parent 5e840c73
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -222,8 +222,9 @@ public class ServiceStateTracker extends Handler {
    private final RegistrantList mAirplaneModeChangedRegistrants = new RegistrantList();
    private final RegistrantList mAreaCodeChangedRegistrants = new RegistrantList();

    /* Radio power off pending flag and tag counter */
    private boolean mPendingRadioPowerOffAfterDataOff = false;
    /* Radio power off pending flag */
    // @GuardedBy("this")
    private volatile boolean mPendingRadioPowerOffAfterDataOff = false;

    /** Waiting period before recheck gprs and voice registration. */
    public static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000;
@@ -1471,6 +1472,7 @@ public class ServiceStateTracker extends Handler {

            case EVENT_ALL_DATA_DISCONNECTED:
                log("EVENT_ALL_DATA_DISCONNECTED");
                synchronized (this) {
                    if (!mPendingRadioPowerOffAfterDataOff) return;
                    boolean areAllDataDisconnectedOnAllPhones = true;
                    for (Phone phone : PhoneFactory.getPhones()) {
@@ -1490,6 +1492,7 @@ public class ServiceStateTracker extends Handler {
                        if (DBG) log("Data disconnected for all phones, turn radio off now.");
                        hangupAndPowerOff();
                    }
                }
                break;

            case EVENT_CHANGE_IMS_STATE: