Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed849b82 authored by Warren Rehman's avatar Warren Rehman
Browse files

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
parent d7e1d08c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();