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

Commit 01d52d50 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Release the CellInfo lock while disposing phone object"

parents 29876847 6b437f23
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -193,6 +193,8 @@ public abstract class ServiceStateTracker extends Handler {
        "tg", // Togo
    };

    private ArrayList<CellInfoResult> mCellInfoWaitList;

    private class CellInfoResult {
        List<CellInfo> list;
        Object lockObj = new Object();
@@ -206,6 +208,7 @@ public abstract class ServiceStateTracker extends Handler {
        mPhoneBase = phoneBase;
        mCellInfo = cellInfo;
        mCi = ci;
        mCellInfoWaitList = new ArrayList<CellInfoResult>();
        mVoiceCapable = mPhoneBase.getContext().getResources().getBoolean(
                com.android.internal.R.bool.config_voice_capable);
        mUiccController = UiccController.getInstance();
@@ -221,6 +224,13 @@ public abstract class ServiceStateTracker extends Handler {
        mCi.unSetOnSignalStrengthUpdate(this);
        mUiccController.unregisterForIccChanged(this);
        mCi.unregisterForCellInfoList(this);
        for (CellInfoResult result : mCellInfoWaitList) {
            synchronized(result.lockObj) {
                result.list = null;
                result.lockObj.notify();
            }
        }
        mCellInfoWaitList.clear();
    }

    public boolean getDesiredPowerState() {
@@ -419,6 +429,7 @@ public abstract class ServiceStateTracker extends Handler {
                    mLastCellInfoListTime = SystemClock.elapsedRealtime();
                    mLastCellInfoList = result.list;
                    result.lockObj.notify();
                    mCellInfoWaitList.remove(result);
                }
                break;
            }
@@ -739,10 +750,12 @@ public abstract class ServiceStateTracker extends Handler {
                    synchronized(result.lockObj) {
                        mCi.getCellInfoList(msg);
                        try {
                            mCellInfoWaitList.add(result);
                            result.lockObj.wait();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                            result.list = null;
                            mCellInfoWaitList.remove(result);
                        }
                    }
                } else {