diff options
author | Preeti Ahuja <preetia@codeaurora.org> | 2014-12-05 15:04:05 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-01-15 08:15:02 -0800 |
commit | 7cf0cc02a63c001ff712a94afee96893d43fd117 (patch) | |
tree | 03640690a209f32c085c2734e9e52d23c405ce6f | |
parent | 005c8deed9f70ef23ccf33e0bdbf80f97b19a683 (diff) | |
download | android_packages_apps_Stk-7cf0cc02a63c001ff712a94afee96893d43fd117.tar.gz android_packages_apps_Stk-7cf0cc02a63c001ff712a94afee96893d43fd117.tar.bz2 android_packages_apps_Stk-7cf0cc02a63c001ff712a94afee96893d43fd117.zip |
Stop the StkAppService in multi sim scenario correctly.
Handle the stopping of the stk service and uninstallation of
stk apps for boot complete, idle screen intents for msim
scenario correctly.
Change-Id: I9a8df6d3c2534aa98d8913af2ef26b0bce8406e1
CRs-Fixed: 765030
-rwxr-xr-x | src/com/android/stk/StkAppService.java | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java index 34f6715..c6145bb 100755 --- a/src/com/android/stk/StkAppService.java +++ b/src/com/android/stk/StkAppService.java @@ -208,13 +208,24 @@ public class StkAppService extends Service { } int slotId = args.getInt(SLOT_ID); + int opCode = args.getInt(OPCODE); updateCatService(slotId); - if (mStkService[slotId] == null) { - stopSelfIfRequired(); - CatLog.d(this, " Unable to get Service handle for slot" + slotId); - StkAppInstaller.unInstall(mContext, slotId); - return; + + // Boot Complete and Idle screen notifications will not contain a + // slotId. If we receive a boot complete or idle screen intent or any other + // intent with a slotId for which the uicc card is absent/not ready, + // check and unistall the stk apps corresponding to all slotIds for which the card + // is absent/not ready. If all the cards are absent/not ready, stop the + // StkAppService and return. If not, continue processing the intent. + if ((opCode == OP_BOOT_COMPLETED) || (opCode == OP_IDLE_SCREEN) || + (mStkService[slotId] == null) ) { + checkAndUnInstallStkApps(); + if (isStopServiceRequired()) { + CatLog.d(this, "stopping StkAppService"); + stopSelf(); + return; + } } Message msg = mServiceHandler[slotId].obtainMessage(); @@ -260,17 +271,26 @@ public class StkAppService extends Service { mServiceHandler[slotId].sendMessage(msg); } - private void stopSelfIfRequired() { - boolean isStopServiceRequired = true; + private void checkAndUnInstallStkApps() { + for (int i = 0; i < mSimCount; i++) { + if (mStkService[i] == null) { + CatLog.d(this, " Unistalling Stk App for slot: " + i); + StkAppInstaller.unInstall(mContext, i); + } + } + } + + private boolean isStopServiceRequired () { + boolean stopServiceRequired = true; for (int i = 0; i < mSimCount; i++) { if (mStkService[i] != null) { - isStopServiceRequired = false; + stopServiceRequired = false; break; } } - - if (isStopServiceRequired) stopSelf(); + return stopServiceRequired; } + private void InitHandlerThread() { for (int i = 0; i < mSimCount; i++) { mHandlerThread[i] = new HandlerThread("ServiceHandler" + i); |