Update documentation for pending intent
Bug: 288933871
Test: N/A - documentation only
Change-Id: I10e3f360f248e802ac41022b42c4c96ed7ed8fc3
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt
index 7fa6e48..c314e36 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt
@@ -57,8 +57,10 @@
*
* @param title the title of the entry
* @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * authentication entry on the UI, must be created with flag [PendingIntent.FLAG_MUTABLE] so
- * that the system can add the complete request to the extras of the associated intent
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
* @param subtitle the optional subtitle that is displayed on the entry
*
* @see android.service.credentials.BeginGetCredentialResponse for usage.
@@ -80,8 +82,11 @@
* A builder for [Action]
*
* @param title the title of this action entry
- * @param pendingIntent the [PendingIntent] that will be fired when the user selects
- * this action entry
+ * @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
*/
class Builder constructor(
private val title: CharSequence,
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/AuthenticationAction.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/AuthenticationAction.kt
index beb3038..857735d 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/AuthenticationAction.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/AuthenticationAction.kt
@@ -51,8 +51,10 @@
*
* @param title the title to be shown with this entry on the account selector UI
* @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * authentication entry on the UI, must be created with flag [PendingIntent.FLAG_MUTABLE] so
- * that the system can add the complete request to the extras of the associated intent
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
*
* @see android.service.credentials.BeginGetCredentialResponse
* for more usage details.
@@ -72,8 +74,11 @@
* A builder for [AuthenticationAction]
*
* @param title the title to be displayed with this authentication action entry
- * @param pendingIntent the [PendingIntent] that will be fired when the user selects
- * this entry
+ * @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
*/
class Builder constructor(
private val title: CharSequence,
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/CreateEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/CreateEntry.kt
index 0b4ff95..0092b36 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/CreateEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/CreateEntry.kt
@@ -60,8 +60,10 @@
*
* @param accountName the name of the account where the credential will be saved
* @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * entry, must be created with flag [PendingIntent.FLAG_MUTABLE] to allow the Android
- * system to attach the final request
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
* @param description the localized description shown on UI about where the credential is stored
* @param icon the icon to be displayed with this entry on the UI, must be created using
* [Icon.createWithResource] when possible, and especially not with [Icon.createWithBitmap] as
@@ -146,8 +148,11 @@
* @constructor constructs an instance of [CreateEntry.Builder]
*
* @param accountName the name of the account where the credential will be registered
- * @param pendingIntent the [PendingIntent] that will be fired when the user selects
- * this entry
+ * @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
*/
class Builder constructor(
private val accountName: CharSequence,
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt
index 7700bdb0..cba7592 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt
@@ -54,9 +54,11 @@
* [Icon.createWithResource] when possible, and especially not with [Icon.createWithBitmap] as
* the latter consumes more memory and may cause undefined behavior due to memory implications
* on internal transactions; defaulted to a fallback password credential icon if not provided
- * @property pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * entry, must be created with flag [PendingIntent.FLAG_MUTABLE] to allow the Android
- * system to attach the final request
+ * @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
* @property isAutoSelectAllowed whether this entry is allowed to be auto
* selected if it is the only one on the UI. Note that setting this value
* to true does not guarantee this behavior. The developer must also set this
@@ -364,8 +366,10 @@
* @param context the context of the calling app, required to retrieve fallback resources
* @param username the username of the account holding the password credential
* @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * entry, must be created with flag [PendingIntent.FLAG_MUTABLE] to allow the Android
- * system to attach the final request
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
* @param beginGetPasswordOption the option from the original [BeginGetCredentialResponse],
* for which this credential entry is being added
*
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/PublicKeyCredentialEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/PublicKeyCredentialEntry.kt
index 7f6f45e..b788acc 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/PublicKeyCredentialEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/PublicKeyCredentialEntry.kt
@@ -54,9 +54,11 @@
* [Icon.createWithResource] when possible, and especially not with [Icon.createWithBitmap] as
* the latter consumes more memory and may cause undefined behavior due to memory implications
* on internal transactions; defaulted to a fallback public key credential icon if not provided
- * @property pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * authentication entry on the UI, must be created with flag [PendingIntent.FLAG_MUTABLE] so
- * that the system can add the complete request to the extras of the associated intent
+ * @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
* @property isAutoSelectAllowed whether this entry is allowed to be auto
* selected if it is the only one on the UI. Note that setting this value
* to true does not guarantee this behavior. The developer must also set this
@@ -92,8 +94,10 @@
* @param context the context of the calling app, required to retrieve fallback resources
* @param username the username of the account holding the public key credential
* @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * entry, must be created with flag [PendingIntent.FLAG_MUTABLE] to allow the Android
- * system to attach the final request
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
* @param beginGetPublicKeyCredentialOption the option from the original
* [BeginGetCredentialResponse], for which this credential entry is being added
* @param displayName the displayName of the account holding the public key credential
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt
index 84dac25..02a7ea0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt
@@ -55,8 +55,10 @@
* A builder for [RemoteEntry]
*
* @param pendingIntent the [PendingIntent] that will get invoked when the user selects this
- * entry, must be created with flag [PendingIntent.FLAG_MUTABLE] to allow the Android
- * system to attach the final request
+ * entry, must be created with a unique request code per entry,
+ * with flag [PendingIntent.FLAG_MUTABLE] to allow the Android system to attach the
+ * final request, and NOT with flag [PendingIntent.FLAG_ONE_SHOT] as it can be invoked multiple
+ * times
*/
class Builder constructor(
private val pendingIntent: PendingIntent