[Xiaomi Mi 4] maxrajgor:
From last 2 weeks I have been struggling with getting my mi4 to work again. Earlier, I was running AOSP Extended Custom Rom based on ANDROID 10 without root but bootloader unlocked since last 3+ years and It was running well. Following complication happened suddenly without installing any new app on my phone:

My payment app shown that my phone is rooted and did not let me do any payments

Unable to connect to WIFI showing password cannot be saved

After that, I tried cleaning apps cache while system was on and through TWRP recovery cleaned Dalvik cache and cache but that did not change any behavior.

Instead of factory resetting and reinstalling same rom, I was looking for new rom and found Xtended XR Vanilla ANDROID 11 rom unofficially released in following thread:

Xtended XR Vanilla ANDROID 11 For Mi4 (Cancro)

I downloaded this rom and Gapps from BitGapps as somehow LiteGapps was not installing playstore even it stated in the information. I tried installing Xtended XR and Gapps but TWRP stated Storage is insufficient. So, I decided to see if only Xtended XR rom works or not? It worked after reinstalling. Everything was working fine but battery was draining fast that was unusual because earlier it was giving me around 1.5-2 hours of Screen on Time and now it was down to around 40-50 mins! In order to get Google Playstore, I had to resize system partition.

After reading few articles, threads and watching YouTube videos, I deleted cache, system, data and vender partitions and resized and recreated them. But after doing that still twrp was showing the same message of storage but I found that it is a problem with many custom roms but can be solved by unmounting system, resize system and mounting system again from twrp after flashing rom. It worked and I was able to install BitGapps and except battery draining everything worked. Therefore I was thinking of flashing some custom kernel for battery draining as I was using CraneWing kernel with AOSP Extended it was working fine. Before that I started setting up my phone settings and installed apps from playstore.

Everything was fine till now but on next day after finishing all basic settings and installing apps, I encountered new problem. It happened twice whenever I try to change brightness manually phone restarts automatically. From second time onward phone stopped booting to system.

I tried following things that did not work:

Re-flashing Xtended XR Rom and BitGapps (installed successfully every time but didn't boot)

Wiping and Formatting cache, data, and system partitions

Changing TWRP version

Installing Stock Fastboot MIUI Global Rom for Mi4 Cancro (installed 4-5 times successfully via PC on fastboot, MI recovery opened twice but system did not boot)

Re-flashing TWRP again (Because battery was not charging, so whenever I keep phone as it is for like 1-2 days for draining battery I can open TWRP with 1-3% battery and can charge till 16-20% then it goes to boot loop with Mi Logo)

By this time I was only able to access Fastboot, so tried installing stock rom but it did not boot. Recovery is also not accessible. I found that I can flash stock rom in EDL mode. My phone does not support EDL from fastboot. Then I found following thread for reboot to edl via fastboot:

Reboot to EDL Via Modified Fastboot For Redmi Note 3

I used that but because it was for Redmi Note 3 and I think I made a mistake by using that. I tried button combinations of Power and Volume buttons and also tried battery draining but that did not work. Now at this moment I am stuck with following problems in given order to make my phone work again:

Battery not charging

Stuck in EDL Mode. Restarting frequently (in 2-3 seconds) in EDL continuously without system recognizing it as Qualcomm Device

Able to turn on Fastboot when Connect with Wall Charger but cannot with USB connected with PC. Though I can turn on Fastboot with wall charger connected and then connect to PC to perform any fastboot commands.

Custom Recovery not accessible (Can flash recovery but not opening)

I am not sure it is entirely battery problem or something wrong with custom rom, gapps or fastboot miui stock rom. I am not sure how can I solve this problem now. Battery replacement seems one thing that I can do but the company stopped manufacturing batteries but I found someone who has 3 years old battery stock and says it works very well for this and many other devices batteries that he sells even if manufactured batteries kept unused for long.

What should I do? I would appreciate if someone help me on this.

Thanks.