Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Parcel problem on Android 14 #452

Merged
merged 1 commit into from
Dec 27, 2023
Merged

Fix Parcel problem on Android 14 #452

merged 1 commit into from
Dec 27, 2023

Conversation

CLOUDERHEM
Copy link
Contributor

I found a difference between Android versions 13 and 14, which led to the generation of incorrect android.nfc.Tag, potentially resulting in a null tagService, and maybe like #451

Android 14
image

Android 13
image

http://aospxref.com/android-14.0.0_r2/xref/frameworks/base/core/java/android/nfc/Tag.java#441

@ikarus23
Copy link
Owner

Oh, really good catch! Yes, the new cookie system for NFC in Android 14 possibly breaks even more in this app. Turns out I'm using NFC in a wrong way. But they did not document it (at first). Turns out you should do all NFC communication right after the tag is discovered. Discovering the tag, doing other stuff and then talking to the tag is not the intended way. As far as I know, the cookie is there to know how "old" the tag is (how long it has been since discovery).

I will merge this and hope it will make things at least a bit better.

@ikarus23 ikarus23 merged commit 0abf97e into ikarus23:master Dec 27, 2023
1 check passed
@CLOUDERHEM
Copy link
Contributor Author

Oh, really good catch! Yes, the new cookie system for NFC in Android 14 possibly breaks even more in this app. Turns out I'm using NFC in a wrong way. But they did not document it (at first). Turns out you should do all NFC communication right after the tag is discovered. Discovering the tag, doing other stuff and then talking to the tag is not the intended way. As far as I know, the cookie is there to know how "old" the tag is (how long it has been since discovery).

I will merge this and hope it will make things at least a bit better.

Hi, there is still a problem: the part of Android 14's source code related to nfc may be used in some Android 13 devices(some andriod 13 has mCookie). So the app may not run correctly on some special Android 13 devices (e.g., Lineage OS 20, Android 13, XIAOMI MIX2s, I tested).

So, may need to change the method of using Parcel

@ikarus23
Copy link
Owner

Thanks for the hint! That sounds painful. Maybe I can drop the patchTag completely. This function was introduced for broken devices long time ago. Maybe it's time to drop support for those devices...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants