CVE-2026-59028 AI-generated analysis
platform/packages/apps/Nfc (platform/packages/modules/Nfc, NfcNci, on 16+), card emulation AID routing (RegisteredAidCache)
Changes RegisteredAidCache AID conflict resolution in the wallet-role path so that the default wallet role holder's own services take precedence over associated (shared role priority) services in two places: when several wallet-tier services claim the same AID, and when a wallet-tier prefix AID conflicts with an exact child AID registered by the wallet holder.
Root cause
In RegisteredAidCache.resolveAidLocked, with the wallet role feature enabled, every service collected into defaultWalletServices was sorted only case-insensitively by component short string, and the service at index 0 became the default route. This list holds the wallet holder's own services plus associated services that share the role priority. An associated service with an alphabetically earlier component name could therefore take the AID from the real wallet holder. Separately, in the wallet-role branch of resolveAidConflictLocked, a prefix AID with walletDefaults could conflict with exact child AIDs. The only check that let the child rule govern was conflictingDefaultInfo.foregroundDefault != null. The wallet holder's own exact AID registrations in conflictingDefaultInfo.walletDefaults were not considered, so a wallet-tier prefix registration could shadow the wallet holder's exact AIDs.
How the fix works
- src/com/android/nfc/cardemulation/RegisteredAidCache.java:resolveAidLocked: the comparator for defaultWalletServices now computes o1IsWallet and o2IsWallet by comparing getComponent().getPackageName() with mDefaultWalletHolderPackageName. A wallet-holder service sorts before a non-wallet-holder service (returns -1 or 1). Only when both or neither belong to the wallet holder does it fall back to String.CASE_INSENSITIVE_ORDER on toShortString(). resolveInfo.defaultService = defaultWalletServices.get(0) is unchanged, so the wallet holder's own service is now picked.
- src/com/android/nfc/cardemulation/RegisteredAidCache.java:resolveAidConflictLocked: in the mWalletRoleObserver.isWalletRoleFeatureEnabled() branch with non-empty aidDefaultInfo.walletDefaults, a new loop over conflictingDefaultInfo.walletDefaults sets conflictingHasWallet when a ServiceAidInfo's service package equals mDefaultWalletHolderPackageName and isExact(sai.aid) is true. The condition becomes `foregroundDefault != null || conflictingHasWallet`. When it is true, the function returns EMPTY_RESOLVE_INFO, so the prefix is not routed and the exact child AID rules govern. On 15 and 16 the debug log moves from DBG to VDBG with updated text.
- The Android 17 commit also adds three unit tests in NfcNci/tests/unit/.../RegisteredAidCacheTest.java: an associated prefix AID does not shadow the wallet holder's exact AID; the wallet holder is prioritized over an alphabetically earlier associated service; a wallet child prefix does not shadow the wallet root prefix.
Completeness
- Covers both precedence points in the wallet-role path: the ordering of defaultWalletServices in resolveAidLocked and the prefix-versus-exact-child decision in resolveAidConflictLocked.
- Wallet-holder identity is decided only by package name equality with mDefaultWalletHolderPackageName. User id is not part of the comparison in either new check.
- conflictingHasWallet is set only for exact AIDs (isExact(sai.aid)). A wallet holder's own conflicting prefix or subset child registrations do not trigger the early return. The A17 test walletRolePrefixChildAidDoesNotShadowWalletPrefixRootAid expects the root prefix service to resolve in that case.
- When there are several associated (non-wallet-holder) services, or several wallet-holder services, they are still ordered alphabetically by component name among themselves.
- The non-wallet-role path (mPreferredPaymentService / matchedPayment branches) is not modified. The fix is limited to the wallet role feature.
- The Android 15 commit carries no unit tests. In the material, tests appear only in the Android 17 commit.
Behavior changes
- When the default wallet holder and an associated service both claim the same AID (and no foreground-preferred service applies), the wallet holder's service is now selected regardless of component name ordering.
- When a wallet-tier prefix AID conflicts with an exact child AID registered by the default wallet holder, resolveAidConflictLocked now returns EMPTY_RESOLVE_INFO for the prefix. This is the same outcome as a foreground-default conflict, so the exact AID registration governs routing.
- On 15 (and 16), the conflict log message in this branch moves from DBG to VDBG with new wording.
Per major
- Android 14: not affected per the bulletin; at android-security-14.0.0_r31, 0/8 patched lines are present
- Android 15: same fix: platform/packages/apps/Nfc 95f44eae33eb in android-security-15.0.0_r19 (only src/com/android/nfc/cardemulation/RegisteredAidCache.java, no tests); 7/8 patched lines present
- Android 16: same fix at the module path: platform/packages/modules/Nfc 8b9a830f5400 in android-security-16.0.0_r10 (NfcNci/src/.../RegisteredAidCache.java; the log line moves from DBG to VDBG as on 15); 7/8 patched lines present
- Android 17: same fix plus unit tests: platform/packages/modules/Nfc 7b67caaf60b5 in android-security-17.0.0_r3 (RegisteredAidCache.java and RegisteredAidCacheTest.java; the log line was already VDBG); 7/8 patched lines present
Unknowns
- The material does not show how a sideloaded app becomes an associated/shared-role-priority service. The population of mAssociatedRoleServices and the PROPERTY_ALLOW_SHARED_ROLE_PRIORITY handling are outside the diff.
- The material does not say which of the 8 tracked patched lines is missing in each resolved tag (7/8).
- The material does not show whether the unit tests were applied to the 15 and 16 branches; only the 17 commit includes them.