docs/guides/troubleshooting.md
Realm SDKs use named pipes to support notifications and access to the Realm file from multiple processes. While this is allowed by default for normal user apps, it is disallowed for system apps.
System apps are defined by setting android:sharedUserId="android.uid.system"
in the Android manifest. For system apps, you may see a security violation in
Logcat that looks something like this:
05-24 14:08:08.984 6921 6921 W .realmsystemapp: type=1400 audit(0.0:99): avc: denied { write } for name="realm.testapp.com.realmsystemapp-Bfqpnjj4mUvxWtfMcOXBCA==" dev="vdc" ino=14660 scontext=u:r:system_app:s0 tcontext=u:object_r:apk_data_file:s0 tclass=dir permissive=0
05-24 14:08:08.984 6921 6921 W .realmsystemapp: type=1400 audit(0.0:100): avc: denied { write } for name="realm.testapp.com.realmsystemapp-Bfqpnjj4mUvxWtfMcOXBCA==" dev="vdc" ino=14660 scontext=u:r:system_app:s0 tcontext=u:object_r:apk_data_file:s0 tclass=dir permissive=0
To fix this, you need to adjust the SELinux security rules in the ROM. This can
be done by using the tool audit2allow. This tool ships as part of
AOSP.
adb pull /sys/fs/selinux/policy.input.txt.audit2allow tool: audit2allow -p policy -i input.txt.audit2allow is produced when compiling AOSP/ROM and only runs on
Linux. Check out the details in the Android Source documentation.
Also note that since Android Oreo, Google changed the way it configures
SELinux and the default security policies are now more modularized. More details
are in the Android Source documentation.