summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-01-06 16:20:56 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-01-06 16:20:56 +0000
commit24211982a5940e30f0423d4e1f9e1c017b31b6a2 (patch)
treefa78777c3c92e6ff88e93e48535f8744faf6a18b
parentd8da396aef56045885a4753d086b2b7f6ee56d4d (diff)
parent1ea28919c891e91d1aba0e41c84b1fd95ed9da89 (diff)
downloadcts-24211982a5940e30f0423d4e1f9e1c017b31b6a2.tar.gz
Merge "Remove dialer holder after test for device whithout a default dialer." into android12-tests-dev
-rw-r--r--tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java11
-rw-r--r--tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java11
2 files changed, 13 insertions, 9 deletions
diff --git a/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java b/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java
index 0b77a960cbb..8459c5cc52b 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java
@@ -17,7 +17,6 @@
package android.telecom.cts;
import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
-import static android.telecom.cts.TestUtils.executeShellCommand;
import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
@@ -30,11 +29,9 @@ import android.app.role.RoleManager;
import android.content.Context;
import android.os.Process;
import android.os.UserHandle;
-import android.telecom.TelecomManager;
import android.util.Log;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
@@ -70,6 +67,14 @@ public class CtsRoleManagerAdapter {
}
}
+ public void removeDialerRoleHolder(String packageName) throws Exception {
+ if (mRoleManager != null) {
+ removeRoleHolder(RoleManager.ROLE_DIALER, packageName);
+ } else {
+ fail("Expected role manager");
+ }
+ }
+
public List<String> getRoleHolder(String roleName) {
List<String> holders = new ArrayList<>();
runWithShellPermissionIdentity(() -> {
diff --git a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java
index 2fd462695f2..4cf900f788a 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java
@@ -19,22 +19,17 @@ package android.telecom.cts;
import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
import android.Manifest;
-import android.app.UiModeManager;
import android.app.role.RoleManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
-import android.os.RemoteException;
-import android.telecom.TelecomManager;
import android.telecom.cts.thirdptydialer.CtsThirdPtyDialerInCallServiceControl;
-import android.telecom.cts.thirdptyincallservice.CtsThirdPartyInCallService;
import android.telecom.cts.thirdptyincallservice.CtsThirdPartyInCallServiceControl;
import android.telecom.cts.thirdptyincallservice.ICtsThirdPartyInCallServiceControl;
import android.util.Log;
-import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -71,7 +66,11 @@ public class ThirdPartyInCallServiceTest extends BaseTelecomTestWithMockServices
public void tearDown() throws Exception {
if (mIsDialerRoleAvailable) {
mICtsThirdPartyInCallServiceControl.resetCalls();
- mCtsRoleManagerAdapter.setDialerRoleHolder(mPreviousRoleHolder);
+ if (mPreviousRoleHolder == null) {
+ mCtsRoleManagerAdapter.removeDialerRoleHolder(mThirdPartyPackageName);
+ } else {
+ mCtsRoleManagerAdapter.setDialerRoleHolder(mPreviousRoleHolder);
+ }
}
super.tearDown();
}