google / google/ExoPlayer

Fatal Exception Neither user nor current process has android.permission.WAKE_LOCK

Open
#9,883 8 comments 0 reactions 1 assignee Claimed by @marcbaechinger View on GitHub
needs triage question
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Hello, I am experiencing an odd error with Exoplayer and specifically Galaxy S20 and S21 devices running Android 12.

I have been getting crashlytics reports that the user / process don't have wake lock permissions:

![Screen Shot 2022-01-21 at 9 10 24 AM](https://user-images.githubusercontent.com/3911458/150541743-c7f163fa-8702-4056-b9f3-8616a22190eb.png)

I have `WAKE_LOCK` in my permissions:

```xml





```

And I am using `setWakeMode` to handle the locks and am not handling them myself:

```kotlin
private fun initPlayer() {
mCurrentPlayer = mContext?.let { ExoPlayer.Builder(it).build() }
mCurrentPlayer?.playWhenReady = true
mCurrentPlayer?.repeatMode = Player.REPEAT_MODE_ALL
val mediaSource = createMediaSource()
if (mediaSource != null) {
mCurrentPlayer?.setMediaSource(mediaSource)
mCurrentPlayer?.addListener(playerListener)
mCurrentPlayer?.setWakeMode(C.WAKE_MODE_NETWORK)
mCurrentPlayer?.volume = sound.volume.toFloat()
mCurrentPlayer?.prepare()
}
}
```

In my specific use cases, there might be multiple instances of players set up in the same manner as the previous example, all running at the same time. The Service is a `MediaBrowserService` and the app is used to play sounds in the background for long periods of time.

I have not experienced this issue personally, and cannot reproduce it on my Pixel 5a running 12, and was curious if anyone had seen this or might know if I'm doing something wrong.

Devices Affected:
- Samsung S21 5G - Android 12
- Samsung S20 Ultra - Android 12

Exoplayer Version: **2.16.1**
App's Target API: **30**

Thank you!

EDIT:

additional part of trace:

```
Caused by android.os.RemoteException
Remote stack trace: at android.app.ContextImpl.enforce(ContextImpl.java:2273) at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2301) at com.android.server.power.PowerManagerService$BinderService.acquireWakeLock(PowerManagerService.java:8202) at android.os.IPowerManager$Stub.onTransact(IPowerManager.java:588) at android.os.Binder.execTransactInternal(Binder.java:1215)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.