Add Executor Support for PhoneStateListener
Support an Executor so that PhoneStateListener
can invoke callbacks not only on a user's preferred
Looper but also on a preferred Handler or in another
thread management scheme.
PhoneStateListener uses an odd pattern for its API,
so to support the historical use cases of having the
internal callback instance be instantiated during
object construction, the Executor needs to be passed
in to the PhoneStateListener during construction. This
also permits the listen() method in TelephonyManager to
avoid odd situations of having a version with an
Executor be passed in when requesting to stop listening
for events.
Bug: 118350385
Test: atest PhoneStateListenerTest
atest PhoneStateListenerExecutorTest
Change-Id: I8eeb2e156f6d67d192d17586e6aa5579ff6d675d
2 files changed