(Sorry for the delay in responding. I used up my new user allocation of posts yesterday!)
TL;DR It’s now working!
Drying my eyes , I returned to the idea of flashing the Stock image using the MiFlash tool 2019.12.6.
The previously-noted “couldn’t find script” error is trivial to solve and it was my own mistake for not noticing this. MiFlash has a terrible user interface: unlike the previous version of the tool which shows only three radio buttons (‘clean all’, ‘save user data’ and ‘clean all and lock’), this new version also has a dropdown dialog where you must select the batch file name (!). If you click on a radio button but leave the dropdown blank, it will generate the “couldn’t find script” error. The batch file names are not intuitive and are also not related to your radio button selection. All round, a confusing mess!
_Flash_erase_userdata.bat and it appeared to be doing something. After a very long wait, the phone eventually finished its reboot sequence and booted into Stock Android 9 Pie. It was quite a shock to see all those Google Apps staring back at me because I want to get as far away from them as I can
I’ve checked that sound is working during calls. This was the problem in the first place that I am trying to fix. Sounds works fine for incoming and outgoing calls.
I continued to follow @Manoj’s instructions , enabled developer options on the phone, rebooted to Fastboot, then booted into the latest
twrp-3.3.1-0-tissot.img from here. From the TWRP screen (on the phone), I tapped
format data, then
system + data + cache (ignoring the ‘failed to mount /vendor’ errors). I downloaded a /e/ Pie image for the Mi A1 (tissot)
e-0.7-p-20191024-UNOFFICIAL-tissot.zip and sideloaded it to the phone … then rebooted.
/e/ booted successfully and I have spent the last hours reinstalling apps and updating settings. I even received a voice call that worked!
Noob question about backup and restore
I backed up the phone under Oreo prior to wiping it (heart racing) using
adb backup -apk -shared -all -f my-backup.ab. After upgrading to Pie, I restored the data using
adb restore my-backup.ab … but nothing really seemed to happen on the phone, even after rebooting it. I’d expect that settings, apps and documents (e.g. photos) would be restored to the phone but nothing seems to have happened. What should I expect to see after a
restore work properly across Android versions, or are they intended only to be used within Oreo or Pie and not between them?
It’s not a showstopper in this case because I kept very little on the phone that could not be recreated from other sources. It’s just a question for future reference.
So, my Xiaomi Mi A1 is working as a phone again, sending and receiving voice calls. It’s been a high adrenaline couple of days. Thanks to everyone who responded to my noob questions so readily and thoughtfully. Thank you all!!