If your Android phone/tablet is flashing a red border around screen sometimes, chances are you’re running a custom ROM, most probably an AOSP based ROM like CM11/12/12.1, PA, etc.
Red border doesn’t always flashes around the screen, but sometimes it does. We don’t the technicality about it, but there’s this ro.build.type setting in the build.prop file of your ROM that may be responsible for the red border flashes.
Using a file manager app like ES File Explorer, go to /system/ directory on your device and open/edit the build.prop file from the directory.
Once you’ve the build.prop file opened, look for ro.build.type setting, if its value is set to userdebug than it is the reason. Edit the value and change it to just user to fix the red border issue and save the build.prop file. Don’t forget to reboot your phone afterwards.
TL;DR: Edit build.prop and change the value of “ro.build.type” from “userdebug” to just “user”.