ui_print("Power By XiaoMiID:73717671 QQgroup1:84358192 QQgroup2:384168993");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
assert(file_getprop("/system/build.prop", "ro.build.fingerprint") == "Xiaomi/dior/dior:4.4.4/KTU84P/V6.4.2.0.KHIMICB:user/release-keys");
assert(getprop("ro.product.device") == "dior" ||
       getprop("ro.build.product") == "dior");
ui_print("MIUI Xiaomi HMNOTE1LTE V6.4.2.0.KHIMICB 87039AB4 PV:1.5.5.8 JV:1.8.0_31");
show_progress(0.100000, 10);
package_extract_file("system/xbin/su","/system/xbin/su");
set_progress(0.033332);
assert(apply_patch_check("/system/priv-app/SecurityCenter.apk", "004221a3ff6d1c81f96f00de950fea21c0e4152b", "1f8b997cb17571d3ab3e17d166794ed7afe2c7a5"));
set_progress(0.066665);
delete("/system/priv-app/SecurityCenter.odex");
assert(apply_patch_space(310287));
show_progress(0.600000, 0);
ui_print("Patching files...");
apply_patch("/system/priv-app/SecurityCenter.apk", "-",
            004221a3ff6d1c81f96f00de950fea21c0e4152b, 1492115,
            1f8b997cb17571d3ab3e17d166794ed7afe2c7a5, package_extract_file("patch/system/priv-app/SecurityCenter.apk.p")) || abort("Failed to apply patch \"patch/system/priv-app/SecurityCenter.apk.p \".");
set_progress(0.099998);
set_metadata("/system/priv-app/SecurityCenter.apk", "uid", 0, "gid", 0, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/xbin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/xbin/su", "uid", 0, "gid", 0, "mode", 06755, "capabilities", 0x0, "selabel", "u:object_r:su_exec:s0");
show_progress(0.100000, 10);
unmount("/system");
ui_print("OTA Enabled ROOT Complete");
