Android 12 Behavioral Changes

In this document, we will explain the various Android 12 (API Level 31) behavioral changes that are observed when apps use Android targetSDK version 31 and run on Android 12 devices.

Mutability of Pending Intents

To improve app security in apps running on Android 12 (SDK API level 31), you must specify a mutability flag while creating pending intents in custom libraries or NFIs. Therefore, Google recommends that you set the FLAG_IMMUTABLE flag while creating pending intents. Use the FLAG_MUTABLE flag only when the app contains some functionality that depends on the PendingIntent being mutable.

If the mutability flag is not set in the pending intent, the Native Android Framework displays the following exception message:

"Java.lang.IllegalArgumentException"

Safer Component Exports

In the Android 12 release, Google has introduced a new restriction on exporting components to improve the safety of apps. If an activity, service, or broadcast receiver uses intent filters but does not have the android:exported key declared explicitly, users cannot install the app on devices that run on Android 12 (and later versions).
If you add an activity, service, or broadcast receiver in a Quantum Visualizer app through the Android Pre-compile task, you must explicitly declare the android:exported flag in the androidprecompiletask.xml file.