by Pete Sevander
Changes the do not disturb mode to alarms only when phone is placed display down on a table and back (respects the alarm switch) when picked up.
Also has a small recheck after 1 second when placed display down because the orientation check block is not that fast to recognise that the device was display downwards just a brief moment.
Build on CM13 so I'm not sure if this works on OxygenOS as the file which from the alarm switch state is read might not be the same.
Update: Added ambient light check so the alarm mode is not set when the phone is in pocket.
Added roll to the orientation check block as it didn't work correctly without it.