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

Exoplayer WorkManager Extension is not compatible with Android 12 #9181

Closed
seventhmoon opened this issue Jul 12, 2021 · 6 comments
Closed

Exoplayer WorkManager Extension is not compatible with Android 12 #9181

seventhmoon opened this issue Jul 12, 2021 · 6 comments
Assignees

Comments

@seventhmoon
Copy link

seventhmoon commented Jul 12, 2021

There is a behavior change in Android 12 which requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent if the app is targeting Android 12.
Current stable version (2.5.0) of WorkManager don’t have these flags, and so it affects all apps directly, or indirectly using WorkManager.

Apps will throw the following exception in runtime

Fatal Exception: java.lang.IllegalArgumentException: com.sample.packagename: Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:386) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:657) at android.app.PendingIntent.getBroadcast(PendingIntent.java:644) at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:174) at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108) at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86) at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920)

Developer could manually adding the a compatible version of WorkManager (e.g. 2.7.0-alpha04) in their build.gradle file as workaround

implementation 'com.google.android.exoplayer:extension-workmanager:2.X.X'
// For apps targeting Android 12, add the following
constraints {
    implementation 'androidx.work:work-runtime:2.7.0-alpha04'
}

Issue is on current version of ExoPlayer WorkManager Extension (2.14.1)

@ojw28
Copy link
Contributor

ojw28 commented Jul 13, 2021

We will also update ExoPlayer to use 2.7.0 once it's stable.

@clhols
Copy link

clhols commented Jul 30, 2021

Also an issue with the cast extension:

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
        at com.google.android.gms.cast.framework.media.internal.zzm.zza(com.google.android.gms:play-services-cast-framework@@19.0.0:46)
        at com.google.android.gms.cast.framework.CastSession$zza.onResult(com.google.android.gms:play-services-cast-framework@@19.0.0:11)

@clhols
Copy link

clhols commented Jul 30, 2021

Forcing play-services-cast-framework:20.0.0 doesn't fix it:

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
        at com.google.android.gms.internal.cast.zzch.zzb(com.google.android.gms:play-services-cast@@20.0.0:1)

@seventhmoon
Copy link
Author

@clhols this is not related to this bug (Exoplayer WorkManager Extension).
Have you submit the issue to issuetracker?

@seventhmoon
Copy link
Author

WorkManager 2.7.0-beta01is released.

https://developer.android.com/jetpack/androidx/releases/work#2.7.0-beta01

@ojw28
Copy link
Contributor

ojw28 commented Oct 13, 2021

It should now be straightforward for applications to work around this problem by adding an explicit dependency on implementation 'androidx.work:work-runtime:2.7.0' in the application build.gradle. We will also be updating ExoPlayer's WorkManager extension to depend on this WorkManager release.

ojw28 added a commit that referenced this issue Oct 14, 2021
Issue #9181
#minor-release

PiperOrigin-RevId: 403049218
@ojw28 ojw28 closed this as completed Oct 14, 2021
@google google locked and limited conversation to collaborators Dec 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants