Fix GpsLocationProvider.enable/disable/isEnabled
Fix the issue where GpsLocationProvider.isEnabled() returns true when it is really false (and the other way around), when the handler hasn't processed the enable/disable messages yet. This can be systematically reproduced when the caller code is using the same thread as the thread of the handler in GpsLocationProvider. For example, this was happening in LocationManagerService.switchUser(). It would start by disabling all the providers (with updateProviderListenersLocked()), then re-enable them in updateProvidersLocked() only when isEnalbed()==false, which was in the wrong state since the GpsLocationProvider.ENABLE message hadn't been processed yet. As a result, the GpsLocationProvider was disabled upon startup of the phone. This is a slight problem for the enable() contract, which specifies that getStatus() must be handled, getStatus() will be handled but might have slighty not-up-to-date info in this case. Bug: 8028017 Change-Id: Iff91a11cc150e9029a6db85b64a10a926e12b0ba
Loading
Please register or sign in to comment