Android is no doubt and open Source Platform, but there
are some limitations put on the devices to not let the
developers and user to flash Custom images and files on
their devices. If these limitations are not there,
obviously everyone will start doing whatever they like on
their device and in the end, if something happens,
they’ll blame the OEM. Now, these limitations are the
only way for an official to learn whether custom files
are flashed or not.
On Samsung devices, the Odin Mode has a Flash Counter to
let the official knows for how many times custom binaries
are installed on a specific device. On the other hand,
those devices having a locked Bootloader, cannot be given
back to claim the warranty. However, that does not mean
that you can’t pass these limitations, but not all of
them are easy to pass, sometimes you need to go through a
lot to pass them. In the case of Samsung, there is no
restriction, in HTC htc.dev is there to help you. But in
Xperia devices, things get a little complicated, and
we’ll show you exactly what and how.
https://androidswiki.com/unlock-bootloader-of-sony-xperia-devices-old-new/