To entertain everyone with pictures...
These are the screenshots of GPStest and Compass app from Fdroid. One can see GPS lock, not see GPS losing lock in a moment after the screenshots were taken, see the compass sensor not working in the Sky view of GPStest, and see Compass app happilly using the compass sensor. I've tested the compass sensor with a magnet - it follows the field.
The first two GPS screenshots are taken with and then without GNSS API enabled in the settings of GPStest. It took roughly the same time to get lock in both cases. I had to move to the garden to take these measurements, because the GPS receiver is too weak to pick up the signals from inside the house (the other old phones do it just fine...).
Just tested again lineage-14.1-20211013-UNOFFICIAL-n7100, which is the most stable and secure ROM for this phone at the moment (SELinux enforcing, recent patches, although no encryption). Both the compass and GPS work fine there; GPS loses lock every couple of minutes and acquires it straight away (inside the building).
All tests are done without assist data and without gapps.
All together, both GPS and compass are malfunctioning: GPS not sensitive enough and unstable (need to check my device with the stock ROM just in case...), while compass suffering some sort of access problems (a part of its API not working?).
On a positive side, both the GPS and compass sensor are alive in the first alpha of the ROM - there is a hope!
Below is GPStest on the same phone, good old lineage-14.1-20211013-UNOFFICIAL-n7100, inside the building! It's working well. So, it looks like the hardware is not broken in my device...
As I started digging into the treasures of old ROMs, this one came up:
https://forum.xda-developers.com/t/rom-7-1-2-r24-lineageos-for-n7100-unofficial.3487568/
https://web.archive.org/web/2020121...h/n7100/lineage-14.1-20171019-tilak-n7100.zip
GPS in it works better than in the updated LOS-14.1 mentioned above, loses lock less frequently. Compass and camera (with video) also work. More importantly, encryption works! Unfortunately, it doesn't have recent security patches and SELinux is set to permissive... I am writing this to provide references to the solutions which will need to be addressed again in this project.