What the ...?

Anyone knows what caused this or how to fix it? It randomly happens anywhere on the display. If something overlays it it's not visible, i.e. if I drag the notification area down it covers that strange blue line, but it's still there when I go back to the app. Already tried restarting the phone, resetting it factory settings and updating Android. Nothing helped so far.