From 6b437f2375528ec6a2365738108ef3a62a28665a Mon Sep 17 00:00:00 2001 From: Ravindra Date: Mon, 3 Mar 2014 12:28:07 +0530 Subject: Release the CellInfo lock while disposing phone object Currently if any thread is waiting on CellInfo object and if there is a voice radio tech change ServiceStateTracker object was cleaned without releasing cellInfo lock.While disposing the Phone object CellInfo lock needs to be released. Change-Id: Id5bd298fa0421f149ef3c7065904e453bded3460 CRs-Fixed: 624006 --- .../com/android/internal/telephony/ServiceStateTracker.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java index 75a7f42e0..35ddb0639 100644 --- a/src/java/com/android/internal/telephony/ServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java @@ -193,6 +193,8 @@ public abstract class ServiceStateTracker extends Handler { "tg", // Togo }; + private ArrayList mCellInfoWaitList; + private class CellInfoResult { List list; Object lockObj = new Object(); @@ -206,6 +208,7 @@ public abstract class ServiceStateTracker extends Handler { mPhoneBase = phoneBase; mCellInfo = cellInfo; mCi = ci; + mCellInfoWaitList = new ArrayList(); 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 { -- cgit v1.2.3