-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path0001-telephony-Squashed-support-for-simactivation-feature.patch
More file actions
237 lines (209 loc) · 10.2 KB
/
Copy path0001-telephony-Squashed-support-for-simactivation-feature.patch
File metadata and controls
237 lines (209 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
From c60ff698240b932ea09804f7e8337a761fdbecf0 Mon Sep 17 00:00:00 2001
From: Bruno Martins <bgcngm@gmail.com>
Date: Wed, 6 Sep 2017 11:06:09 +0100
Subject: [PATCH 1/5] telephony: Squashed support for simactivation feature
* This is a squash of the "OldRilFeatures" implementation plus
the following changes, forward-ported to R.
Author: Danny Baumann <dannybaumann@web.de>
Date: Mon Dec 7 16:37:45 2015 +0100
Also activate default UICC apps once after SIM presence.
Some devices apparently need this, and it shouldn't hurt on other
devices either.
Change-Id: I7feb27cceeffc30081e682a6f6b0e2bdb6ad5087
Author: Danny Baumann <dannybaumann@web.de>
Date: Thu Nov 5 11:06:09 2015 +0100
Activate default UICC application if not done automatically.
Provides compatibility to the pre-M behaviour.
Change-Id: Ie87e40cf1da3b19fd37e2c07ff50845f0842216a
Change-Id: I785a91dadd79713f57641a3c20a94a0220a723e9
---
.../internal/telephony/BaseCommands.java | 3 +-
.../internal/telephony/CommandsInterface.java | 11 ++--
.../com/android/internal/telephony/RIL.java | 20 +++++---
.../internal/telephony/uicc/UiccProfile.java | 51 +++++++++++++++++++
.../telephony/SimulatedCommandsVerifier.java | 3 +-
5 files changed, 69 insertions(+), 19 deletions(-)
diff --git a/src/java/com/android/internal/telephony/BaseCommands.java b/src/java/com/android/internal/telephony/BaseCommands.java
index 02530daa7..89580ba7e 100644
--- a/src/java/com/android/internal/telephony/BaseCommands.java
+++ b/src/java/com/android/internal/telephony/BaseCommands.java
@@ -947,8 +947,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 a69e47d1c..5af01e947 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -2189,21 +2189,16 @@ 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.
@UnsupportedAppUsage
- public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus,
- Message result);
+ public void setUiccSubscription(int appIndex, boolean activate, Message result);
/**
* Whether the device modem supports reporting the EID in either the slot or card status or
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 56c81d1da..74e93be88 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -255,6 +255,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
AtomicBoolean mTestingEmergencyCall = new AtomicBoolean(false);
final Integer mPhoneId;
+ private List<String> mOldRilFeatures;
private static final String PROPERTY_IS_VONR_ENABLED = "persist.radio.is_vonr_enabled_";
@@ -620,6 +621,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
mRadioBugDetector = new RadioBugDetector(context, mPhoneId);
}
+ final String oldRilFeatures = SystemProperties.get("ro.telephony.ril.config", "");
+ mOldRilFeatures = Arrays.asList(oldRilFeatures.split(","));
+
TelephonyManager tm = (TelephonyManager) context.getSystemService(
Context.TELEPHONY_SERVICE);
mIsCellularSupported = tm.isVoiceCapable() || tm.isSmsCapable() || tm.isDataCapable();
@@ -4678,8 +4682,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
}
@Override
- public void setUiccSubscription(int slotId, int appIndex, int subId,
- int subStatus, Message result) {
+ public void setUiccSubscription(int appIndex, boolean activate, Message result) {
IRadio radioProxy = getRadioProxy(result);
if (radioProxy != null) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_UICC_SUBSCRIPTION, result,
@@ -4687,15 +4690,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
if (RILJ_LOGD) {
riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
- + " slot = " + slotId + " appIndex = " + appIndex
- + " subId = " + subId + " subStatus = " + subStatus);
+ + " appIndex: " + appIndex + " activate: " + activate);
}
SelectUiccSub info = new SelectUiccSub();
- info.slot = slotId;
+ info.slot = mPhoneId;
info.appIndex = appIndex;
- info.subType = subId;
- info.actStatus = subStatus;
+ info.subType = mPhoneId;
+ info.actStatus = activate ? 1 : 0;
try {
radioProxy.setUiccSubscription(rr.mSerial, info);
@@ -7811,4 +7813,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
public HalVersion getHalVersion() {
return mRadioVersion;
}
+
+ public boolean needsOldRilFeature(String feature) {
+ return mOldRilFeatures.contains(feature);
+ }
}
diff --git a/src/java/com/android/internal/telephony/uicc/UiccProfile.java b/src/java/com/android/internal/telephony/uicc/UiccProfile.java
index e9f721cb6..91e8e7cdb 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccProfile.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccProfile.java
@@ -62,6 +62,7 @@ import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.RIL;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyStatsLog;
import com.android.internal.telephony.cat.CatService;
@@ -115,6 +116,7 @@ public class UiccProfile extends IccCard {
private CatService mCatService;
private UiccCarrierPrivilegeRules mCarrierPrivilegeRules;
private UiccCarrierPrivilegeRules mTestOverrideCarrierPrivilegeRules;
+ private boolean mDefaultAppsActivated;
private boolean mDisposed = false;
private RegistrantList mCarrierPrivilegeRegistrants = new RegistrantList();
@@ -1112,10 +1114,59 @@ public class UiccProfile extends IccCard {
if (mRadioTech != ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
setCurrentAppType(ServiceState.isGsm(mRadioTech));
}
+
+ if (needsSimActivation()) {
+ if (ics.mCardState == CardState.CARDSTATE_PRESENT) {
+ if (!mDefaultAppsActivated) {
+ activateDefaultApps();
+ mDefaultAppsActivated = true;
+ }
+ } else {
+ // SIM removed, reset activation flag to make sure
+ // to re-run the activation at the next insertion
+ mDefaultAppsActivated = false;
+ }
+ }
+
updateIccAvailability(true);
}
}
+ private boolean needsSimActivation() {
+ if (mCi instanceof RIL) {
+ return ((RIL) mCi).needsOldRilFeature("simactivation");
+ }
+ return false;
+ }
+
+ private void activateDefaultApps() {
+ int gsmIndex = mGsmUmtsSubscriptionAppIndex;
+ int cdmaIndex = mCdmaSubscriptionAppIndex;
+
+ if (gsmIndex < 0 || cdmaIndex < 0) {
+ for (int i = 0; i < mUiccApplications.length; i++) {
+ if (mUiccApplications[i] == null) {
+ continue;
+ }
+
+ AppType appType = mUiccApplications[i].getType();
+ if (gsmIndex < 0 &&
+ (appType == AppType.APPTYPE_USIM || appType == AppType.APPTYPE_SIM)) {
+ gsmIndex = i;
+ } else if (cdmaIndex < 0 &&
+ (appType == AppType.APPTYPE_CSIM || appType == AppType.APPTYPE_RUIM)) {
+ cdmaIndex = i;
+ }
+ }
+ }
+ if (gsmIndex >= 0) {
+ mCi.setUiccSubscription(gsmIndex, true, null);
+ }
+ if (cdmaIndex >= 0) {
+ mCi.setUiccSubscription(cdmaIndex, true, null);
+ }
+ }
+
private void createAndUpdateCatServiceLocked() {
if (mUiccApplications.length > 0 && mUiccApplications[0] != null) {
// Initialize or Reinitialize CatService
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java b/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java
index e9c74ae23..5bd4fe0c1 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java
@@ -1334,8 +1334,7 @@ public class SimulatedCommandsVerifier implements CommandsInterface {
}
@Override
- public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus,
- Message result) {
+ public void setUiccSubscription(int appIndex, boolean activate, Message result) {
}
--
2.35.1