Linux: How can you factory reset the handset when it is locked?
On most Android devices, you power it off, then power it on again while holding down a couple of buttons. That gets you to a recovery menu and from there an option to do a factory reset is usually available. The exact procedure varies from phone to phone, but an Internet search will find it for you.