Special case for SAT Display Text

In the case where the SIM has required an immediate response the message
should be shown forever to the user and removed only when one of the
events specified in ETSI 102 223 ยง6.4.1 occurs. The implementation
of this case has been corrected

Change-Id: I17993542e1ba234a9e69b8162a9ae5271e176d07
diff --git a/src/com/android/stk/StkDialogActivity.java b/src/com/android/stk/StkDialogActivity.java
index 127f51b..b15e8df 100644
--- a/src/com/android/stk/StkDialogActivity.java
+++ b/src/com/android/stk/StkDialogActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.stk;
 
+import com.android.internal.telephony.cat.CatLog;
 import com.android.internal.telephony.cat.TextMessage;
 
 import android.app.Activity;
@@ -126,6 +127,23 @@
     @Override
     public void onResume() {
         super.onResume();
+
+        /*
+         * The user should be shown the message forever or until some high
+         * priority event occurs (such as incoming call, MMI code execution
+         * etc as mentioned in ETSI 102.223, 6.4.1).
+         *
+         * Since mTextMsg.responseNeeded is false (because the response has
+         * already been sent) and duration of the dialog is zero and userClear
+         * is true, don't set the timeout.
+         */
+        if (!mTextMsg.responseNeeded &&
+                StkApp.calculateDurationInMilis(mTextMsg.duration) == 0 &&
+                mTextMsg.userClear) {
+            CatLog.d(this, "User should clear text..show message forever");
+            return;
+        }
+
         startTimeOut(mTextMsg.userClear);
     }