Fixed file descriptor leak in telephony unit tests
authorJack Yu <jackyu@google.com>
Tue, 23 May 2017 18:00:27 +0000 (11:00 -0700)
committerJack Yu <jackyu@google.com>
Tue, 23 May 2017 21:07:36 +0000 (21:07 +0000)
commitae6e8f99bdb297f906d6dcdc0a385ba27eee47fd
treea80fcdf2563807fe41d22403ab7675193e0b1b47
parent9f78bc2eb2db658d1b22a9be514ffa6f7a916d64
Fixed file descriptor leak in telephony unit tests

The handler thread in SimulatedCommands was not closed after
each unit test run. Fixed by adding a dispose method to quit
the thread.

Also use quit() instead of quitSafely() for all thread quiting
because we don't care if the messages were dispatched or not
after the test. This can fix some messages sending to dead
threads non-harmful exceptions in the output debug messages.

Test: Telephony unit tests
bug: 29579544
Change-Id: I112e46b0147a1950046a35cd9ac2498560c6ee1b
29 files changed:
src/java/com/android/internal/telephony/test/SimulatedCommands.java
tests/telephonytests/src/com/android/internal/telephony/CallManagerTest.java
tests/telephonytests/src/com/android/internal/telephony/DeviceStateMonitorTest.java
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java
tests/telephonytests/src/com/android/internal/telephony/ImsSMSDispatcherTest.java
tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java
tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
tests/telephonytests/src/com/android/internal/telephony/SmsStorageMonitorTest.java
tests/telephonytests/src/com/android/internal/telephony/SubscriptionInfoUpdaterTest.java
tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java
tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaInboundSmsHandlerTest.java
tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcControllerTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java
tests/telephonytests/src/com/android/internal/telephony/dataconnection/TelephonyNetworkFactoryTest.java
tests/telephonytests/src/com/android/internal/telephony/gsm/GsmCellBroadcastHandlerTest.java
tests/telephonytests/src/com/android/internal/telephony/gsm/GsmInboundSmsHandlerTest.java
tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneFactoryTest.java
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
tests/telephonytests/src/com/android/internal/telephony/mocks/ConnectivityServiceMock.java
tests/telephonytests/src/com/android/internal/telephony/uicc/IccPhoneBookInterfaceManagerTest.java
tests/telephonytests/src/com/android/internal/telephony/uicc/UiccCardApplicationTest.java
tests/telephonytests/src/com/android/internal/telephony/uicc/UiccCardTest.java
tests/telephonytests/src/com/android/internal/telephony/uicc/UiccControllerTest.java