summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Behnam Heydarshahi <bhnm@google.com> 2023-04-13 19:02:41 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-04-13 19:02:41 +0000
commit4939d78cdf04ce8d850c0c6b592e9536b10ab0bf (patch)
treeb55bfa30ff2505b3090761a84a2b0793270d5b31
parent13bb0623b571422688b38e2e91138a331325863e (diff)
parent121f510556e5b780e8895c8ed2681e814b89cc87 (diff)
Merge "Fix volume CSD tests not cleanring up" into udc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java8
2 files changed, 15 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 3c007f99a654..aa26e688c490 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -2343,6 +2343,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
}
}
+ @VisibleForTesting
+ void clearInternalHandleAfterTest() {
+ if (mHandler != null) {
+ mHandler.removeCallbacksAndMessages(null);
+ }
+ }
+
private final class CustomDialog extends Dialog implements DialogInterface {
public CustomDialog(Context context) {
super(context, R.style.volume_dialog_theme);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
index eb2688894cb0..e33bfd7d601e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
@@ -58,6 +58,7 @@ import com.android.systemui.util.DeviceConfigProxyFake;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -370,6 +371,13 @@ public class VolumeDialogImplTest extends SysuiTestCase {
verify(mCsdWarningDialog).show();
}
+ @After
+ public void teardown() {
+ if (mDialog != null) {
+ mDialog.clearInternalHandleAfterTest();
+ }
+ }
+
/*
@Test
public void testContentDescriptions() {