Merge "StkAppSerice: Stop the service when CatService Instance is null"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a54826e..994abdb 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -16,6 +16,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
package="com.android.stk"
android:sharedUserId="android.uid.phone">
@@ -80,7 +81,8 @@
</intent-filter>
</receiver>
- <receiver android:name="com.android.stk.BootCompletedReceiver">
+ <receiver android:name="com.android.stk.BootCompletedReceiver"
+ androidprv:primaryUserOnly="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml
index 9850cbb..bef8ddd 100644
--- a/res/values-fa/strings.xml
+++ b/res/values-fa/strings.xml
@@ -29,7 +29,7 @@
<string name="alphabet" msgid="1583185545938805861">"الفبا"</string>
<string name="digits" msgid="1746796679021682388">"ارقام (0-9، *، #، +)"</string>
<string name="default_call_setup_msg" msgid="7960194995759849940">"تماس در حال انجام..."</string>
- <string name="stk_app_state" msgid="18582277302584082">"حالت برنامه کاربردی"</string>
+ <string name="stk_app_state" msgid="18582277302584082">"حالت برنامهٔ کاربردی"</string>
<string name="enable_app" msgid="3701224550936728203">"فعال شد"</string>
<string name="disable_app" msgid="6725081975611415214">"غیرفعال شد"</string>
<string name="stk_dialog_title" msgid="6954825385456886726">"کیت ابزار سیم کارت"</string>
diff --git a/src/com/android/stk/StkApp.java b/src/com/android/stk/StkApp.java
index 0f0af52..4484493 100644
--- a/src/com/android/stk/StkApp.java
+++ b/src/com/android/stk/StkApp.java
@@ -32,8 +32,12 @@
static final int MENU_ID_BACK = android.view.Menu.FIRST + 1;
static final int MENU_ID_HELP = android.view.Menu.FIRST + 2;
- // UI timeout, 30 seconds - used for display dialog and activities.
- static final int UI_TIMEOUT = (40 * 1000);
+ // Display Text timeouts
+ static final int DISP_TEXT_CLEAR_AFTER_DELAY_TIMEOUT = (15 * 1000);
+ static final int DISP_TEXT_WAIT_FOR_USER_TIMEOUT = (60 * 1000);
+
+ // UI timeout, 30 seconds - used for menues and input
+ static final int UI_TIMEOUT = (30 * 1000);
// Tone default timeout - 2 seconds
static final int TONE_DFEAULT_TIMEOUT = (2 * 1000);
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index bed2caa..f729e88 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -392,6 +392,7 @@
case DISPLAY_TEXT:
TextMessage msg = cmdMsg.geTextMessage();
responseNeeded = msg.responseNeeded;
+ waitForUsersResponse = msg.responseNeeded;
if (lastSelectedItem != null) {
msg.title = lastSelectedItem;
} else if (mMainCmd != null){
@@ -551,7 +552,7 @@
resMsg.setResultCode(ResultCode.OK);
resMsg.setConfirmation(confirmed);
if (confirmed) {
- launchCallMsg();
+ launchEventMessage(mCurrentCmd.getCallSettings().callMsg);
}
break;
}
@@ -648,7 +649,7 @@
private void launchTextDialog() {
Intent newIntent = new Intent(this, StkDialogActivity.class);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_MULTIPLE_TASK
+ | Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NO_HISTORY
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
| getFlagActivityNoUserAction(InitiatedByUserAction.unknown));
@@ -657,7 +658,10 @@
}
private void launchEventMessage() {
- TextMessage msg = mCurrentCmd.geTextMessage();
+ launchEventMessage(mCurrentCmd.geTextMessage());
+ }
+
+ private void launchEventMessage(TextMessage msg) {
if (msg == null || msg.text == null) {
return;
}
@@ -746,19 +750,6 @@
} catch (InterruptedException e) {}
}
- private void launchCallMsg() {
- TextMessage msg = mCurrentCmd.getCallSettings().callMsg;
- if (msg.text == null || msg.text.length() == 0) {
- return;
- }
- msg.title = lastSelectedItem;
-
- Toast toast = Toast.makeText(mContext.getApplicationContext(), msg.text,
- Toast.LENGTH_LONG);
- toast.setGravity(Gravity.BOTTOM, 0, 0);
- toast.show();
- }
-
private void launchIdleText() {
TextMessage msg = mCurrentCmd.geTextMessage();
diff --git a/src/com/android/stk/StkDialogActivity.java b/src/com/android/stk/StkDialogActivity.java
index 3fd3ef7..127f51b 100644
--- a/src/com/android/stk/StkDialogActivity.java
+++ b/src/com/android/stk/StkDialogActivity.java
@@ -126,7 +126,7 @@
@Override
public void onResume() {
super.onResume();
- startTimeOut();
+ startTimeOut(mTextMsg.userClear);
}
@Override
@@ -175,12 +175,18 @@
mTimeoutHandler.removeMessages(MSG_ID_TIMEOUT);
}
- private void startTimeOut() {
+ private void startTimeOut(boolean waitForUserToClear) {
// Reset timeout.
cancelTimeOut();
int dialogDuration = StkApp.calculateDurationInMilis(mTextMsg.duration);
+ // If duration is specified, this has priority. If not, set timeout
+ // according to condition given by the card.
if (dialogDuration == 0) {
- dialogDuration = StkApp.UI_TIMEOUT;
+ if (waitForUserToClear) {
+ dialogDuration = StkApp.DISP_TEXT_WAIT_FOR_USER_TIMEOUT;
+ } else {
+ dialogDuration = StkApp.DISP_TEXT_CLEAR_AFTER_DELAY_TIMEOUT;
+ }
}
mTimeoutHandler.sendMessageDelayed(mTimeoutHandler
.obtainMessage(MSG_ID_TIMEOUT), dialogDuration);
diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java
index 0370939..0ad6ee8 100644
--- a/src/com/android/stk/ToneDialog.java
+++ b/src/com/android/stk/ToneDialog.java
@@ -55,7 +55,7 @@
}
};
- Vibrator mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
+ Vibrator mVibrator;
// Message id to signal tone duration timeout.
private static final int MSG_ID_STOP_TONE = 0xda;
@@ -64,7 +64,9 @@
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
- initFromIntent(getIntent());
+ mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);
+
+ initFromIntent(getIntent());
// remove window title
View title = findViewById(com.android.internal.R.id.title);