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

Commit 68745247 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Modify code to avoid deadlock

mIsWifiConnectedLock and mSatellitePhoneLock are used as nested locks.
Code is modified to remove those nested locks.

Bug: 374722454
Test: Manually tested SMS/MMS/CALLS/DATA
FLAG: EXEMPT bugfix
Change-Id: Iff4e6d4c64018141b5172fa46523146ad3957ce0
parent b6e87b41
Loading
Loading
Loading
Loading
+12 −11
Original line number Original line Diff line number Diff line
@@ -1706,13 +1706,14 @@ public class SatelliteController extends Handler {
            case EVENT_NOTIFY_NTN_ELIGIBILITY_HYSTERESIS_TIMED_OUT: {
            case EVENT_NOTIFY_NTN_ELIGIBILITY_HYSTERESIS_TIMED_OUT: {
                synchronized (mSatellitePhoneLock) {
                synchronized (mSatellitePhoneLock) {
                    mNtnEligibilityHysteresisTimedOut = true;
                    mNtnEligibilityHysteresisTimedOut = true;
                }

                boolean eligible = isCarrierRoamingNtnEligible(mSatellitePhone);
                boolean eligible = isCarrierRoamingNtnEligible(mSatellitePhone);
                plogd("EVENT_NOTIFY_NTN_ELIGIBILITY_HYSTERESIS_TIMED_OUT:"
                plogd("EVENT_NOTIFY_NTN_ELIGIBILITY_HYSTERESIS_TIMED_OUT:"
                        + " isCarrierRoamingNtnEligible=" + eligible);
                        + " isCarrierRoamingNtnEligible=" + eligible);
                if (eligible) {
                if (eligible) {
                    requestIsSatelliteAllowedForCurrentLocation();
                    requestIsSatelliteAllowedForCurrentLocation();
                }
                }
                }
                break;
                break;
            }
            }


@@ -1785,8 +1786,8 @@ public class SatelliteController extends Handler {
                    mIsWifiConnected = (boolean) ar.result;
                    mIsWifiConnected = (boolean) ar.result;
                    plogd("EVENT_WIFI_CONNECTIVITY_STATE_CHANGED: mIsWifiConnected="
                    plogd("EVENT_WIFI_CONNECTIVITY_STATE_CHANGED: mIsWifiConnected="
                            + mIsWifiConnected);
                            + mIsWifiConnected);
                    handleStateChangedForCarrierRoamingNtnEligibility();
                }
                }
                handleStateChangedForCarrierRoamingNtnEligibility();
                break;
                break;
            }
            }
            case EVENT_SATELLITE_ACCESS_RESTRICTION_CHECKING_RESULT: {
            case EVENT_SATELLITE_ACCESS_RESTRICTION_CHECKING_RESULT: {
@@ -5317,11 +5318,11 @@ public class SatelliteController extends Handler {
            return;
            return;
        }
        }


        synchronized (mSatellitePhoneLock) {
        boolean eligible = isCarrierRoamingNtnEligible(mSatellitePhone);
        boolean eligible = isCarrierRoamingNtnEligible(mSatellitePhone);
        plogd("handleStateChangedForCarrierRoamingNtnEligibility: "
        plogd("handleStateChangedForCarrierRoamingNtnEligibility: "
                + "isCarrierRoamingNtnEligible=" + eligible);
                + "isCarrierRoamingNtnEligible=" + eligible);


        synchronized (mSatellitePhoneLock) {
            if (eligible) {
            if (eligible) {
                if (shouldStartNtnEligibilityHysteresisTimer(eligible)) {
                if (shouldStartNtnEligibilityHysteresisTimer(eligible)) {
                    startNtnEligibilityHysteresisTimer();
                    startNtnEligibilityHysteresisTimer();