[Razer Phone Guides, News, & Discussion] room312:
TL,DR:

/sys/class/power_supply/usb/device/razer_charge_limit_enable – 1 or 0. Enables or Disables the charge limit feature, respectively. 0 is default.

/sys/class/power_supply/usb/device/razer_charge_limit_max – The percentage at which charging stops and discharging begins. 70 is default.

/sys/class/power_supply/usb/device/razer_charge_limit_dropdown – The percentage at which charging begins again when the battery has discharged down to this level. 65 is default.

The values reset back to default after reboot.

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

Background:

I recently procured a Razer Phone 1. Also, over the last year or so, I also heard about the “craze” of limiting your battery charge to prolong its life. I figure, new phone – why not start off on the right foot and set up a charge limit. I don’t know whether or not I’ll actually ever notice the difference, but I figure it can’t hurt to try.

I’m rooted on 8.1.0, July 5, 2018 patch. Using Magisk.

I tried three different apps:

Battery Life Extender – I couldn’t even get past the 'blex --configure' step. It would fail/error.

Magic Charging Switch – It looked like I was able to set the charge limits, but the Razer Phone simply ignored them. I wasn’t sure why so I just moved on.

Battery Charge Limit – It looked like I was able to set the charge limits, but the Razer Phone simply ignored them. At first, I thought this was working, because I saw the battery icon revert to a “discharge” icon when it hit the limit I set (80%), but to my surprise, when I woke up in the morning, I saw that the battery was up to 100%. I figured I didn’t set the app properly (though it’s a fairly simple app), but when I saw it go from 80% to 81% with the “discharge” icon, I realized the phone was somehow circumventing this app’s function. This is probably the same reason why Magic Charging Switch wasn’t working. This probably also has something to do with why Battery Life Extender couldn’t configure. This app was using /sys/class/power_supply/battery/input_suspend to automatically set the charging state. However, the change was purely cosmetic since the phone kept on charging. It was truly a strange thing to see.

True, I could’ve asked for support in these individual threads, but I didn’t see much/any chatter about the Razer Phone in any of those threads. Perhaps I would not get an answer any time soon. I know most development is only possible when the developers actually have the device in question.

I continued to search for other files that could be controlling the charging behavior, because input_suspend obviously was not it. I came upon another thread which lead me to “/sys/class/power_supply/usb/device/”, which contained these three files that were obviously Razer custom files and not Android stock files ( razer_charge_limit_enable, razer_charge_limit_max, razer_charge_limit_dropdown). I tried playing around with the values within these files and they do, indeed, control the charge limit.

I played around with these files for a couple weeks (before making this post) just to see if there were any issues; the only issue I found was that the values reset back to default after a reboot. I’m sure there’s a better way to go about it, but I used Tasker to enforce my desired values.

What’s curious is I could not find any mention of these specific files online anywhere, so I could not know if there was a better way to enforce my values. From the time I originally found these files a couple weeks ago to the time of this post, I could not find anything about these files. I could not find any mention of this feature in the Android/Razer settings or the Developer Options. Perhaps it’s a feature Razer hasn’t made official yet, but clearly, someone over at Razer has thought about it enough to build the backend for this feature. What’s interesting is that in Razer’s opinion, perhaps the best charge limit for their phone/battery is 70%.

Perhaps this isn’t/shouldn’t be that big of a deal, considering “/sys/class/power_supply/usb/device/” is a known path. That said, Googling this path only yields 16 results (for me), and three different apps, on the Razer Phone, failed to do what they were intended for, and did not aid in finding the correct file.

For those interested, I set my max to 80%, dropdown to 78%, and 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. Perhaps the Razer Phone 2 has the same feature.