[RESTRICT AUTOMERGE] Close the logical channel after opening it

The test case android.telephony4.cts.SimReswstrictedApisTest#testIccOpenLogicalChannel
is supposed to fail so that no logical channel will be opened. However, if under any
circumstances this test doesn't fail, we need to make sure the opened logical channel
is closed.

Bug: 123239506
Test: run cts --module CtsTelephonyTestCases
Merged-in: I5f7365ea8f01840e3d860e1596bd4a7efea06f7d
Change-Id: I5f7365ea8f01840e3d860e1596bd4a7efea06f7d
(cherry picked from commit 2f9e518778d4f8ca7bba74f368a8433a3fb45126)
diff --git a/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java b/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
index b15a4e8..dad1bc6 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
@@ -89,7 +89,8 @@
     public void testIccOpenLogicalChannel() {
         try {
             if (isSimCardPresent()) {
-                TelephonyManager.getDefault().iccOpenLogicalChannel("");
+                TelephonyManager.getDefault().iccCloseLogicalChannel(
+                        TelephonyManager.getDefault().iccOpenLogicalChannel("").getChannel());
                 fail("Expected SecurityException. App doesn't have carrier privileges.");
             }
         } catch (SecurityException expected) {