Add createForPhoneAccountHandle() and getServicetate()
Respect TelephonyManager's subId when listening to phone state

TelecomManager perfers to use a PhoneAccountHandle to represent a
account but TelephonyManager prefers subscription IDs.

This CL added createForPhoneAccountHandle() in TelephonyManager so
telephony values can be queried from it.

Currently the ServiceState can be retrieved through registering a
PhoneStatelistener, but it is a callback which the handler cannot be
specified.

getServiceState() is added to allow the ServiceState to be polled.

While TelphonyManager has createForSubscriptionId(), listen() does not
respect the subId on the manager created from it, and will always use
the hidden subId on the listener, which is always the default subId
through public API.

After this CL, the default subId on the listener will null.
TelephonyManager use its' own subId if the listener does not set the
subId to something else.

Bug: 32637799
Bug: 32414216
Test: cts-tradefed run cts-dev --module CtsTelephonyTestCases
Change-Id: I9995e4da1573cf1f6b6e4acf2daf7a538fb60d5f
5 files changed