Prepare and debug android smartphones with 'USB Rubber Ducky'

Hello, and thank you for this forum or I hope to find answers, Do you think it is possible to program a sequence that once the 'USB Rubber Ducky' inserted in the phone could simulate the actions to be done on the screen to initialize the phone as if I had just bought it and go into the settings to change some don the debug mode? Thank you.