From 99fccc1c113d9b7a030dc7c945d0750748cc4af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Fr=C3=B6jd?= Date: Wed, 19 Jan 2011 13:46:57 +0100 Subject: No response sent when backlight is OFF When the LCD backlight is OFF while receiving a PLAY TONE command, the onDestroy() method is called immediately since the app is in the background. In onDestroy() the STOP message is removed from the handler queue which leads to no response is sent back to StkAppService. This causes the RIL layer to send TR 'ME currently unable to process command' back to the SIM. Solution is to check if a response is sent before removing any messages from the handler queue. Change-Id: I7ac2e99b85b38576acfe72370aa55850cdc304a0 --- src/com/android/stk/ToneDialog.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java index 3251aba..0370939 100644 --- a/src/com/android/stk/ToneDialog.java +++ b/src/com/android/stk/ToneDialog.java @@ -38,6 +38,7 @@ public class ToneDialog extends Activity { TextMessage toneMsg = null; ToneSettings settings = null; TonePlayer player = null; + boolean mIsResponseSent = false; /** * Handler used to stop tones from playing when the duration ends. @@ -98,8 +99,9 @@ public class ToneDialog extends Activity { @Override protected void onDestroy() { super.onDestroy(); - - mToneStopper.removeMessages(MSG_ID_STOP_TONE); + if (mIsResponseSent) { + mToneStopper.removeMessages(MSG_ID_STOP_TONE); + } player.stop(); player.release(); mVibrator.cancel(); @@ -129,5 +131,6 @@ public class ToneDialog extends Activity { args.putInt(StkAppService.OPCODE, StkAppService.OP_RESPONSE); args.putInt(StkAppService.RES_ID, resId); startService(new Intent(this, StkAppService.class).putExtras(args)); + mIsResponseSent = true; } } -- cgit v1.2.3