It’s legal to root your device; however, in most cases, rooting your device or unlocking the bootloader will void your warranty. If rooted, you should un-root a device before warranty service. Some manufactures have a digital “switch” that flips when you root or unlock the bootloader.
Will rooting void my warranty?
Is article helpful?