Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when the client app is using the WAKE_LOCK permission #1077

Open
Oleur opened this issue Jul 13, 2023 · 2 comments
Open

Crash when the client app is using the WAKE_LOCK permission #1077

Oleur opened this issue Jul 13, 2023 · 2 comments

Comments

@Oleur
Copy link

Oleur commented Jul 13, 2023

✍️ Describe the bug

Chucker 4.0.0 is overriding the WAKE_LOCK permission on the app side.

💣 Steps to reproduce

  1. Add Chucker to your app that uses WAKE_LOCK permission
  2. If your app using the PowerManager wakelock at some and is API 25 or above -> crash
  3. See error

java.lang.SecurityException: Neither user 10349 nor current process has android.permission.WAKE_LOCK.

🔧 Expected behavior

No crash.

📄 Additional context

This crash might be avoided by overriding the permission in the manifest:
<uses-permission android:name="android.permission.WAKE_LOCK" tools:node="replace"/>

What was the reasons to add a maxSDK requirement to the permission definition?

<uses-permission
        android:name="android.permission.WAKE_LOCK"
        android:maxSdkVersion="25" />
@cortinico
Copy link
Member

What was the reasons to add a maxSDK requirement to the permission definition?

I've looked through the history, and apparently we had to add for pre-Oreo device usign JobIntentService. We should probably migrate to WorkManager at this point and the WAKE_LOCK permission is probably not needed anymore

@Hinaka
Copy link

Hinaka commented Aug 14, 2023

FYI, in apps that utilize Chucker and WorkManager, it's possible for a worker to fail when wake lock permission is not granted. Work around is like above post, overriding the permission in the manifest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants