1package com.peachpasswords.autofill23import android.app.PendingIntent4import android.content.Context5import android.content.Intent6import android.content.IntentSender7import android.os.Build891011121314object AutofillIntents {15 const val EXTRA_IDENTITY_ID = "peach.autofill.identityId"16 const val EXTRA_PASSWORD_ID = "peach.autofill.passwordId"17 const val EXTRA_OTP_ID = "peach.autofill.otpId"18 const val EXTRA_ORIGIN = "peach.autofill.origin"1920 private const val REQ_CHIP = 0xC0DE21 private const val REQ_PICKER = 0xBEEF2223 24 fun noopChipIntent(context: Context): PendingIntent {25 val intent = Intent(context, AutofillEntryPickerActivity::class.java)26 return PendingIntent.getActivity(context, REQ_CHIP, intent, immutableFlags())27 }2829 30 fun pickerIntentSender(context: Context, parsed: ParsedStructure): IntentSender {31 val intent = Intent(context, AutofillEntryPickerActivity::class.java).apply {32 putExtra(EXTRA_IDENTITY_ID, parsed.identityId)33 putExtra(EXTRA_PASSWORD_ID, parsed.passwordId)34 putExtra(EXTRA_OTP_ID, parsed.otpId)35 putExtra(EXTRA_ORIGIN, parsed.origin)36 }37 return PendingIntent.getActivity(context, REQ_PICKER, intent, mutableFlags()).intentSender38 }3940 private fun immutableFlags(): Int =41 PendingIntent.FLAG_UPDATE_CURRENT or42 if (Build.VERSION.SDK_INT >= 23) PendingIntent.FLAG_IMMUTABLE else 04344 private fun mutableFlags(): Int =45 PendingIntent.FLAG_UPDATE_CURRENT or46 if (Build.VERSION.SDK_INT >= 31) PendingIntent.FLAG_MUTABLE else 047}