Just like the Galaxy S5, Sony has also hidden a service/diagnostics menu on the Xperia Z2, which allows users to test the various aspects of the device for any kind of hardware fault.
Since the diagnostics menu is hidden by default, majority of the Xperia Z2 owners are probably even unaware of its existence. If you are one of them, follow the steps below to access the hidden menu on your Z2.
Simply head over to the Dialer app on the Xperia Z2 and key in the following key code combination: *#*#7378423#*#*. Unlike the Service menu on the Galaxy S5, the Z2’s Diagnostics menu provides a lot of other information including the complete software and firmware details of the various components on the device.
If you want to find out whether you can unlock the bootloader of your Z2 or not, head over to Service Info -> Configuration and check what the Rooting status line says. If it says No, then there is no way for you to unlock the bootloader of your Z2.
To test the various hardware components of your Z2, head over to the Service tests sub-menu, which will allow you to test the touch screen, speaker, earphone and more.