[Sony Cross-Device General] nlra:
(Apologies if this isn't the right forum...it's the only one I found that seems to deal in topics that are universally applicable to the entire Xperia line-up.)

For the entire time I've been using Xperia phones, I've always used the third-party "Flashtool" by Androxyde to flash my phones, and "XperiFirm" by Igor Eisberg to source my Sony ROMs from Sony servers. Both tools have proven to be extremely flexible and powerful, so why waste time with the first-party tools which don't give you much say or control over the process?

I also just recently realized that I had an inaccurate understanding of at least one of the first-party Sony tools: what Sony calls "Flash tool" on their developers site, but which calls itself "Emma". Based on posts I had read by others (esp. surrounding the bootloader upgrades for Z1/Z3 series that enable using the FOTAKernel partition to store and boot from a standard recovery image), I came away with the conclusion that the ROMs that Emma downloads are *different* than the ones that Xperia Companion downloads...that Sony tailor-made ROM releases specifically for users who had unlocked their bootloaders, and Emma was the distribution mechanism for those.

Maybe this was already obvious to everyone else and I'm just late to the party, but I recently decided to play with both Emma and the current iteration of Xperia Companion, and discovered this isn't the case.

The firmwares Emma downloads are *identical* to the firmwares Xperia Companion does. Assuming you can get both Emma and Xperia Companion to download the same exact ROM version for the same exact phone model with the same exact regional or carrier customization, the pre-decryption FILE_######## filenames are the exact same, the file sizes are the exact same, and in fact the downloaded files from both tools are bit-for-bit identical with each other.

As far as my previous misconceptions go, it would also appear that the bootloader improvements that Sony made to earlier phone models were in fact released to the general public through standard channels: if you wanted a bootloader version that could treat the FOTAKernel partition as a Recovery partition instead, all you had to do was upgrade to the latest ROM for your phone (and then unlock bootloader & flash a recovery image of your choice using Fastboot afterward, naturally). It didn't *have* to be done through Emma: the upgrade would arrive OTA and/or through Companion just as well (or of course packaged in an FTF and then flashed by Androxyde's tool). And all subsequent phone models seem to just have these bootloader improvements incorporated straight from the factory...no need to get Emma involved whatsoever.

This to me raises the question: why 2 completely separate tools from Sony, anyway? Xperia Companion (and Sony PC Companion before it) *refuses* to work on phones with unlocked bootloaders, while Emma *refuses* to work on locked bootloaders. Since they are both dealing with the exact same ROM code, why do either of them give a crap what the state of the bootloader is? In the instance of Companion, I could see a case being made for refusing to do a firmware upgrade to a phone with an unlocked bootloader, for the same reason that unlocking the bootloader stops OTAs from working: an unlocked bootloader means you don't know & can no longer trust what the state of the /system partition is -- it could have been modified -- and so a differential upgrade could completely fail to apply and even make Android unbootable afterward. But that's no excuse for making Companion refuse to do a "software repair" (which wipes out

all

code and data) on a phone with an unlocked bootloader! And likewise there is no excuse for Emma refusing to "apply a service" to a phone with a locked bootloader!!

It gets even weirder when you look under the hood of both tools and realize that they both use the exact same core (Java) routines to download and flash ROM images from Sony servers to Xperia phones. There is thus ZERO reason to differentiate them based on bootloader lock status. I'm okay with Sony having a generally consumer-facing repair tool (Companion) and more power-user one (Emma), but they both should absolutely work regardless of the bootloader being locked or unlocked. That's a stupid and artificial restriction.

I get the impression that Emma is used by more than just users of unlocked bootloaders (or as Sony thinks of them, the "developer community"). I think this might also be the same tool that they distribute to their Sony service partners for phone repair. This would explain why early versions downloaded from developer.sony.com would pop up a login screen unless/until you edited some .INI file that pre-populated it with credentials to enable "Sony developer world" mode. This means Emma is also PERFECTLY CAPABLE of "applying service" to phones with locked bootloaders anyway. It just chooses not to if you aren't an authorized Sony service center.

The final observation I'll make here is that Emma, at least while in "developer world mode", does often allow you to download and apply older ROMs for your phone. This logically must mean that

all of the past ROM versions still exist on Sony firmware update servers and can still be downloaded from them

. So my question in light of this is, why can XperiFirm only ever download the latest versions?

Tangentially related, anybody have a clue what the decision-making process is behind which ROMs Emma will offer to you for the phone that you have plugged in? I have a couple of Z5 Compacts: a U.S. model E5803, and an E5823 of unknown origin, and they both give different -- and equally weird -- results.

When I plug the E5823 in and put it in flash mode, Emma gives me like 5 different ROMs to choose from: a Lollipop 5.1.1 ROM, a Marshmallow 6.0 ROM, a Marshmallow 6.0.1 ROM, a Nougat 7.0 ROM, and a Nougat 7.1.1 ROM...and all of them are of NOBA customization. But the Nougat 7.1.1 ROM that it offers to me is 32.4.A.0.160, and not the very last/latest 32.4.A.1.54 release. Why the heck is that? I can download 32.4.A.1.54 for NOBA region from XperiFirm just fine, and if I try to do "software repair" to the phone from Xperia Companion, it also downloads 32.4.A.1.54.

When I plug the E5803 model from the U.S. in and put it in flash mode, Emma gives me exactly one option and

one only

: a very old Lollipop release (32.0.A.6.200) for "MY" (Malaysia) customization. THAT'S IT. No Marshmallow, no Nougat, and no other customization options. This is despite the fact that at the time I plugged the phone in, it was already loaded with and running a "US" customization ROM!

One might wonder if, say, my "U.S." phone is in fact NOT a true U.S.-released phone, and was perhaps flashed with Customized US firmware before it got into my hands. Well, from looking at the upgrade logs in the TA partition, that doesn't appear to be the case: it clearly started life as a U.S. model. And just in case there was some point at which I flashed Customized MY to it without remembering, I restored an old backup of the TA partition (which has nothing but Customized US firmware entries in it!), had Emma check it again, and SAME THING. So from this I can only conclude that it's basing the ROM offering off of the serial or IMEI of the phone?? Even so, where is it coming up with this Customized MY firmware, and why is it ONLY offering me Lollipop?