Root to set a battery limit and unroot again? I dont have any practical experience with rooting my phone. There is one thing that's been bugging me for a very long time: I need to be able to set a charging limit on my Pixel 2 since I dont feel like replacing the battery soon and destroying the water resistance. 

My question is: if I root and set a charging limit and unroot again, will this setting be erased? As I said, I am not too familiar with the risks of having my OS more vulnerable towards viruses, thus the only thing I want to do is to set the battery charging limit and then just go back to unroot.

Thanks,
Alex
Setting a charging limit is not persistent. Therefore the call has to be made (with root permissions) at least once after every reboot. 

Rooting/unrooting requires at least a reboot. Therefore you can't "temporarily root" your device and set a charging limit.

If your device does not provide something like an intelligent battery charging optimization the only alternative is to use a battery charging notification app. 

There are a lot if battery charging notification apps on Play Store. Even if it is a bit old I still use Battery Full Notification  which can be configured to notify at a specific charging level.