diff options
| author | 2024-12-09 16:49:21 +0000 | |
|---|---|---|
| committer | 2024-12-09 16:49:21 +0000 | |
| commit | 9fc248aa71b51cbcaf20a1ba6b25e0866a4833ba (patch) | |
| tree | 0a0f164b206d164ad99f7fd643b6624cd53b3716 | |
| parent | 23d910b5ce014b2b03e7f020c5de2099e7ce0c91 (diff) | |
| parent | 20b229794ace3f58d5ec791a57e48362da319dd1 (diff) | |
Merge "Fix missing creator token issue due to same intent added twice as extra intent" into main
| -rw-r--r-- | core/java/android/content/Intent.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index a6492d36cf8f..3d75423edfa9 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -12291,7 +12291,6 @@ public class Intent implements Parcelable, Cloneable { private IBinder mCreatorToken; // Stores all extra keys whose values are intents for a top level intent. private ArraySet<NestedIntentKey> mNestedIntentKeys; - } /** @@ -12353,6 +12352,7 @@ public class Intent implements Parcelable, Cloneable { public int hashCode() { return Objects.hash(mType, mKey, mIndex); } + } private @Nullable CreatorTokenInfo mCreatorTokenInfo; @@ -12416,7 +12416,7 @@ public class Intent implements Parcelable, Cloneable { // removeLaunchSecurityProtection() is called before it is launched. value = null; } - if (value instanceof Intent intent && !visited.contains(intent)) { + if (value instanceof Intent intent) { handleNestedIntent(intent, visited, new NestedIntentKey( NestedIntentKey.NESTED_INTENT_KEY_TYPE_EXTRA_PARCEL, key, 0)); } else if (value instanceof Parcelable[] parcelables) { @@ -12439,7 +12439,6 @@ public class Intent implements Parcelable, Cloneable { } private void handleNestedIntent(Intent intent, Set<Intent> visited, NestedIntentKey key) { - visited.add(intent); if (mCreatorTokenInfo == null) { mCreatorTokenInfo = new CreatorTokenInfo(); } @@ -12447,7 +12446,10 @@ public class Intent implements Parcelable, Cloneable { mCreatorTokenInfo.mNestedIntentKeys = new ArraySet<>(); } mCreatorTokenInfo.mNestedIntentKeys.add(key); - intent.collectNestedIntentKeysRecur(visited); + if (!visited.contains(intent)) { + visited.add(intent); + intent.collectNestedIntentKeysRecur(visited); + } } private void handleParcelableArray(Parcelable[] parcelables, String key, Set<Intent> visited) { |