aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-12-13 23:12:32 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-12-13 23:12:32 +0000
commit7cff8ecb91d85d696c390c5e0e146c65a60643a5 (patch)
treecb6dcd31927fbcdbf94625627a4fb509211a666d
parent1e6403dfd3b4336cec3d082c4f64117703c74c22 (diff)
parent40d224bee718fe8dd27e94189b5211ef43dfd11b (diff)
downloadtelephony-temp_sam_210511427.tar.gz
Merge "Change to use supplyNetworkDepersonalization to unlock network in lower RIL versions" am: 40d224bee7temp_sam_210511427
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1906253 Change-Id: Ib953fa4c7481b01f0fedafe71cdfe0816b5c94c0
-rw-r--r--src/java/com/android/internal/telephony/RIL.java4
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/RILTest.java75
2 files changed, 79 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index b10cad832f..0db22ebfaf 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -1267,6 +1267,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
handleRadioProxyExceptionForRR(SIM_SERVICE, "supplySimDepersonalization", e);
}
} else {
+ if (PersoSubState.PERSOSUBSTATE_SIM_NETWORK == persoType) {
+ supplyNetworkDepersonalization(controlKey, result);
+ return;
+ }
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "supplySimDepersonalization: REQUEST_NOT_SUPPORTED");
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
index 687882c625..5504a50b49 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
@@ -30,6 +30,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEVICE_IDE
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DTMF;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_UICC_APPLICATIONS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_DEPERSONALIZATION;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PIN;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PIN2;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PUK;
@@ -168,6 +169,8 @@ import android.util.SparseArray;
import androidx.test.filters.FlakyTest;
+import com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -473,6 +476,78 @@ public class RILTest extends TelephonyTest {
@FlakyTest
@Test
+ public void testSupplySimDepersonalization() throws Exception {
+
+ String controlKey = "1234";
+ PersoSubState persoType = PersoSubState.PERSOSUBSTATE_SIM_NETWORK_PUK;
+
+ // Not supported on Radio 1.0.
+ mRILUnderTest.supplySimDepersonalization(persoType, controlKey, obtainMessage());
+ verify(mRadioProxy, never()).supplySimDepersonalization(anyInt(), anyInt(), eq(controlKey));
+ verify(mRadioProxy, never()).supplyNetworkDepersonalization(
+ anyInt(), eq(controlKey));
+
+ // Make radio version 1.5 to support the operation.
+ try {
+ replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV15);
+ } catch (Exception e) {
+ }
+
+ mRILUnderTest.supplySimDepersonalization(persoType, controlKey, obtainMessage());
+ verify(mRadioProxy).supplySimDepersonalization(
+ mSerialNumberCaptor.capture(),
+ eq((int) invokeMethod(
+ mRILInstance,
+ "convertPersoTypeToHalPersoType",
+ new Class<?>[] {PersoSubState.class},
+ new Object[] {persoType})),
+ eq(controlKey));
+ verifyRILResponse(
+ mRILUnderTest,
+ mSerialNumberCaptor.getValue(),
+ RIL_REQUEST_ENTER_SIM_DEPERSONALIZATION);
+ }
+
+ @FlakyTest
+ @Test
+ public void testSupplySimDepersonalizationWithNetworkLock() throws Exception {
+
+ String controlKey = "1234";
+ PersoSubState persoType = PersoSubState.PERSOSUBSTATE_SIM_NETWORK;
+
+ // use supplyNetworkDepersonalization on Radio 1.0.
+ mRILUnderTest.supplySimDepersonalization(persoType, controlKey, obtainMessage());
+ verify(mRadioProxy, never()).supplySimDepersonalization(anyInt(), anyInt(), eq(controlKey));
+ verify(mRadioProxy).supplyNetworkDepersonalization(
+ mSerialNumberCaptor.capture(), eq(controlKey));
+ verifyRILResponse(
+ mRILUnderTest,
+ mSerialNumberCaptor.getValue(),
+ RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION);
+
+ // Make radio version 1.5 to support the operation.
+ try {
+ replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV15);
+ } catch (Exception e) {
+ }
+
+ mRILUnderTest.supplySimDepersonalization(persoType, controlKey, obtainMessage());
+ verify(mRadioProxy).supplySimDepersonalization(
+ mSerialNumberCaptor.capture(),
+ eq((int) invokeMethod(
+ mRILInstance,
+ "convertPersoTypeToHalPersoType",
+ new Class<?>[] {PersoSubState.class},
+ new Object[] {persoType})),
+ eq(controlKey));
+ verifyRILResponse(
+ mRILUnderTest,
+ mSerialNumberCaptor.getValue(),
+ RIL_REQUEST_ENTER_SIM_DEPERSONALIZATION);
+ }
+
+ @FlakyTest
+ @Test
public void testGetCurrentCalls() throws Exception {
mRILUnderTest.getCurrentCalls(obtainMessage());
verify(mRadioProxy).getCurrentCalls(mSerialNumberCaptor.capture());