summaryrefslogtreecommitdiffstats
path: root/src/com/android/stk/ToneDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/stk/ToneDialog.java')
-rw-r--r--src/com/android/stk/ToneDialog.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java
index eaba498..0ad6ee8 100644
--- a/src/com/android/stk/ToneDialog.java
+++ b/src/com/android/stk/ToneDialog.java
@@ -38,7 +38,7 @@ public class ToneDialog extends Activity {
TextMessage toneMsg = null;
ToneSettings settings = null;
TonePlayer player = null;
- Vibrator mVibrator = null;
+ boolean mIsResponseSent = false;
/**
* Handler used to stop tones from playing when the duration ends.
@@ -55,6 +55,7 @@ public class ToneDialog extends Activity {
}
};
+ Vibrator mVibrator;
// Message id to signal tone duration timeout.
private static final int MSG_ID_STOP_TONE = 0xda;
@@ -63,9 +64,9 @@ public class ToneDialog extends Activity {
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
- initFromIntent(getIntent());
+ mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
- mVibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
+ initFromIntent(getIntent());
// remove window title
View title = findViewById(com.android.internal.R.id.title);
@@ -100,8 +101,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();
@@ -131,5 +133,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;
}
}