You cannot unlock a phone with magnet. If you have set a screen lock, it may lit the screen, but it will not unlock the device for use. Probably you are using on-body detection?
The screen lock behaviour can be adjusted, but I would prefer to have a option to disable the home/fingerprint button when needed.
I added a screen lock PIN and set the phone to lock immediately (Settings > Security > Screen lock = tap the blue sprocket) - then added a fingerprint for the middle finger, not the thumb, to try avoid accidental unlocking when handling the phone.
I have not found a way to make 100% sure the phone remains locked - when apps for navigation, Sports Tracker and Music are active - while driving on the motorbike and walking with the phone in the pocket.
Sports Tracker has its own additional screen lock mechanism so issues like this must be relatively common with Android phones?
The behaviour of the home/fingerprint button seem to have changed with the 7.1.1 update.
I hope this is still work in progress.