HTC has stopped selling phones long ago. And recently, there are rumours that LG is going to stop selling phones too.
Sony's other businesses (gaming, cameras etc) are doing well so it can afford the losses in the mobile division. The Japs are legendary in their stubbornness, can be a good or a bad thing.
Sony is not going to regain the market share, that ship had sailed in 2014-2016. It will now sell overpriced phones to a small group of hardcore Sony fanboys. Bleed less money or break even, rinse and repeat.