diff options
author | Danny Baumann <dannybaumann@web.de> | 2015-11-05 11:06:09 +0100 |
---|---|---|
committer | LuK1337 <priv.luk@gmail.com> | 2015-11-23 23:01:51 +0100 |
commit | 2d18d9cc09e1dc76e4db58c3dd5b7b6552dbca63 (patch) | |
tree | 2abc6c5a677051c6ebfb4c869be6349a3cfa2662 | |
parent | 8480c33bf07ce7e48bc32f22ceb43af56187bf76 (diff) | |
download | android_frameworks_opt_telephony-2d18d9cc09e1dc76e4db58c3dd5b7b6552dbca63.tar.gz android_frameworks_opt_telephony-2d18d9cc09e1dc76e4db58c3dd5b7b6552dbca63.tar.bz2 android_frameworks_opt_telephony-2d18d9cc09e1dc76e4db58c3dd5b7b6552dbca63.zip |
Activate default UICC application if not done automatically.
Provides compatibility to the pre-M behaviour.
Change-Id: Ie87e40cf1da3b19fd37e2c07ff50845f0842216a
4 files changed, 42 insertions, 17 deletions
diff --git a/src/java/com/android/internal/telephony/BaseCommands.java b/src/java/com/android/internal/telephony/BaseCommands.java index 7ed320671..b36dca965 100644 --- a/src/java/com/android/internal/telephony/BaseCommands.java +++ b/src/java/com/android/internal/telephony/BaseCommands.java @@ -849,8 +849,7 @@ public abstract class BaseCommands implements CommandsInterface { return mRilVersion; } - public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus, - Message response) { + public void setUiccSubscription(int appIndex, boolean activate, Message response) { } public void setDataAllowed(boolean allowed, Message response) { diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java index 68837cb58..596004a2b 100644 --- a/src/java/com/android/internal/telephony/CommandsInterface.java +++ b/src/java/com/android/internal/telephony/CommandsInterface.java @@ -1914,20 +1914,15 @@ public interface CommandsInterface { /** * Sets user selected subscription at Modem. * - * @param slotId - * Slot. * @param appIndex * Application index in the card. - * @param subId - * Indicates subscription 0 or subscription 1. - * @param subStatus - * Activation status, 1 = activate and 0 = deactivate. + * @param activate + * Whether to activate or deactivate the subscription * @param result * Callback message contains the information of SUCCESS/FAILURE. */ // FIXME Update the doc and consider modifying the request to make more generic. - public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus, - Message result); + public void setUiccSubscription(int appIndex, boolean activate, Message result); /** * Tells the modem if data is allowed or not. diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java index 9bd46a92a..24f7520d7 100644 --- a/src/java/com/android/internal/telephony/RIL.java +++ b/src/java/com/android/internal/telephony/RIL.java @@ -773,19 +773,17 @@ public class RIL extends BaseCommands implements CommandsInterface { send(rr); } - public void setUiccSubscription(int slotId, int appIndex, int subId, - int subStatus, Message result) { + public void setUiccSubscription(int appIndex, boolean activate, Message result) { //Note: This RIL request is also valid for SIM and RUIM (ICC card) RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_UICC_SUBSCRIPTION, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) - + " slot: " + slotId + " appIndex: " + appIndex - + " subId: " + subId + " subStatus: " + subStatus); + + " appIndex: " + appIndex + " activate: " + activate); - rr.mParcel.writeInt(slotId); + rr.mParcel.writeInt(mInstanceId); rr.mParcel.writeInt(appIndex); - rr.mParcel.writeInt(subId); - rr.mParcel.writeInt(subStatus); + rr.mParcel.writeInt(mInstanceId); + rr.mParcel.writeInt(activate ? 1 : 0); send(rr); } diff --git a/src/java/com/android/internal/telephony/uicc/UiccCard.java b/src/java/com/android/internal/telephony/uicc/UiccCard.java index 455d189fb..14b10633d 100644 --- a/src/java/com/android/internal/telephony/uicc/UiccCard.java +++ b/src/java/com/android/internal/telephony/uicc/UiccCard.java @@ -83,6 +83,7 @@ public class UiccCard { private CatService mCatService; private RadioState mLastRadioState = RadioState.RADIO_UNAVAILABLE; private UiccCarrierPrivilegeRules mCarrierPrivilegeRules; + private boolean m3GPPAppActivated, m3GPP2AppActivated; private RegistrantList mAbsentRegistrants = new RegistrantList(); private RegistrantList mCarrierPrivilegeRegistrants = new RegistrantList(); @@ -190,6 +191,38 @@ public class UiccCard { mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARD_ADDED, null)); } } + if (mGsmUmtsSubscriptionAppIndex < 0 + && mCdmaSubscriptionAppIndex < 0 + && mCardState == CardState.CARDSTATE_PRESENT + && mCi.needsOldRilFeature("simactivation")) { + // Activate/Deactivate first 3GPP and 3GPP2 app in the SIM, if available + for (int i = 0; i < mUiccApplications.length; i++) { + if (mUiccApplications[i] == null) { + continue; + } + + AppType appType = mUiccApplications[i].getType(); + if (!m3GPPAppActivated && + (appType == AppType.APPTYPE_USIM || appType == AppType.APPTYPE_SIM)) { + mCi.setUiccSubscription(i, true, null); + m3GPPAppActivated = true; + } else if (!m3GPP2AppActivated && + (appType == AppType.APPTYPE_CSIM || appType == AppType.APPTYPE_RUIM)) { + mCi.setUiccSubscription(i, true, null); + m3GPP2AppActivated = true; + } + + if (m3GPPAppActivated && m3GPP2AppActivated) { + break; + } + } + } else { + // SIM removed, reset activation flags to make sure + // to re-run the activation at the next insertion + m3GPPAppActivated = false; + m3GPP2AppActivated = false; + } + mLastRadioState = radioState; } } |