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

Commit 9ecbfb29 authored by Nathan Harold's avatar Nathan Harold Committed by Gerrit Code Review
Browse files

Merge "Guard mIsPendingCellInfoRequest with synch block"

parents d03f8f53 525fa6de
Loading
Loading
Loading
Loading
+17 −13
Original line number Original line Diff line number Diff line
@@ -1141,21 +1141,25 @@ public class ServiceStateTracker extends Handler {
                        }
                        }
                    }
                    }
                } else {
                } else {
                    synchronized (mPendingCellInfoRequests) {
                        // If we receive an empty message, it's probably a timeout; if there is no
                        // If we receive an empty message, it's probably a timeout; if there is no
                        // pending request, drop it.
                        // pending request, drop it.
                        if (!mIsPendingCellInfoRequest) break;
                        if (!mIsPendingCellInfoRequest) break;
                    // If there is a request pending, we still need to check whether it's a timeout
                        // If there is a request pending, we still need to check whether it's a
                    // for the current request of whether it's leftover from a previous request.
                        // timeout for the current request of whether it's leftover from a
                        // previous request.
                        final long curTime = SystemClock.elapsedRealtime();
                        final long curTime = SystemClock.elapsedRealtime();
                        if ((curTime - mLastCellInfoReqTime) <  CELL_INFO_LIST_QUERY_TIMEOUT) {
                        if ((curTime - mLastCellInfoReqTime) <  CELL_INFO_LIST_QUERY_TIMEOUT) {
                            break;
                            break;
                        }
                        }
                    // We've received a legitimate timeout, so something has gone terribly wrong.
                        // We've received a legitimate timeout, so something has gone terribly
                        // wrong.
                        loge("Timeout waiting for CellInfo; (everybody panic)!");
                        loge("Timeout waiting for CellInfo; (everybody panic)!");
                        mLastCellInfoList = null;
                        mLastCellInfoList = null;
                        // Since the timeout is applicable, fall through and update all synchronous
                        // Since the timeout is applicable, fall through and update all synchronous
                        // callers with the failure.
                        // callers with the failure.
                    }
                    }
                }
                synchronized (mPendingCellInfoRequests) {
                synchronized (mPendingCellInfoRequests) {
                    // If we have pending requests, then service them. Note that in case of a
                    // If we have pending requests, then service them. Note that in case of a
                    // timeout, we send null responses back to the callers.
                    // timeout, we send null responses back to the callers.