In Android 12, it is required to specify the mutability of the PendingIntent. In the signing screen the HintRequest class is used and PendingIntent is returned by the getHintPickerIntent method. The code is as follows,
HintRequest hintRequest = new HintRequest.Builder().setPhoneNumberIdentifierSupported(true).build();
PendingIntent intent = Credentials.getClient(activity).getHintPickerIntent(hintRequest);//crashes here on android 12
The error in logcat is this,
java.lang.IllegalArgumentException: 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.
My question is how to set the mutability flag in the pending intent once it is created.