Fix TelephonyManager data enabled settings tests
Test: atest TelephonyManagerTests
Bug: 222327018
Change-Id: I80b73d8aad4f107a81e5adceaab58f4ffaef34f9
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index aa02b4e..55e793c 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -3581,6 +3581,7 @@
(tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_THERMAL,
false));
+ waitForMs(500);
boolean isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
TelephonyManager.DATA_ENABLED_REASON_THERMAL));
@@ -3595,6 +3596,7 @@
(tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_THERMAL,
true));
+ waitForMs(500);
isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
TelephonyManager.DATA_ENABLED_REASON_THERMAL));
@@ -3617,6 +3619,7 @@
(tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_POLICY,
false));
+ waitForMs(500);
boolean isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
TelephonyManager.DATA_ENABLED_REASON_POLICY));
@@ -3631,6 +3634,7 @@
(tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_POLICY,
true));
+ waitForMs(500);
isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
TelephonyManager.DATA_ENABLED_REASON_POLICY));
@@ -3728,6 +3732,7 @@
TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
!allowDataDuringVoiceCall));
+ waitForMs(500);
assertNotEquals(allowDataDuringVoiceCall,
ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, getPolicyHelper));
@@ -3737,6 +3742,7 @@
TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
allowDataDuringVoiceCall));
+ waitForMs(500);
assertEquals(allowDataDuringVoiceCall,
ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, getPolicyHelper));
@@ -3758,6 +3764,7 @@
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED,
!mmsAlwaysAllowed));
+ waitForMs(500);
assertNotEquals(mmsAlwaysAllowed,
ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, getPolicyHelper));
@@ -3767,6 +3774,7 @@
TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED,
mmsAlwaysAllowed));
+ waitForMs(500);
assertEquals(mmsAlwaysAllowed,
ShellIdentityUtils.invokeMethodWithShellPermissions(
mTelephonyManager, getPolicyHelper));