Make getAllCellInfo Asynchronous
Update the getAllCellInfo() call to be asynchronous and support multiple modes. This enables us to add asynchronous API support in TelephonyManager for CellInfo and prepares us to deprecate CellLocation. This also centralizes and homgenizes the behavior of CellInfo, fixing some of the threading problems with these APIs. The new behavior is as follows: -Now whenever the getAllCellInfo() cache is updated in the SST, it will invoke the PhoneStateListener for all listeners of LISTEN_CELL_INFO. -getAllCellInfo() now supports a Message parameter much like many other invocations on the Phone object. -This version is void, so it's unambiguous that this version is asynchronous. -If a Message object is provided, then the updated cell info will be posted as an AsyncResult in the message once the response is received from the radio. -If the message object is null, then the call will still query the modem and update the writethrough cache in SST and trigger the PhoneStateListener. -There is now an overload for getAllCellInfo() to support synchronous calls on the same thread, which will ONLY return the cached value in SST and never calls down to the radio. This avoids calls to the same method having inconsistent behavior based on the calling context. -getCellLocation() has been updated to use the new asynchronous version of getAllCellInfo() to support the legacy behavior that queries CellInfo when the device isn't registered and location is requested. Thus, this method is now also asynchronous, so that it is unambigous when calls *may* be made down to the modem. -There is now a synchronous version of getCellLocation which will return the cached value in SST or attempt to get a cached value from CellInfo stored in SST if there is no valid CellIdentity. Bug: 37100068 Test: atest FrameworksTelephonyTests Change-Id: I52cd652b350733991bae1457ec07ad1414c5d1dd
Loading
Please register or sign in to comment