To reset an Android phone when locked, you need to switch off your phone. Once it's off, press and hold the volume down button and the power button simultaneously. This will lead you to the Android bootloader menu. Here, use the volume down button to scroll down to 'Recovery Mode' and select it using the power button. This will take you to the Android recovery system. Next, use the volume down button to navigate to 'Wipe data/factory reset' and select it with the power button. A warning message will appear, cautioning you that this action will erase all data from your device. If you're sure you want to proceed, select 'Yes'. Once the factory reset is complete, you'll be taken back to the Android recovery system menu. Here, select 'Reboot system now'. Your phone will restart, and voila! You've successfully reset your locked Android phone.