I recently dropped my phone and obliterated the screen. It wouldn’t turn on properly or sense input, the entire display panel was probably wrecked. It’s a Xiaomi phone, so trying to get it repaired in North America would take a long time, and the damage might have made it infeasible anyways.
The only thing that allowed me to save the data was that the phone was rooted with TWRP installed. This procedure wasn’t too hard to figure out, so it’s handy to know this in case an emergency ever happens. No USB to HDMI adapter or a mouse is needed.
Note that if you’re someone who’s following this as a guide, there’s a minimum level of technical knowledge required. If you’ve never worked on the command line or don’t know what ADB is, this guide won’t make a lot of sense.
Requirements
-
ADB (Android Debug Bridge)
This is how you’ll send commands to the phone without a working screen. Most Linux distros will have this in their repos. On MacOS and Windows, you’ll need to manually install.
-
Root access/unlocked bootloader
I’m unsure if root access is mandatory, but it ensures any deep system operations will succeed. It’s always easier working with a rooted phone. Of course, this means the phone will require an unlocked bootloader.
-
TWRP
Needed for decryption, unless you disabled it when the phone was working. Without decryption, you can’t back up any data.
-
Non-biometric password?
The question mark is there because I’m not sure if this is a hard requirement. The decryption key to the phone is your password. So if your phone password is
1234
, you’ll decrypt it with that. But if you use your fingerprint or face to unlock your phone, I’m not sure how that would translate into a password. There are some methods to remove encryption out there, but I don’t know enough to say anything about them.
Procedure
The steps here will assume a Linux environment. MacOS will work very similarly, and Windows users should use PowerShell as administrator in the directory where ADB is installed.
1. Enter recovery mode
Each phone will slightly differ in method, but it’s a pattern of the power button + something else. For me, it was the volume down key. Getting to recovery mode can be a bit tricky since the screen is broken, so it might take a few tries. You can check that the phone entered recovery mode by:
adb devices
If a device, say, ex.phone
shows up with recovery
, you’re in recovery mode.
2. Decrypt the file system
A password-locked phone will automatically encrypt the file system.
Let’s say you used 1234
as your password.
If the phone screen was working,
TWRP would prompt you to enter that password to decrypt the device.
But with the screen broken, you can’t do this.
Luckily, TWRP also exists a command line program to bypass requiring a GUI.
First, enter:
adb shell
This will put you into a root shell on your phone. Then, enter this command to decrypt your phone. Without this, all data on the file system will be useless gibberish.
twrp decrypt <PASSWORD>
Replace <PASSWORD>
with the phone password you use.
Now the phone is decrypted and you can access your data.
3. Back up your files
For instance, I backed up all the pictures and videos taken on this phone. Don’t input this on the adb shell session, exit it first or use another terminal.
adb pull /sdcard/DCIM ~/android-backup/
Each phone might have a different file system hierarchy,
so /sdcard/DCIM
might not exist on your phone.
The point is to find the path of the data you’re looking for,
then “pull” it to a directory on your computer.
So the general command is:
adb pull <PATH_TO_DATA_ON_PHONE> <BACKUP_DIRECTORY_ON_YOUR_SYSTEM>