This behavior is problematic on B2G because that service is not available there.
Created attachment 8547444 [details] [review] Replace getService() with checkService(). getService() could wait up to 5 seconds when service is not available ; OTOH, checkService() returns immediately. Other approaches to address this problem: a. implement a dummy service. I wouldn't recommend this because it adds some run-time overheads, or b. implement a service that really works, if we want to monitor audio/video power usage.  https://android.googlesource.com/platform/frameworks/native/+/master/libs/binder/IServiceManager.cpp#137
Comment on attachment 8547444 [details] [review] Replace getService() with checkService(). Looks good.