From 0d53dda2d7273f0c0e76b286b6ee34962540d06a Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 16 Feb 2024 12:46:35 +0000 Subject: Update unit test of DomainSelectionController Bug: 319995092 Test: atest DomainSelectionControllerTest Change-Id: Ide8248ae5e90c4e6bd6e4d5c8f7a9778e9fa5769 --- .../telephony/domainselection/DomainSelectionController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/java/com/android/internal/telephony/domainselection/DomainSelectionController.java b/src/java/com/android/internal/telephony/domainselection/DomainSelectionController.java index 6d64a31223..ee8517da19 100644 --- a/src/java/com/android/internal/telephony/domainselection/DomainSelectionController.java +++ b/src/java/com/android/internal/telephony/domainselection/DomainSelectionController.java @@ -101,6 +101,7 @@ public class DomainSelectionController { private ExponentialBackoff mBackoff; private boolean mBackoffStarted = false; + private boolean mUnbind = false; // Retry the bind to the DomainSelectionService that has died after mBindRetry timeout. private Runnable mRestartBindingRunnable = new Runnable() { @@ -470,12 +471,14 @@ public class DomainSelectionController { */ public boolean bind(@NonNull ComponentName componentName) { mComponentName = componentName; + mUnbind = false; return bind(); } private boolean bind() { logd("bind isBindingOrBound=" + mIsBound); synchronized (mLock) { + if (mUnbind) return false; if (!mIsBound) { mIsBound = true; Intent serviceIntent = new Intent(DomainSelectionService.SERVICE_INTERFACE) @@ -512,6 +515,7 @@ public class DomainSelectionController { */ public void unbind() { synchronized (mLock) { + mUnbind = true; stopBackoffTimer(); mIsBound = false; setServiceController(null); @@ -548,7 +552,8 @@ public class DomainSelectionController { } private void notifyBindFailure() { - logi("notifyBindFailure " + mBackoffStarted); + logi("notifyBindFailure started=" + mBackoffStarted + ", unbind=" + mUnbind); + if (mUnbind) return; if (mBackoffStarted) { mBackoff.notifyFailed(); } else { -- cgit v1.2.3