Add CTS for get/setCallComposerStatus API.
Test: cts
Bug: 173437870
Change-Id: I714c0b9248674597357031af3a3af3c52b0cbdc2
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 d43837f..2cd3bbb 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -2176,6 +2176,45 @@
}
/**
+ * Tests TelephonyManager.setCallComposerStatus and TelephonyManager.getCallComposerStatus.
+ */
+ @Test
+ public void testSetGetCallComposerStatus() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
+
+ boolean hasImsFeature = mPackageManager.hasSystemFeature(
+ PackageManager.FEATURE_TELEPHONY_IMS);
+
+ if (hasImsFeature) {
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCallComposerStatus(TelephonyManager.CALL_COMPOSER_STATUS_OFF));
+ int status = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ tm -> tm.getCallComposerStatus());
+ assertThat(status).isEqualTo(TelephonyManager.CALL_COMPOSER_STATUS_OFF);
+
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCallComposerStatus(TelephonyManager.CALL_COMPOSER_STATUS_ON));
+ status = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ tm -> tm.getCallComposerStatus());
+ assertThat(status).isEqualTo(TelephonyManager.CALL_COMPOSER_STATUS_ON);
+ } else {
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCallComposerStatus(TelephonyManager.CALL_COMPOSER_STATUS_OFF));
+ int status = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ tm -> tm.getCallComposerStatus());
+ assertThat(status).isEqualTo(TelephonyManager.CALL_COMPOSER_STATUS_OFF);
+
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCallComposerStatus(TelephonyManager.CALL_COMPOSER_STATUS_ON));
+ status = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ tm -> tm.getCallComposerStatus());
+ assertThat(status).isEqualTo(TelephonyManager.CALL_COMPOSER_STATUS_OFF);
+ }
+ }
+
+ /**
* Tests {@link TelephonyManager#getSupportedRadioAccessFamily()}
*/
@Test