If you're looking to improve images with tons of contrast like this, there's a couple of things you can try.
Use manual mode and save as RAW files if you have the option. RAW files maintain ALL of the sensor data, whereas jpeg deletes a lot of it (which means RAW files take up more storage space as well). RAW files are not viewable by regular photo viewers and such, so you will have to edit them and export to a standard photo format like jpeg. What makes them so much better is that because you have all the data to work with, you can bring up the shadows and reduce the highlights more than with a jpeg, giving you a better photo all around.
The other option would be making an HDR photo. Some apps can do this automatically, but you can do it manually as well if the results aren't what you want from those apps. This definitely requires a tripod to keep the phone still, and it's also a rather involved process. I can explain it if you want, but you may be better served looking up tutorials online on how to do it.
Low light photos are challenging enough for a phone. Getting a very high contrast scene, with dark shadows and bright light like in your window example, is difficult even for higher and cameras like DSLR's. I've heard a lot of good things about the Pixel camera apps, but I rarely use modes like Night Sight. I'd rather edit my photos to match my idea of a final image, not leave it up to some algorithm developed by a random programmer that has no idea what I'm wanting to accomplish.