diff options
author | Warren Rehman <wrehman@google.com> | 2015-03-05 15:26:12 +0900 |
---|---|---|
committer | Warren Rehman <wrehman@google.com> | 2015-03-05 17:07:50 +0900 |
commit | ed849b8266824d4c5df15466e5c02e1471192461 (patch) | |
tree | 95bc30c24c381e6b9ac1703266a5c148eb12874f /media/libmediaplayerservice | |
parent | d7e1d08c2ac21cdd2f3b7f83fec7094f6a98fc08 (diff) | |
download | frameworks_av-ed849b8266824d4c5df15466e5c02e1471192461.zip frameworks_av-ed849b8266824d4c5df15466e5c02e1471192461.tar.gz frameworks_av-ed849b8266824d4c5df15466e5c02e1471192461.tar.bz2 |
Defensively check for batterystats service instead of blocking to get it.
bug: 19189826
Change-Id: I656e863eb68edf22812eb380ec6cd4105f4000aa
On branch checkbattstats
Changes to be committed:
modified: MediaPlayerService.cpp
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerService.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 0b18ae0..3e49e33 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -290,8 +290,9 @@ MediaPlayerService::MediaPlayerService() const sp<IServiceManager> sm(defaultServiceManager()); if (sm != NULL) { const String16 name("batterystats"); + // use checkService() to avoid blocking if service is not up yet sp<IBatteryStats> batteryStats = - interface_cast<IBatteryStats>(sm->getService(name)); + interface_cast<IBatteryStats>(sm->checkService(name)); if (batteryStats != NULL) { batteryStats->noteResetVideo(); batteryStats->noteResetAudio(); |