From a853b23c0ed09fa492d71f3ef3bcead0a243d832 Mon Sep 17 00:00:00 2001 From: Hall Liu Date: Wed, 13 May 2020 18:34:11 -0700 Subject: [PATCH] Add method to remove test from tracked loopers Add method to remove a test from the sLoopers map, since keeping them around forever results in a memory leak for large test suites. Bug: 156287358 Test: atest FrameworksTelephonyTests Change-Id: I553ea3a1dac3ff4107e0c7caabee26d21f4c52f8 --- tests/testables/src/android/testing/TestableLooper.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/testables/src/android/testing/TestableLooper.java b/tests/testables/src/android/testing/TestableLooper.java index fe0224a27c805..ebe9b5706bf88 100644 --- a/tests/testables/src/android/testing/TestableLooper.java +++ b/tests/testables/src/android/testing/TestableLooper.java @@ -222,6 +222,10 @@ public class TestableLooper { return sLoopers.get(test); } + public static void remove(Object test) { + sLoopers.remove(test); + } + static class LooperFrameworkMethod extends FrameworkMethod { private HandlerThread mHandlerThread;