[Huawei Mate 20 X Guides, News, & Discussion] room312:
TL,DR:

/sys/devices/platform/huawei_charger/enable_charger – 1 or 0. Enables or Disables the charger, respectively, even if a power source is connected (think overnight charging). Automatically becomes 1 when a power source is connected. Automatically becomes 0 when no power source is connected.

/sys/devices/platform/battery/power_supply/Mains/online – 1 or 0. If a power source is connected, this becomes a 1. If no power source is connected, this becomes a 0.

Use something like Tasker or the "Battery Charge Limit" app to control these.

(I'm pretty sure root is needed to access/modify these files.)

Background:

This is for those who are familiar with the study – https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries (and also perhaps for those who are learning about this for the first time and want to try it out). Whether or not this has actually prolonged any of my device batteries, I don't know, but I figure it can't hurt (right??), so I offer this information as-is (I also wanted to give back to the community, since I haven't seen this information posted yet). I haven't personally done any independent tests. I'm not responsible for any damage that may or may not occur as a result of this modification.

I'm using the GlobAL00ized ROM version 1.5 (.198 firmware) – https://xdaforums.com/mate-20-x/development/rom-mate-20-x-global00ized-beta-t3892304

I wish I had previously done this on my Xiaomi Mi Mix 1. I have a feeling some of us had this device. At least for me, I feel like the battery life has gone down on it. I'm not sure if it was the ROM I was using, or my charging habits (let it charge to 100% overnight, would sometimes let it die at 0%), or just its normal battery degradation.

I played around with these files for a couple weeks (before making this post) just to see if there were any issues. I'm happy to report that I personally did not experience any issues.

I’m personally using Tasker to set the "enable_charger" file. I set it to 0 when my battery is at 80%. I set it to 1 when my battery is below 79%. I use the "online" file to to quit the charging task when I disconnect the power source; otherwise, it'll keep charging enabled and may conflict with my other task that disables charging at 80%.

If you want to try this out without having to use something like Tasker, I would recommend using the "Battery Charge Limit" app (com.slash.batterychargelimit). I've tested it on a previous device. The app/interface is really simple to use. You should just have to change the control file (the file that controls whether or not to enable the charger), which is /sys/devices/platform/huawei_charger/enable_charger. I haven't tried it myself on this device (to be honest, I probably should have started with this app, but I already had an existing Tasker profile from a previous device, so this was one less app I needed to install), but of all the standalone apps that offer this feature, this was the simplest/easiest to use (at least for me).

For those interested, as I mentioned above, I'm letting my device charge up to 80% max. I’m using Tasker to automatically turn my phone off when it discharges down to 50%. With my normal daily charging habits, that’s more than enough. Also, it’s forced me to change my normal usage habits a little, so I’m using my phone more conservatively when it’s not charging. It’s also nice knowing that when my phone has “died,” I still technically have 50% battery for “emergencies” (my Tasker task allows me to cancel the shutdown, if necessary).

Anyway, since this forum has helped me so much, I figured I'd share. I hope this helps anyone else who’s looking to do the same. Maybe start additional related conversation, or find some other hidden features. The huawei_charger folder has a bunch of other files. The platform folder also has a bunch of other huawei folders. These files could bring other desired functionality.