The cleanest way to handle IMEI spoofing is through dedicated modules that hook into the framework.
: Use a PC tool like QPST (Qualcomm Product Support Tool) to back up your original QCN. change imei with magisk exclusive