[General Questions and Answers] VQRDMULH:
Hello Android Enthusiasts, warm welcome from automotive industry sofware engineer.

At first, I wanted to point out even though I am programmer

(armv7 - C, scalar and vector Assembly) I used an Android phone as a regular user. Never

rooted, never unlocked bootloader, no modifications - typical stock ROM user.

Shame to admit, but never attracted to phone modifications. Also have no Android internals

experience.

Although my question applies to Xiaomi A2 Lite, I think that it is a generic question about a

problem that can occur on any device running Android (9 in my case)

Whats the problem?

- My 128GB SD card I used to have inside my Xiaomi A2 Lite 4/64GB was formated as

internal storage and as a consequence of that it got AES encryption. Ofcourse I was not aware about this until now.

And I did not have any cloud synchronization - Why do I ever need it, all my stuff in on my SD card obviously, Oh wait... ;-)

Why do I care?

- Had a tons of private photos and videos. Especially I miss photos of my growing up

kids. I will have a 3 years hole in my photo albums.

Ask me What happened?

- Suddently my Xiaomi A2 Lite 4/64GB stopped working. Got stuck/hung during YouTube playback

and then never booted again (endless Android One logo)

What did I do?

- As Linux desktop user first what came to my mind was to backup everything I can, so

i dd'ed complete SD card image to my hard drive (128GB sdcard.img) and using EDL mode

I downloaded complete internal eMMC memory content (64GB emmc.img)

What did I try already?

- I tried to unbrick my phone using Android update (still using version 9)

I was getting sideload error 1 when using SD card method and verification failures at

some random sectors when was attempting with Xiaomi tool via USB.

- wipe to factory state also fails (hang for 30+ hours) I suspect that it is not working at all

since even after that wipe /userdata partition content is the same as the original one)

Summarizing:

* Xiaomi A2 Lite 4/64GB with Android 9 is bricked (looping on Android logo)

* Device is open I have access to testpoints

* I suspect eMMC electrical issue likely I need to replace it.

* Have a complete dump of sd-card and internal eMMC memory on my hard drive.

* I do not care about phone device anymore, what do I care is only the sd-card data.

Question:

Is there even a little chance to recover the data from sd-card?

I am familiar with secure boot concept + data encryption, so not asking about any tools to decrypt the data

using bruteforce or anything like that. AES is AES no argues here - I know I need the key nothing else.

My idea (in steps):

The only one idea that come to my mind is the following. Please tell me if I'm correct or not.

1. I need to unbrick my phone, so I can unlock the bootloader.

(I assume it is kind of r&d cert that is written to one of the partitions by Xiaomi?)

2. To unbrick my phone I will need to solder new eMMC memory and copy all content I have from the old one.

3. Phone is still bricked on new eMMC, but I hope recoverable either using recovery menu or by EDL'ing new

Android 9 image.

4. If success with unbrick, try to unlock the bootloader.

5. Restore /userdata partiton from old phone image. To access sd-card's (/data/misc/vold) AES key.

6. Either phone boots fine and I have access to sd-card data, or flash TWRP and try to recover only the AES key from /data/misc/vold.

7. Having the key, I can decrypt sd-card data on my desktop's Linux PC using dm tools.

Big unknows to me (very appriciated if someone can clarify)

1. Where is stored key that encrypt /userdata partition? I assume that if I for example sacrifice my wife's

A2 Lite the key is different and I wont be able to decrypt /userdata? (Like flashing whole 64GB dump to her phone using EDL)

2. Unlocking process itself - is it some r&d certificate written by Xiaomi? Which partition? Probably based

on some Public-ID that is unique on every Qualcomm chip, so it is not moveable betweeen devices else

it would be very easy to crack it(?)

3. What partition(s) should I skip with update/recovery process in order not to change /userdata AES key.

In general my main focus is to access /data/misc/vold file. Having that key I can carefully say "mission complete". This

is my current understanding (correct?)

I will try to decrypt my sd-card until some Android Guru/Wizard tells me that my chance of decrypt sd-card in current situation is 0% ;-)

Anything above will motivate me to work to recover my precious data. Ofcourse if the chance of success is 0% I won't hurt myself either -

**** happens and we have to live on.

Lessons learned from this situation - done. My new phone is actively synchronized with my home's Synology NAS.

Extras - partitions list in my emmc.img and strings found inside userdata.img (extracted from whole 64GB emmc.img):

View attachment 5353713

View attachment 5353715

Thanks in advance for any valuable hints and have a great weekend!