It is common practice for people to factory reset their phone before sending it in for repairs – this keeps your personal data safe while removing any PIN/biometric locks that could prevent the technician from booting up the phone and testing it to see that the repair has been successful. Google is working on a solution for this in the form of Repair Mode feature.
Google is implementing a native Android solution called Repair Mode, native means it will be backed into the Android code not as a separate app. While Repair Mode is active, the phone will appear to be running a fresh install of the OS with a new user account that has no data. Your actual account and data will remain on the device, but they will be locked away and inaccessible.
According to code that has been committed to the AOSP (Android Open Source Project), the feature is supposed to be enabled using your preferred authentication method. After repairs are done, the same authentication will be used to restore your phone’s data.
Some phone manufacturers already have an in-house repair mode backed into their devices, for example, Samsung has Maintenance mode from last year and Google has scheduled to bring Repair Mode for Pixel as of December this year. Such manufacturers will have the option to disable the native Android Repair Mode.