Reduce unused initialization for ActivityManager tests
- Only initialize the necessary members of AMS for testing.
- Use the thread which created by test so it can be shutdown.
Originally the uncontrolled threads may have some delayed
message that executes in arbitrary time and causes unexpected
errors.
Except fixing the thread leakage, the testing time of below
command (currently the amount is 146) is reduced from 13s to 6s.
Bug: 117913959
Test: atest -b FrameworksServicesTests
adb shell am instrument -e package com.android.server.am \
-e annotation android.platform.test.annotations.Presubmit \
-e notAnnotation androidx.test.filters.FlakyTest \
-w -r com.android.frameworks.servicestests/androidx.test.runner.AndroidJUnitRunner
Change-Id: Ib6db36af58fc299ff558744d33a21f4aed317a37
5 files changed