launchdarkly / android-client-sdk

LaunchDarkly Client-side SDK for Android
Other
45 stars 23 forks source link

Targeting S+ (version 10000 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. #133

Closed Garguy closed 3 years ago

Garguy commented 3 years ago

Is this a support request? This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug Updating project to support Android S(31) and I receiving the error with this OS update for PendingIntenets. I am currently running 3.0 of LaunchDarkly on Android 30 and works fine. When I try to update my project to Android S(31) I believe there is a PendingIntent that LaunchDarkly needs to update to include the flags either immutable or mutable by the new Google requirements for Android S(31)

The error within my project points to line that has the code returning the LaunchDarkly instance LDClient.init(application, ldConfig, ldUser, 5).apply

To reproduce Load a project with LaunchDarkly 3.0 and run it on a physical or emulator running Android S(31).

Expected behavior LaunchDarkly handles this new security called out by Google for Android S and my project will not crash when trying to initialize LaunchDarkly.

Logs Caused by: java.lang.IllegalArgumentException: com.chrobinson.navispherecarrier.dev: 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:375) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645) at android.app.PendingIntent.getBroadcast(PendingIntent.java:632) at com.launchdarkly.sdk.android.PollingUpdater.getPendingIntent(PollingUpdater.java:61) at com.launchdarkly.sdk.android.PollingUpdater.stop(PollingUpdater.java:50) at com.launchdarkly.sdk.android.ConnectivityManager.stopPolling(ConnectivityManager.java:168) at com.launchdarkly.sdk.android.ConnectivityManager.attemptTransition(ConnectivityManager.java:247) at com.launchdarkly.sdk.android.ConnectivityManager.lambda$new$0$ConnectivityManager(ConnectivityManager.java:60) at com.launchdarkly.sdk.android.-$$Lambda$ConnectivityManager$nWWvGCieHvstn5YcNkEA7rFcAHs.run(Unknown Source:2) at com.launchdarkly.sdk.android.Throttler.attemptRun(Throttler.java:44) at com.launchdarkly.sdk.android.ConnectivityManager.startUp(ConnectivityManager.java:297) at com.launchdarkly.sdk.android.LDClient.init(LDClient.java:151) at com.launchdarkly.sdk.android.LDClient.init(LDClient.java:194) at com.chrobinson.navispherecarrier.di.internal.module.UserModule.providesLdClient$app_developmentDebug(UserModule.kt:675)

SDK version 3.0.0

Language version, developer tools Android Studio 4.2.2 Gradle 4.2.2

OS/platform Android S(31) MacOS 11.4

Additional context Add any other context about the problem here.

gwhelanLD commented 3 years ago

Hi @Garguy,

Thanks for reporting this issue. I've made the change on our private mirror to correctly flag these Intents such that Android S allows them. We'll release a patch for this fix soon.

Thanks, @gwhelanLD

Garguy commented 3 years ago

@gwhelanLD I do see LaunchDarkly 3.0.1 is out and will update to that as the notes state your manifest receivers were updated. So will let ya know in a couple days.

Garguy commented 3 years ago

Updating to 3.0.1 allowed me to clear the PendingIntent issue with Android 12. Thank you.