mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
Use random ints for request codes to ensure no overlap (#3427)
This commit is contained in:
parent
0dc606b470
commit
5677373421
3 changed files with 7 additions and 5 deletions
|
@ -18,7 +18,7 @@ import com.x8bit.bitwarden.data.autofill.model.AutofillSelectionData
|
|||
import com.x8bit.bitwarden.data.autofill.model.AutofillTotpCopyData
|
||||
import com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage
|
||||
import com.x8bit.bitwarden.data.platform.util.getSafeParcelableExtra
|
||||
import java.util.UUID
|
||||
import kotlin.random.Random
|
||||
|
||||
private const val AUTOFILL_SAVE_ITEM_DATA_KEY = "autofill-save-item-data"
|
||||
private const val AUTOFILL_SELECTION_DATA_KEY = "autofill-selection-data"
|
||||
|
@ -67,7 +67,7 @@ fun createTotpCopyIntentSender(
|
|||
return PendingIntent
|
||||
.getActivity(
|
||||
context,
|
||||
UUID.randomUUID().hashCode(),
|
||||
Random.nextInt(),
|
||||
intent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT.toPendingIntentMutabilityFlag(),
|
||||
)
|
||||
|
@ -93,7 +93,7 @@ fun createAutofillSavedItemIntentSender(
|
|||
return PendingIntent
|
||||
.getActivity(
|
||||
autofillAppInfo.context,
|
||||
0,
|
||||
Random.nextInt(),
|
||||
intent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT.toPendingIntentMutabilityFlag(),
|
||||
)
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.x8bit.bitwarden.data.autofill.model.FilledData
|
|||
import com.x8bit.bitwarden.data.autofill.model.FilledItem
|
||||
import com.x8bit.bitwarden.ui.autofill.buildVaultItemAutofillRemoteViews
|
||||
import com.x8bit.bitwarden.ui.autofill.util.createVaultItemInlinePresentationOrNull
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* Returns all the possible [AutofillId]s that were potentially fillable for the given [FilledData].
|
||||
|
@ -43,7 +44,7 @@ fun FilledData.buildVaultItemDataset(
|
|||
val pendingIntent = PendingIntent
|
||||
.getActivity(
|
||||
autofillAppInfo.context,
|
||||
0,
|
||||
Random.nextInt(),
|
||||
intent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT.toPendingIntentMutabilityFlag(),
|
||||
)
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.nfc.NfcAdapter
|
|||
import com.x8bit.bitwarden.AuthCallbackActivity
|
||||
import com.x8bit.bitwarden.data.autofill.util.toPendingIntentMutabilityFlag
|
||||
import com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* The default implementation of the [NfcManager].
|
||||
|
@ -26,7 +27,7 @@ class NfcManagerImpl(
|
|||
activity,
|
||||
PendingIntent.getActivity(
|
||||
activity,
|
||||
1,
|
||||
Random.nextInt(),
|
||||
Intent(activity, AuthCallbackActivity::class.java).addFlags(
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue