summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorBanavathu, Srinivas Naik <snb@codeaurora.org>2012-07-17 15:32:44 +0530
committerBanavathu, Srinivas Naik <snb@codeaurora.org>2012-10-22 23:26:54 -0700
commit87cda96d48c89f3fe8606241752ec5a8810ef692 (patch)
tree44d42a2735dfb6ae1506b5e1a5ec7ac4c75c5246 /src/com/android
parent8e36a0a6f618dd01122efc838fc90b04799b3c97 (diff)
downloadStk-87cda96d48c89f3fe8606241752ec5a8810ef692.tar.gz
StkAppSerice: Stop the service when CatService Instance is null
ANR is seen in StkAppService because of ServiceHandler is not created due to CatService is not running. Stop Stkapp Service if Catservice is not running to avoid ANR. Whenever service is started using StartService first onCreate followed by onStart will be called. Next time onwards only Onstart will be called due to this ServiceHandler will not intialize. Hence moving corresponding code to onStart from onCreate. Change-Id: I5a0a78d2012e3bf5aff2b5512dd21aa7bb96ec4a
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/stk/StkAppService.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 9dcd25b..bed2caa 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -144,11 +144,6 @@ public class StkAppService extends Service implements Runnable {
@Override
public void onCreate() {
// Initialize members
- // This can return null if StkService is not yet instantiated, but it's ok
- // If this is null we will do getInstance before we need to use this
- mStkService = com.android.internal.telephony.cat.CatService
- .getInstance();
-
mCmdsQ = new LinkedList<DelayedCmd>();
Thread serviceThread = new Thread(null, this, "Stk App Service");
serviceThread.start();
@@ -160,8 +155,17 @@ public class StkAppService extends Service implements Runnable {
@Override
public void onStart(Intent intent, int startId) {
- waitForLooper();
+ mStkService = com.android.internal.telephony.cat.CatService
+ .getInstance();
+
+ if (mStkService == null) {
+ stopSelf();
+ CatLog.d(this, " Unable to get Service handle");
+ return;
+ }
+
+ waitForLooper();
// onStart() method can be passed a null intent
// TODO: replace onStart() with onStartCommand()
if (intent == null) {