Stk: Erase SELECT_ITEM when SELECT_ITEM timer expired

Wait for 10 sec for select item response from network.
If any delay is there more than 10 sec from network
erase SELECT_ITEM.

Change-Id: If4b4b01603b33b2346db7930f87d39f6648b3bf1
(cherry picked from commit c50a0e33865c6eb8bdc6741477ebc339089472d1)
(cherry picked from commit 13c91235ed60738aed163e8d7127c83290805550)
(cherry picked from commit 25d49e968a9d98bd576a1938c59a4a1a5e8bb9d8)
Stk: Add Support for alpha in REFRESH command.

RIL_UNSOL_STK_EVENT_NOTIFY is given by RIL in case there is alpha
id to be displayed to user in refresh proactive cmd.
Support is added to display Alpha id to user when this event comes
due to REFRESH proactive cmd.
Also if refresh mode is init or reset, idle mode text needs to be
cleared as per stk 3GPP spec 11.14. This logic is handled in stk
app to satisfy both the above requiremnts.

CRs-Fixed: 474693

Change-Id: I277f27db200468dd8ca49dbf6959277f09db0c67
(cherry picked from commit dd81bf59e5ff06c7c9d3a2df1794bb291774a2e3)
(cherry picked from commit dfcafea94e7673677aa2bddbc586cb487925d3b7)
(cherry picked from commit aeb814891ac95e5425fa5727c3114036fa81d4a5)
(cherry picked from commit 8c23abd530de0492704c5829a0214d075b38ac38)
Stk: Timer Related Fixes

Stk: Timer not getting cancelled after user response

After user response, the timer should be cancelled.
Else the timer would expire and sends an untimely
Terminal response with RES_ID_TIMEOUT.

Change-Id: If0db10741afe36d619d4beb245ea62581d3cb98b
CRs-Fixed: 380634, 390635

Stk: StkDialog activity should not cancel timer when it is paused

During display text,  if any higher / lower priority events
such as incoming call, new sms, screen off intent,
notification alerts, user actions such as 'User moving to
another activtiy' etc.. occur during Display Text ongoing session,
this activity would receive 'onPause()' evt resulting in
cancellation of the timer. As a result no terminal response is
sent to the card

CRs-Fixed: 347841

Change-Id: I72be23ca5a99f995f03684e8bfdd6f3c8708363a

Stk: StkMenu/StkInput activity should not cancel timer when paused

During SelectItem / GetInkey / GetInput, if any
higher / lower priority events such as incoming call,
new sms, screen off intent,notification alerts,
user actions such as 'User moving to another activtiy' etc..
occur during SELECT ITEM / GETINKEY / GETINPUT ongoing session
respectively, the respective activity would receive
'onPause()' evt resulting in cancellation of the timer.
As a result no terminal response is sent to the card

CRs-Fixed: 349410
(cherry picked from commit 97d88f79eb83ffb514b12ff103f003a5bf8a36e9)
(cherry picked from commit 270fc2c30e362116d205db64873e2d908efce7c2)
(cherry picked from commit 63594c9892dcdf140c704799f26b59f8d379946a)
Stk: Usat Phase 2 feature support

This change combines the following fixes:

1) Usat Phase 2 feature support
Added changes to support Idle screen, Language Selection.
Fix Display Alpha for proactive commands
CRs-Fixed: 432647

2) Fix to display dialog for DISPLAY_TEXT commands
For Display Text commands that are low priority, we check the
Idle Screen status before displaying the dialog. However, the handling
for the result of the Idle Screen request is missing. Add this handling.
CRs-Fixed: 442763

3) Fix crash on Idle Mode Text proactive command
After checking for screen status, use the saved command object
to process the Idle Mode Text command.
CRs-Fixed: 448079

Change-Id: I978c8530e0f3a8813f2a7180bfb6bf40dcdc1ab0
(cherry picked from commit 9575fa181f18d676eb0682770b056021e58eed15)
(cherry picked from commit 0a5773d399a9bbc554247caba49e4bd1fc479fae)
(cherry picked from commit de03df8e0ee5c3d16654142707881f97e96f3406)
Add isBrowserLaunched API.

isBrowserLaunched API is required to check whether the
browser has been launched or not while the browser launch
mode is set to LAUNCH_IF_NOT_ALREADY_LAUNCHED.

Change-Id: If16061a2688448cfcd62d687873835435d1d56a7
CRs-Fixed: 538806
(cherry picked from commit fb743d60fe3ba3a3646b148966585cb1d5433aea)
(cherry picked from commit 126824815c6882f30180d294bf95b2f1f56841bf)
(cherry picked from commit 16cce60706d7847353558ce33ab293ec880300d7)
Stk: Icon related changes

Return appropriate result code, if icon is not displayed
and display text msg only if icon display fails or if icon is not
self explanatory.

Change-Id: Ia421eb136d15c22e8090f2db93d00fcafe94164e
(cherry picked from commit ed58b870845bdbdb3bb37fb941f9b8b0fce42c58)
(cherry picked from commit 14ed1228266750454bd135af2bfe87c7b5a337ae)
(cherry picked from commit 2553e680be79354ee19fbd8c346231f85e16556e)
Stk: Support for modem re-start and ICC refresh

Uninstall the STK app, stop StkAppService and remove the idle text
when StkAppService receives the CARD_ABSENT/CARD_ERROR status.

IdleModeText and SETUP_MENU need to be cleared when a card refresh
occurs.

Change-Id: I626ff5196270377d02c570703f46c5b272a115fd
(cherry picked from commit f48e483b46cfec93edc70fa9e39c8a7120b864f8)
(cherry picked from commit 8390bbbbfa8e170e81e8a99ab997fb1406d8e81a)
(cherry picked from commit dc0f924d464dbc093f1168f0e9a8bca8b0aea73c)
Modify intent name and handle LOCALE event properly

Modify intent name as per the change in telephony and handle
LOCALE change event properly.

Change-Id: I9f8e8db4e5aaa2948499e1382c0a7cd681b9da40
(cherry picked from commit f6c4758866a6a59805da703fad18e57bf2c8d139)
(cherry picked from commit 571939a912d511458d6de96f209b2a0d4a0327aa)
(cherry picked from commit 7a258b55ecf1c6a3208f4be1e25ca707917ccb48)
Stk: These changes are related to DISPLAY Text pro cmd

The following issues related to DISPLAY_TEXT are fixed in this change:
1. Send the Terminal Response if ResponseNeeded qualifier is set, after
the default duration else display message for ever.

2 When a high priority Display Text proactive command with infinite
time out is sent,user has to clear this message. The Terminal Response for
this command will be sent from Stk framework itself. Stk app receives
this message and displays it until user clears it.

While the text is being displayed if a next Proactive command is
received, it should be acted upon immediately.

Change-Id: I8245d50048310633eed8b4011eadfb86a93765c4
(cherry picked from commit c7eb621e09d2df3c0c79e276ed4af5a938cefaab)
(cherry picked from commit c4c37873c03b0ff5441ebb1b78c8609a67d8a82f)
(cherry picked from commit 54e6a2d3d567682c5cf52fb18a65fbf19061e68e)
STK: CC feature implementation

Handle ALPHA_NOTIFY and display a toast mesage to user.

Change-Id: I4f02237960003e9c6ebb477ea756923fd2598d0d
(cherry picked from commit 156aa279e4a30619d8ceae751ebd0b7f478bc85f)
(cherry picked from commit 65f857f7659619b4c82248c1eac187337e65a42c)
(cherry picked from commit 115e3bb98453db511cb8356071b3b0290a3272af)
Stk: Update Manifest for modified Idle Screen Intent

-Update StkCmdReceiver's intent-filter to use the updated idle
 screen intent name

Change-Id: I96ac34c116ba1891b7a96a013becd732c39e8c4a
(cherry picked from commit 4cbd4296596beb33fb36c6c4ddae09a7d9752755)
(cherry picked from commit 3d77fde32d2367389e2457bcef6f9ab1926ab701)
(cherry picked from commit 3a4df1a98b2aff812d4b92e0e87cf5db99a93fbd)
Stk: General Enhancements to StkAppService

- Support GET_CHANNEL_STATUS command
- Set mMainCmd to null (SET_UP_MENU) only when we
  receive a remove menu command
- Cleanup idlemode text code: Removed the intent extra
  SCREEN_STATUS_REQUEST which is no longer used.

Change-Id: I019130b58275794b16678af79096aa1a351f27d9
CRs-Fixed: 517578
(cherry picked from commit a78322f77b36a52cb9b1d592f7ce4f6c10fc15d1)
(cherry picked from commit f6f4c597ac4edae8380004d0eb71d0ccbd1a8a85)
(cherry picked from commit ef941af42508a88c2fce84fe91d7a4b124573d89)
Stk: Handle Null Alpha Identifer for Setup Call

- Per specification 102223 section 6.4.13:
  If the first alpha identifier is not provided by the UICC
  or is a null data object (ie. length is zero and has no
  value part) , the default setup call message is sent.

Change-Id: Ieb5eb25f004907ee68bea152e06b316da3ebfec0
(cherry picked from commit f9aa32b726993ba2fbe68b506379c152ea9937f6)
(cherry picked from commit c7116fcb386c3c4cab0ed244692c75c65b1ec809)
(cherry picked from commit cd3c48819d543a54f4e84c9602540354d5f94e3c)
Stk: Tone Playback Changes

- If alpha tag is null, play tone and start the ToneDialog
  activity with the default play tone message, otherwise
  start the ToneDialog activity normally.

Change-Id: I371f3b5c3e7e74fa4e5b486cdecedd57de823c96
CRs-Fixed: 517578
(cherry picked from commit 8cb688bf03deefa5c4dd24715e585240882c31c3)
(cherry picked from commit 4744de572dec78ebe85c10f4e465230cacacd2c7)
(cherry picked from commit 21533b0a32101d980e4abbe5d46a62f1804a9197)
MSIM: Add support for MSIM STK

Extended base stk functionality to support stk for
3 different cards. User will see 3 stk icons in launcher screen
if 3 cards inserted which support stk.

Change-Id: Iaf2e8c6f1c7a1321fb8bc333fff0e58f255809a1
(cherry picked from commit f132b6d0c2f055180efee39db8f7685caf224907)
(cherry picked from commit d4031426e268390e20e95a600f84eff87b7c6fc4)
Check CatService instance when event to be sent.

CatService pointer mStkService[i] may be null in cases like CatService
not ready at init or after an APM enable.sendSetUpEventResponse()
was not checking whether there is a valid CatService instance
before trying to send response leading to null pointer exception.

CRs-Fixed: 518348

Change-Id: I054bacd22a18f0a1a11a24ecf08968f2018a5a54
(cherry picked from commit f141bc2001199e767cbaa2f832a11ffcbf0f5696)
(cherry picked from commit 8d5faa3e17d2c059a29b22a6767de66a690491d8)
Stk: clean up internal state when ICC is removed

- For stability, reset ServiceHandler internal state to
 "before instantiation" when an ICC is removed.

Change-Id: I01baaacb770ab874e6588ea8da6e660a77bf5323
CRs-Fixed: 555795
Merge "Stk: clean up internal state when ICC is removed"
Merge "Stk: clean up internal state when ICC is removed"
Merge "Merge "Stk: clean up internal state when ICC is removed""