diff options
Diffstat (limited to 'src/com/android/stk/StkMenuActivity.java')
-rw-r--r-- | src/com/android/stk/StkMenuActivity.java | 52 |
1 files changed, 3 insertions, 49 deletions
diff --git a/src/com/android/stk/StkMenuActivity.java b/src/com/android/stk/StkMenuActivity.java index 3d5641c..fb4f84c 100644 --- a/src/com/android/stk/StkMenuActivity.java +++ b/src/com/android/stk/StkMenuActivity.java @@ -55,8 +55,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex private boolean mAcceptUsersInput = true; private int mSlotId = -1; private boolean mIsResponseSent = false; - // Determines whether this is in the pending state. - private boolean mIsPending = false; private TextView mTitleTextView = null; private ImageView mTitleIconView = null; @@ -71,7 +69,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex private static final String ACCEPT_USERS_INPUT_KEY = "accept_users_input"; private static final String RESPONSE_SENT_KEY = "response_sent"; private static final String ALARM_TIME_KEY = "alarm_time"; - private static final String PENDING = "pending"; private static final String SELECT_ALARM_TAG = LOG_TAG; private static final long NO_SELECT_ALARM = -1; @@ -116,6 +113,9 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex finish(); return; } + if (mState == STATE_SECONDARY) { + appService.getStkContext(mSlotId).setPendingActivityInstance(this); + } } @Override @@ -182,11 +182,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex } displayMenu(); - // If the terminal has already sent response to the card when this activity is resumed, - // keep this as a pending activity as this should be finished when the session ends. - if (!mIsResponseSent) { - setPendingState(false); - } if (mAlarmTime == NO_SELECT_ALARM) { startTimeOut(); } @@ -221,23 +216,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex public void onStop() { super.onStop(); CatLog.d(LOG_TAG, "onStop, slot id: " + mSlotId + "," + mIsResponseSent + "," + mState); - - // Nothing should be done here if this activity is being finished or restarted now. - if (isFinishing() || isChangingConfigurations()) { - return; - } - - if (mIsResponseSent) { - // It is unnecessary to keep this activity if the response was already sent and - // the dialog activity is NOT on the top of this activity. - if (mState == STATE_SECONDARY && !appService.isStkDialogActivated()) { - finish(); - } - } else { - // This instance should be registered as the pending activity here - // only when no response has been sent back to the card. - setPendingState(true); - } } @Override @@ -345,7 +323,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex outState.putBoolean(ACCEPT_USERS_INPUT_KEY, mAcceptUsersInput); outState.putBoolean(RESPONSE_SENT_KEY, mIsResponseSent); outState.putLong(ALARM_TIME_KEY, mAlarmTime); - outState.putBoolean(PENDING, mIsPending); } @Override @@ -367,24 +344,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex if (mAlarmTime != NO_SELECT_ALARM) { startTimeOut(); } - - if (!mIsResponseSent && !savedInstanceState.getBoolean(PENDING)) { - // If this is in the foreground and no response has been sent to the card, - // this must not be registered as pending activity by the previous instance. - // No need to renew nor clear pending activity in this case. - } else { - // Renew the instance of the pending activity. - setPendingState(true); - } - } - - private void setPendingState(boolean on) { - if (mState == STATE_SECONDARY) { - if (mIsPending != on) { - appService.getStkContext(mSlotId).setPendingActivityInstance(on ? this : null); - mIsPending = on; - } - } } private void cancelTimeOut() { @@ -502,11 +461,6 @@ public class StkMenuActivity extends ListActivity implements View.OnCreateContex args.putInt(StkAppService.MENU_SELECTION, itemId); args.putBoolean(StkAppService.HELP, help); appService.sendResponse(args, mSlotId); - - // This instance should be set as a pending activity and finished by the service. - if (resId != StkAppService.RES_ID_END_SESSION) { - setPendingState(true); - } } private final BroadcastReceiver mLocalBroadcastReceiver = new BroadcastReceiver() { |