Fix #testSetAndCheckSubscriptionEnabled failure.

Bug: 147577228
Test: cts
Change-Id: I7ec4c53c50374f6f671fa844a6d2f88b16ec1c20
Merged-In: I7ec4c53c50374f6f671fa844a6d2f88b16ec1c20
(cherry picked from commit d022bfca065383d14540af8d26e255c7a62ff1b2)
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
index 51c1563..6244fcd 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -68,6 +68,7 @@
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
+
 public class SubscriptionManagerTest {
     private SubscriptionManager mSm;
 
@@ -513,12 +514,12 @@
         if (!isSupported()) return;
         boolean enabled = executeWithShellPermissionAndDefault(false, mSm,
                 (sm) -> sm.isSubscriptionEnabled(mSubId));
-        if (isDSDS()) {
-            // Change it to a different value
-            changeAndVerifySubscriptionEnabledValue(mSubId, !enabled);
-            // Reset it back to original
-            changeAndVerifySubscriptionEnabledValue(mSubId, enabled);
-        }
+        // Enable or disable subscription may require users UX confirmation or may not be supported.
+        // Call APIs to make sure there's no crash.
+        executeWithShellPermissionAndDefault(false, mSm,
+                (sm) -> sm.setSubscriptionEnabled(mSubId, !enabled));
+        executeWithShellPermissionAndDefault(false, mSm,
+                (sm) -> sm.setSubscriptionEnabled(mSubId, enabled));
     }
 
     @Test
@@ -595,18 +596,6 @@
         }
     }
 
-    private void changeAndVerifySubscriptionEnabledValue(int subId, boolean targetValue) {
-        boolean changeSuccessfully = executeWithShellPermissionAndDefault(false, mSm,
-                (sm) -> sm.setSubscriptionEnabled(subId, targetValue));
-        if (!changeSuccessfully) {
-            fail("Cannot change subscription " + subId
-                    + " from " + !targetValue + " to " + targetValue);
-        }
-        boolean res = executeWithShellPermissionAndDefault(targetValue, mSm,
-                (sm) -> sm.isSubscriptionEnabled(subId));
-        assertEquals(targetValue, res);
-    }
-
     private <T, U> T executeWithShellPermissionAndDefault(T defaultValue, U targetObject,
             ShellIdentityUtils.ShellPermissionMethodHelper<T, U> helper) {
         try {