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

[Xiaomi MIX 2S] NFC does not show up in settings, seapp_context_lookup: No match for app uid 1027 #58

Closed
notsyncing opened this issue May 27, 2018 · 6 comments

Comments

@notsyncing
Copy link

Hello, I compiled gsi for my mix2s, and found the nfc does not show up in system settings. I searched the log and found it complains a lacking nxp nfc library. Then I compared with stock system image and modified devices/phh/treble/base.mk to add these lines:

PRODUCT_PACKAGES += \
    libnqnfc-nci	\
    com.nxp.nfc.nq	\
    com.gsma.services.nfc	\
    libnqnfc_nci_jni	\
    com.android.nfc_extras 

Then logcat shows:

05-27 17:01:05.643  1313  1345 D AutofillUI: destroySaveUiUiThread(): already destroyed
05-27 17:01:05.656   932  1892 I LocSvc_ApiV02: <--- globalEventCb line 115 QMI_LOC_EVENT_NMEA_IND_V02
05-27 17:01:05.656   932  1892 I LocSvc_ApiV02: <--- globalEventCb line 115 QMI_LOC_EVENT_NMEA_IND_V02
05-27 17:01:05.656   932  1892 I LocSvc_ApiV02: <--- globalEventCb line 115 QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02
05-27 17:01:05.657   932  1892 I LocSvc_ApiV02: <--- globalEventCb line 115 QMI_LOC_EVENT_POSITION_REPORT_IND_V02
05-27 17:01:05.657   932  1892 I LocSvc_ApiV02: <--- globalEventCb line 115 QMI_LOC_EVENT_NMEA_IND_V02
05-27 17:01:05.657   932  1892 I chatty  : uid=1021(gps) Loc_hal identical 2 lines
05-27 17:01:05.657   932  1892 I LocSvc_ApiV02: <--- globalEventCb line 115 QMI_LOC_EVENT_NMEA_IND_V02
05-27 17:01:05.665  1313  1343 I ActivityManager: Start proc 2451:com.android.printspooler/u0a74 for service com.android.printspooler/.model.PrintSpoolerService
05-27 17:01:05.669  1313  2425 I BackupManagerService: Found stale backup journal, scheduling
05-27 17:01:05.685  1313  1344 I ActivityManager: Start proc 2466:com.android.nfc/1027 for added application com.android.nfc
05-27 17:01:05.687  2466  2466 E SELinux : seapp_context_lookup:  No match for app with uid 1027, seinfo default, name com.android.nfc
05-27 17:01:05.687  2466  2466 E SELinux : selinux_android_setcontext:  Error setting context for app with uid 1027, seinfo default:targetSdkVersion=26:complete: Success
05-27 17:01:05.688  2466  2466 E Zygote  : selinux_android_setcontext(1027, 0, "default:targetSdkVersion=26:complete", "com.android.nfc") failed
05-27 17:01:05.688  2466  2466 F zygote64: jni_internal.cc:593] JNI FatalError called: frameworks/base/core/jni/com_android_internal_os_Zygote.cpp:652: selinux_android_setcontext failed
05-27 17:01:05.702  1313  1344 I ActivityManager: Start proc 2471:org.lineageos.audiofx/u0a7 for added application org.lineageos.audiofx
05-27 17:01:05.703  1313  1349 I AppWidgetServiceImpl: Async processing of onUserUnlocked u0 took 146 ms
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523] Runtime aborting...
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523] Dumping all threads without appropriate locks held: thread list lock mutator lock
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523] All threads:
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523] DALVIK THREADS (1):
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523] "main" prio=5 tid=1 Runnable
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523]   | group="" sCount=0 dsCount=0 flags=0 obj=0x723225f0 self=0x716b8c2a00
05-27 17:01:05.713  2466  2466 F zygote64: runtime.cc:523]   | sysTid=712 nice=0 cgrp=default sched=0/0 handle=0x71f05c59a8

Could you please tell me how to make selinux happy about the nfc? Or I'm doing something wrong? Thanks very much!

@phhusson
Copy link
Owner

Well, I'd like to start from scratch. There is no reason you'd need those libs, so please provide logs without those. And I'd rather get logs on AOSP if that's possible

On the SELinux issue itself, your problem is that com.android.nfc gets seinfo default, while it should get seinfo platform. If you don't get the proper seinfo, it means your Nfc app isn't properly signed. It should be signed with ROM's platform certificate

@notsyncing
Copy link
Author

The origin log lines:

02-18 19:22:50.855  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.ACCESS_NETWORK_STATE in package: org.mozilla.firefox at: Binary XML file line #21
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.ACCESS_COARSE_LOCATION in package: org.mozilla.firefox at: Binary XML file line #46
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.ACCESS_FINE_LOCATION in package: org.mozilla.firefox at: Binary XML file line #47
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.ACCESS_WIFI_STATE in package: org.mozilla.firefox at: Binary XML file line #48
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.ACCESS_NETWORK_STATE in package: org.mozilla.firefox at: Binary XML file line #49
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.CHANGE_WIFI_STATE in package: org.mozilla.firefox at: Binary XML file line #50
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.WRITE_EXTERNAL_STORAGE in package: org.mozilla.firefox at: Binary XML file line #52
02-18 19:22:50.856  1334  1479 W PackageParser: Ignoring duplicate uses-permissions/uses-permissions-sdk-m: android.permission.INTERNET in package: org.mozilla.firefox at: Binary XML file line #53
02-18 19:22:50.914  1334  1334 I PackageManager: Finished scanning non-system apps. Time: 87 ms, packageCount: 4 , timePerPackage: 21 , cached: 0
02-18 19:22:50.915  1334  1334 E PackageManager: There should probably be exactly one setup wizard; found 0: matches=[]
02-18 19:22:50.916  1334  1334 E PackageManager: updateAllSharedLibrariesLPw failed: Package com.android.nfc requires unavailable shared library com.nxp.nfc.nq; failing!
02-18 19:22:50.921  1334  1334 I PackageManager: Time to scan packages: 1.295 seconds
02-18 19:22:50.922  1334  1334 W PackageManager: Privileged permission android.permission.CHANGE_OVERLAY_PACKAGES for package me.phh.treble.overlaypicker - not in privapp-permissions whitelist
02-18 19:22:50.924  1334  1334 V PackageManager: reconcileAppsData for null u0 0x1 migrateAppData=true
02-18 19:22:50.963  1334  1334 V PackageManager: reconcileAppsData finished 20 packages
02-18 19:22:50.964  1334  1334 V PackageManager: Disabling com.google.android.gsf/com.google.android.gsf.update.SystemUpdateActivity
02-18 19:22:50.964  1334  1334 W PackageManager: Unable to disable com.google.android.gsf/com.google.android.gsf.update.SystemUpdateActivity
02-18 19:22:50.964  1334  1334 V PackageManager: Disabling com.google.android.gsf/com.google.android.gsf.update.SystemUpdateService$Receiver
02-18 19:22:50.964  1334  1334 W PackageManager: Unable to disable com.google.android.gsf/com.google.android.gsf.update.SystemUpdateService$Receiver
02-18 19:22:50.964  1334  1334 V PackageManager: Disabling com.google.android.gsf/com.google.android.gsf.update.SystemUpdateService$SecretCodeReceiver
02-18 19:22:50.964  1334  1334 W PackageManager: Unable to disable com.google.android.gsf/com.google.android.gsf.update.SystemUpdateService$SecretCodeReceiver

Full adb logcat is here:
logcat.txt

@phhusson
Copy link
Owner

Your device has nfc app in /vendor?

@notsyncing
Copy link
Author

notsyncing commented May 28, 2018

All files containing "nfc" in their name in MIUI vendor:

sfc@sfc-Work:/mnt/d/vendor$ find . -iname *nfc*
./app/NQNfcNci
./app/NQNfcNci/NQNfcNci.apk
./bin/hw/vendor.nxp.hardware.nfc@1.0-service
./bin/nqnfcinfo
./etc/init/vendor.nxp.hardware.nfc@1.0-service.rc
./etc/libnfc-brcm.conf
./etc/libnfc-brcm_NCI2_0.conf
./etc/libnfc-nxp.conf
./etc/libnfc-nxp_default.conf
./etc/permissions/android.hardware.nfc.hce.xml
./etc/permissions/android.hardware.nfc.xml
./etc/permissions/com.android.nfc_extras.xml
./lib/hw/android.hardware.nfc@1.0-impl.so
./lib/hw/vendor.nxp.hardware.nfc@1.0-impl.so
./lib/vendor.nxp.hardware.nfc@1.0_vendor.so
./lib64/hw/android.hardware.nfc@1.0-impl.so
./lib64/hw/nfc_nci.nqx.default.so
./lib64/hw/vendor.nxp.hardware.nfc@1.0-impl.so
./lib64/vendor.nxp.hardware.nfc@1.0_vendor.so

Full vendor file list: vendor-list.txt

@notsyncing
Copy link
Author

And in system from MIUI:

sfc@sfc-Work:/mnt/d/system$ find . -iname *nfc*
./etc/nqnfcee_access.xml
./etc/nqnfcse_access.xml
./etc/permissions/com.gsma.services.nfc.xml
./etc/permissions/com.nxp.nfc.nq.xml
./framework/com.android.nfc_extras.jar
./framework/com.gsma.services.nfc.jar
./framework/com.nxp.nfc.nq.jar
./framework/oat/arm/com.android.nfc_extras.odex
./framework/oat/arm/com.android.nfc_extras.vdex
./framework/oat/arm/com.gsma.services.nfc.odex
./framework/oat/arm/com.gsma.services.nfc.vdex
./framework/oat/arm64/com.android.nfc_extras.odex
./framework/oat/arm64/com.android.nfc_extras.vdex
./framework/oat/arm64/com.gsma.services.nfc.odex
./framework/oat/arm64/com.gsma.services.nfc.vdex
./lib/android.hardware.nfc@1.0.so
./lib64/android.hardware.nfc@1.0.so
./lib64/libnqnfc-nci.so
./lib64/libnqnfc_nci_jni.so
./lib64/vendor.nxp.hardware.nfc@1.0.so

@notsyncing
Copy link
Author

Today I flashed your AOSP v19 image and NFC is working. Seems a LineageOS specific problem.

onde2rock pushed a commit to onde2rock/treble_experimentations that referenced this issue Apr 3, 2022
Add initial notch overlay for Xiaomi Mi Play, Redmi Note 7, Mi 9 and Mi 9 Lite(?)
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

No branches or pull requests

2 participants