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

Commit 525fa6de authored by Nathan Harold's avatar Nathan Harold
Browse files

Guard mIsPendingCellInfoRequest with synch block

In the event of a modem timeout, there is an instance of
mIsPendingCellInfoRequest that isn't guarded by a sync
block. Due to the behavior of the system, I'm unable to
figure out whether this is actually a problem, though it's
theoretically possible to have it drop a response in the
event that the cache doesn't sync between the time of a
request and a timeout. Becuase it's safe to guard, and
because it's documented to be guarded by
mPendingCellInfoRequests, adding a sync block for safety.

Bug: 145965248
Test: manual
Change-Id: I1ca570011c8689a55b8bbbd39cda2e17338a5ac7
parent f00698cb
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -1141,21 +1141,25 @@ public class ServiceStateTracker extends Handler {
                        }
                    }
                } else {
                    synchronized (mPendingCellInfoRequests) {
                        // If we receive an empty message, it's probably a timeout; if there is no
                        // pending request, drop it.
                        if (!mIsPendingCellInfoRequest) break;
                    // If there is a request pending, we still need to check whether it's a timeout
                    // for the current request of whether it's leftover from a previous request.
                        // If there is a request pending, we still need to check whether it's a
                        // timeout for the current request of whether it's leftover from a
                        // previous request.
                        final long curTime = SystemClock.elapsedRealtime();
                        if ((curTime - mLastCellInfoReqTime) <  CELL_INFO_LIST_QUERY_TIMEOUT) {
                            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)!");
                        mLastCellInfoList = null;
                        // Since the timeout is applicable, fall through and update all synchronous
                        // callers with the failure.
                    }
                }
                synchronized (mPendingCellInfoRequests) {
                    // If we have pending requests, then service them. Note that in case of a
                    // timeout, we send null responses back to the callers.