diff options
author | Preeti Ahuja <preetia@codeaurora.org> | 2013-06-25 19:31:49 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:53:50 -0700 |
commit | 3eabb6728502b1c1d992470c333e96326b5e49e8 (patch) | |
tree | 8b1da574bd663ec7aff5fa4396a2fb6360992d44 | |
parent | 7e93e6bb02fbef8d338fff1172da2146733b96a6 (diff) | |
download | android_packages_apps_Stk-3eabb6728502b1c1d992470c333e96326b5e49e8.tar.gz android_packages_apps_Stk-3eabb6728502b1c1d992470c333e96326b5e49e8.tar.bz2 android_packages_apps_Stk-3eabb6728502b1c1d992470c333e96326b5e49e8.zip |
Stk: These changes are related to DISPLAY Text pro cmd
1. Handle high priority and normal priority display text
command correctly.
2. For display text with immediate response, send the terminal
response immediately after showing the text dialog. Block all
responses from StkDialogActivity, if display text is
with immediate response. Remove the check for response needed
in StkAppService, since un wanted responses are already
blocked in StkDialogActivity.
3. While the text is being displayed if a next Proactive command is
received, it should be acted upon immediately.
Change-Id: I8245d50048310633eed8b4011eadfb86a93765c4
-rw-r--r-- | src/com/android/stk/StkAppService.java | 29 | ||||
-rw-r--r-- | src/com/android/stk/StkDialogActivity.java | 108 |
2 files changed, 75 insertions, 62 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java index 494a843..ea58f9e 100644 --- a/src/com/android/stk/StkAppService.java +++ b/src/com/android/stk/StkAppService.java @@ -167,7 +167,7 @@ public class StkAppService extends Service implements Runnable { // Notification id used to display Idle Mode text in NotificationManager. private static final int STK_NOTIFICATION_ID = 333; private CatCmdMessage mIdleModeTextCmd = null; - private boolean mDisplayText = false; + private boolean mIsDisplayTextPending = false; private boolean mScreenIdle = true; // Inner class used for queuing telephony messages (proactive commands, @@ -364,17 +364,15 @@ public class StkAppService extends Service implements Runnable { } break; case OP_RESPONSE: - if (responseNeeded) { handleCmdResponse((Bundle) msg.obj); - } // call delayed commands if needed. if (mCmdsQ.size() != 0) { callDelayedMsg(); } else { mCmdInProgress = false; } - // reset response needed state var to its original value. - responseNeeded = true; + //reset mIsDisplayTextPending after sending the response. + mIsDisplayTextPending = false; break; case OP_END_SESSION: if (!mCmdInProgress) { @@ -453,13 +451,16 @@ public class StkAppService extends Service implements Runnable { if (mIdleModeTextCmd != null) { launchIdleText(); } - if (mDisplayText) { + + // Show user the display text or send screen busy response + // if previous display text command is pending. + if (mIsDisplayTextPending) { if (!mScreenIdle) { sendScreenBusyResponse(); } else { launchTextDialog(); } - mDisplayText = false; + mIsDisplayTextPending = false; // If an idle text proactive command is set then the // request for getting screen status still holds true. if (mIdleModeTextCmd == null) { @@ -478,8 +479,6 @@ public class StkAppService extends Service implements Runnable { CatLog.d(this, "SCREEN_BUSY"); resMsg.setResultCode(ResultCode.TERMINAL_CRNTLY_UNABLE_TO_PROCESS); mStkService.onCmdResponse(resMsg); - // reset response needed state var to its original value. - responseNeeded = true; if (mCmdsQ.size() != 0) { callDelayedMsg(); } else { @@ -587,7 +586,6 @@ public class StkAppService extends Service implements Runnable { switch (cmdMsg.getCmdType()) { case DISPLAY_TEXT: TextMessage msg = cmdMsg.geTextMessage(); - responseNeeded = msg.responseNeeded; waitForUsersResponse = msg.responseNeeded; if (lastSelectedItem != null) { msg.title = lastSelectedItem; @@ -608,7 +606,7 @@ public class StkAppService extends Service implements Runnable { Intent StkIntent = new Intent(AppInterface.CHECK_SCREEN_IDLE_ACTION); StkIntent.putExtra(SCREEN_STATUS_REQUEST, true); sendBroadcast(StkIntent); - mDisplayText = true; + mIsDisplayTextPending = true; } else { launchTextDialog(); } @@ -731,7 +729,7 @@ public class StkAppService extends Service implements Runnable { mSetupEventListSettings = mCurrentCmd.getSetEventList(); mCurrentSetupEventCmd = mCurrentCmd; mCurrentCmd = mMainCmd; - if ((mIdleModeTextCmd == null) && (!mDisplayText)) { + if ((mIdleModeTextCmd == null) && (!mIsDisplayTextPending)) { for (int i : mSetupEventListSettings.eventList) { if (i == IDLE_SCREEN_AVAILABLE_EVENT) { @@ -935,11 +933,18 @@ public class StkAppService extends Service implements Runnable { Intent newIntent = new Intent(this, StkDialogActivity.class); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP + | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | getFlagActivityNoUserAction(InitiatedByUserAction.unknown)); newIntent.putExtra("TEXT", mCurrentCmd.geTextMessage()); startActivity(newIntent); + // For display texts with immediate response, send the terminal response + // immediately. responseNeeded will be false, if display text command has + // the immediate response tlv. + if (!mCurrentCmd.geTextMessage().responseNeeded) { + sendResponse(RES_ID_CONFIRM, mCurrentSlotId, true); + } } private void sendSetUpEventResponse(int event, byte[] addedInfo) { diff --git a/src/com/android/stk/StkDialogActivity.java b/src/com/android/stk/StkDialogActivity.java index 33ea581..53edbde 100644 --- a/src/com/android/stk/StkDialogActivity.java +++ b/src/com/android/stk/StkDialogActivity.java @@ -19,6 +19,7 @@ package com.android.stk; import com.android.internal.telephony.cat.CatLog; import com.android.internal.telephony.cat.TextMessage; +import com.android.internal.telephony.cat.CatLog; import android.app.Activity; import android.content.Intent; @@ -67,18 +68,9 @@ public class StkDialogActivity extends Activity implements View.OnClickListener protected void onCreate(Bundle icicle) { super.onCreate(icicle); - initFromIntent(getIntent()); - if (mTextMsg == null) { - finish(); - return; - } - requestWindowFeature(Window.FEATURE_LEFT_ICON); - Window window = getWindow(); setContentView(R.layout.stk_msg_dialog); - TextView mMessageView = (TextView) window - .findViewById(R.id.dialog_message); Button okButton = (Button) findViewById(R.id.button_ok); Button cancelButton = (Button) findViewById(R.id.button_cancel); @@ -86,35 +78,21 @@ public class StkDialogActivity extends Activity implements View.OnClickListener okButton.setOnClickListener(this); cancelButton.setOnClickListener(this); - setTitle(mTextMsg.title); - if (!(mTextMsg.iconSelfExplanatory && mTextMsg.icon != null)) { - mMessageView.setText(mTextMsg.text); - } - - if (mTextMsg.icon == null) { - window.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, - com.android.internal.R.drawable.stat_notify_sim_toolkit); - } else { - window.setFeatureDrawable(Window.FEATURE_LEFT_ICON, - new BitmapDrawable(mTextMsg.icon)); - } } public void onClick(View v) { String input = null; - switch (v.getId()) { - case OK_BUTTON: - cancelTimeOut(); - sendResponse(StkAppService.RES_ID_CONFIRM, true); - finish(); - break; - case CANCEL_BUTTON: - cancelTimeOut(); - sendResponse(StkAppService.RES_ID_CONFIRM, false); - finish(); - break; + case OK_BUTTON: + cancelTimeOut(); + sendResponse(StkAppService.RES_ID_CONFIRM, true); + break; + case CANCEL_BUTTON: + cancelTimeOut(); + sendResponse(StkAppService.RES_ID_CONFIRM, false); + break; } + finish(); } @Override @@ -133,22 +111,43 @@ public class StkDialogActivity extends Activity implements View.OnClickListener public void onResume() { super.onResume(); + initFromIntent(getIntent()); + if (mTextMsg == null) { + finish(); + return; + } + + Window window = getWindow(); + + TextView mMessageView = (TextView) window + .findViewById(R.id.dialog_message); + + setTitle(mTextMsg.title); + + if (!(mTextMsg.iconSelfExplanatory && mTextMsg.icon != null)) { + mMessageView.setText(mTextMsg.text); + } + + if (mTextMsg.icon == null) { + window.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, + com.android.internal.R.drawable.stat_notify_sim_toolkit); + } else { + window.setFeatureDrawable(Window.FEATURE_LEFT_ICON, + new BitmapDrawable(mTextMsg.icon)); + } + + /* - * 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 the userClear flag is set and dialogduration is set to 0, the display Text + * should be displayed to user forever until some high priority event occurs + * (incoming call, MMI code execution etc as mentioned under section + * ETSI 102.223, 6.4.1) */ - if (!mTextMsg.responseNeeded && - StkApp.calculateDurationInMilis(mTextMsg.duration) == 0 && - mTextMsg.userClear) { - CatLog.d(this, "User should clear text..show message forever"); + if (StkApp.calculateDurationInMilis(mTextMsg.duration) == 0 && + !mTextMsg.responseNeeded && mTextMsg.userClear) { + CatLog.d(this, "User should clear text..showing message forever"); return; } - startTimeOut(mTextMsg.userClear); } @@ -195,13 +194,21 @@ public class StkDialogActivity extends Activity implements View.OnClickListener mTextMsg = savedInstanceState.getParcelable(TEXT); } + @Override + protected void onNewIntent(Intent intent) { + CatLog.d(this, "onNewIntent - updating the same Dialog box"); + setIntent(intent); + } + private void sendResponse(int resId, boolean confirmed) { - Bundle args = new Bundle(); - args.putInt(StkAppService.OPCODE, StkAppService.OP_RESPONSE); - args.putInt(StkAppService.RES_ID, resId); - args.putBoolean(StkAppService.CONFIRMATION, confirmed); - startService(new Intent(this, StkAppService.class).putExtras(args)); - mIsResponseSent = true; + if (mTextMsg.responseNeeded) { + Bundle args = new Bundle(); + args.putInt(StkAppService.OPCODE, StkAppService.OP_RESPONSE); + args.putInt(StkAppService.RES_ID, resId); + args.putBoolean(StkAppService.CONFIRMATION, confirmed); + startService(new Intent(this, StkAppService.class).putExtras(args)); + mIsResponseSent = true; + } } private void sendResponse(int resId) { @@ -222,6 +229,7 @@ public class StkDialogActivity extends Activity implements View.OnClickListener } private void startTimeOut(boolean waitForUserToClear) { + // Reset timeout. cancelTimeOut(); int dialogDuration = StkApp.calculateDurationInMilis(mTextMsg.duration); |