The HDMI CEC bug, which prevented external devices from powering off 2016-2019 Sony TVs, has been fixed in Sony's latest firmware update.
Sony's HDMI CEC bug
Sony's roll-out of Android 9 to 2016-2019 Android TVs late last year introduced an HDMI CEC bug that prevented external devices (Apple TV, disc players etc.) from powering off the Sony TV. The bug has been widely reported by owners since late 2020.
Last week, Sony started rolling out firmware update v6.7165 to address the HDMI CEC issue. The firmware fixes the issue as intended, according to multiple owner reports on Flatpanels' forums.
Sony refers to HDMI CEC as 'Bravia Sync'
The firmware is available now for 2016-2019 models (D, E, F, G generations) including popular models like Sony A1, XE90 (X900E), and XF90 (X900F).
If you are not seeing firmware v.6.7165 through the TV's built-in update function, it can be downloaded manually onto a USB stick from Sony's supports pages: UK here and US here.