No clue why it happens. It's happened on rooted, unrooted phones and most people say their phone will freeze, they pull the battery and boot back up and find that they are in test mode. Test mode is also achieved when downgrading or upgrading and you unplug your phone during the process from which you have to use "phonebook recovery" to get the phone back up. This throws it into test mode automatically. So I think its a security thing of some sorts but that's only a guess. I have no clue. I know it sucks. lol