When you are really concentrating on something it would be good if your surroundings (computer, smartphone) would take notice and automatically eliminate distraction until you finish.
Have the built-in camera track your eyes and measure your pupils’ dilation. When it detects a larger dilated pupil for a certain period of time – indicating higher concentration and attentiveness – it should start shutting down distractions like alerts etc.