after updating to targetSdkVersion=34, an implicit mutable intent could lead to a crash.

closes https://github.com/PhilippC/keepass2android/issues/2790
This commit is contained in:
Philipp Crocoll
2025-03-11 16:02:51 +01:00
parent 9cd8996aeb
commit d2e0ae6394
3 changed files with 28 additions and 5 deletions

View File

@@ -30,10 +30,9 @@ namespace keepass2android.services.AutofillBase
{
return null;
}
//make sure we have a pendingIntent always not null
pendingIntent ??= PendingIntent.GetService(context, 0, new Intent(),
Util.AddMutabilityFlag(PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Mutable));
// If the pending intent is null, we need to create a dummy one to avoid a crash
pendingIntent ??= PendingIntent.GetActivity(context, 0, new Intent(context, typeof(NullActivity)), PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Immutable);
var slice = CreateInlinePresentationSlice(
inlinePresentationSpec,
text,

View File

@@ -405,7 +405,7 @@ namespace keepass2android.services.AutofillBase
var datasetBuilder = new Dataset.Builder(presentation);
datasetBuilder.SetAuthentication(pendingIntent?.IntentSender);
AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, Resource.Drawable.baseline_close_24, null);
AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, Resource.Drawable.baseline_close_24, pendingIntent);
foreach (var autofillId in autofillIds)
{