Search This thread

VR25

Senior Member
Apr 20, 2013
1,753
4,376
You can still run a boot script on LineageOS. /system/etc/init.d/90userinit executes /data/local/userinit.sh if it's present. But, AFAIK, only if selinux is already set to permissive in boot.img (for example as described here).

I use AccA to modify the configuration and to update acc. When I'm done with updating AccA or modifying the configuration I freeze AccA with TitaniumBackup.

To initialize acc I use /data/local/userinit.sh.

For AccA until version 1.0.26 (including acc 2020.7.26) I used


Since AccA 1.0.27 (including acc 2020.10.1) I'm trying to use


But it's not working anymore. I guess, something necessary is not initialized at the time userinit.sh is being called.

If I put "sleep 5" in userinit.sh in front of the call of service.sh, accd is being started, otherwise not.

I'm running LineageOS 14.1 with the official su addon and meefik's busybox.
Try running /system/bin/sh /data/adb/vr25/acc/service.sh instead (latest acc).

I have a strange problem. Sometimes connect phone to charge(20% battery). Looks after 10 minut and See 100% battery [emoji15] Restart phone is 35%. Do you know where is problem?

Wysłane z mojego HD1903 przy użyciu Tapatalka
Do you use voltage limits? For me the system got confused when I have set a limit for the voltage. It would ramp up the percentages as it seems it thought the battery is full as the voltage didn't increase anymore :confused:
Yes, a custom voltage limit causes state of charge (SoC) deviation on some devices.
This is a design flaw by OEMs.
I added relevant information to the readme's troubleshooting section.

Is it possible to setup this module to stop charging at 80% and then when a specific time comes, ie. 6am re-start charging to full capacity?
That should be possible with the AccA app (GUI controller for ACC). However, it requires DJS (Daily Job Scheduler), and that tool doesn't work at all on my ROM. I'm not sure whether it also fails on other Android 11 phones/ROMs. Install the AccA APK (on the "releases" page), then create profiles, then create schedules to activate the profiles. If no schedule is created, it's because DJS doesn't work for you. But it's easy to try it and find out.
I can confirm that DJ's do work in OOS 10.3.5 along with ACCA app. But there are times it won't work as well or DJ's would say settings missing. It's all random. ACCA interface is clean but some settings doesn't seem to work same like the commands.
DJS needs an update.
I've been working on it.
 

VR25

Senior Member
Apr 20, 2013
1,753
4,376
I have one question. I set: stop charging at 80% and restart charging at 55. When I charge and use navigation or something else my phone stop charging at 80 but this stay all the time till I unplug the cable then phone start discharging. Battery indicator show that phone is charging but LED indicator show that's not happening. For me is good but this is safe for battery? Temp stay at 34.
HTC U Ultra, LineageOs 17.1, newest magisk, acc and acca. Thanks in advice.
PS: sorry for my bad English :D
That's "battery idle mode" and it's fine*.
The phone draws power directly from the external power supply - meaning, the battery is not charged constantly. In fact, if you wait long enough, the level will drop and keep dropping slowly. The same (self-discharge) happens if you leave the battery outside the phone.

* It's only a problem if you leave the battery highly/fully charged for extended periods of time.
Note that lithium ion/polymer batteries last longer when stored 40-60% charged.
For more details, refer to https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries .

One of the finest apps on earth. Just installed today and was trying different things and got a new version update before a couple of hours.
Faced the 70% Samsung problem so swithced to batt_slate_mode and it worked!.

The readme section created by the devloper is awesome. Appreciate the developer.
Thanks!
 

VR25

Senior Member
Apr 20, 2013
1,753
4,376
**v2020.10.8 (202010080)**

- Changelog is sorted in reverse order (older first).
- Enhanced dynamic switch delay.
- Fixed capacity_freeze2 and capacity_sync.
- General optimizations
- Move persistent data to /sdcard/Documents/vr25/acc/ for compatibility with Android 11 storage isolation.
- Updated documentation (FAQ, tips, voltage issues, Samsung's "70% problem", etc.).
- Use `cmd` in place of most `dumpsys` calls.

https://github.com/VR-25/acc/releases/tag/v2020.10.8
 

h-cspu

Senior Member
Jun 13, 2010
133
50
Baden-Württemberg
You can still run a boot script on LineageOS. /system/etc/init.d/90userinit executes /data/local/userinit.sh if it's present. But, AFAIK, only if selinux is already set to permissive in boot.img (for example as described here).

I use AccA to modify the configuration and to update acc. When I'm done with updating AccA or modifying the configuration I freeze AccA with TitaniumBackup.

To initialize acc I use /data/local/userinit.sh.

For AccA until version 1.0.26 (including acc 2020.7.26) I used
Code:
sh /data/data/mattecarra.accapp/files/acc/acc-init.sh

Since AccA 1.0.27 (including acc 2020.10.1) I'm trying to use
Code:
sh /data/data/mattecarra.accapp/files/acc/service.sh

But it's not working anymore. I guess, something necessary is not initialized at the time userinit.sh is being called.

If I put "sleep 5" in userinit.sh in front of the call of service.sh, accd is being started, otherwise not.

I'm running LineageOS 14.1 with the official su addon and meefik's busybox.

Try running /system/bin/sh /data/adb/vr25/acc/service.sh instead (latest acc).

What is that supposed to help?

/data/adb/vr25/acc is only a symlink to /data/data/mattecarra.accapp/files/acc
 
Last edited:

Vantskruv

Member
Apr 17, 2010
30
4
ACCA is nice app, but it feels a little buggy sometimes, especially after ACC or ACCA updates, maybe I am doing some wrong.
Everything works great with charging-switch set to charger/charge_disable (Pixel 4XL in Android 11) and 'Automatically cycle through switches' is disabled in the profile in ACCA.
Though, sometimes, in ACCA, the active profile is changing my charging switch to automatic, and enables the 'Automatically cycle through switches' option.
Also, DJS does not work (refuses to be installed).

I have been thinking on ditching ACCA for a while. Is there any easy commands in terminal where you change profiles on the spot? Also I read something about 'tasker', instead of using DJS, is it easy to manage?
I currently normally use two profiles:
42%: Chargingspan between 39% and 42%, max 500mA and 3.92V.
62%: Chargingspan between 59% and 62%, max 500mA. (I noticed that ACC crashed when limiting to 3.92V, I guess it freaks out when it needs to get above 3.92V to reach 62%, so I guess I need to increase the voltage, but have not done it yet).
Also occasionally when needed, I charge up to 80% or 100%, but I have not set any profiles for that yet.

So, anyone have a good tip/examples how to manually set profiles quickly via the terminal, and maybe also using 'tasker' to set a schedule?
 

VR25

Senior Member
Apr 20, 2013
1,753
4,376
What is that supposed to help?

/data/adb/vr25/acc is only a symlink to /data/data/mattecarra.accapp/files/acc
Aw, snap!
I forgot that point.

You mentioned "sleep 5" helps.
Is your data encrypted?

It seems /data/data/mattecarra.accapp/files/acc/service.sh is not readily accessible by the time your userinit.sh runs.

Code:
while [ ! -f /data/data/mattecarra.accapp/files/acc/service.sh ]
do
  sleep 5
done

Using this in place of "sleep 5" may be a more robust solution.

Btw, why don't you just let AccA do the initialization job?
 

VR25

Senior Member
Apr 20, 2013
1,753
4,376
ACCA is nice app, but it feels a little buggy sometimes, especially after ACC or ACCA updates, maybe I am doing some wrong.
Everything works great with charging-switch set to charger/charge_disable (Pixel 4XL in Android 11) and 'Automatically cycle through switches' is disabled in the profile in ACCA.
Though, sometimes, in ACCA, the active profile is changing my charging switch to automatic, and enables the 'Automatically cycle through switches' option.
Also, DJS does not work (refuses to be installed).

I have been thinking on ditching ACCA for a while. Is there any easy commands in terminal where you change profiles on the spot? Also I read something about 'tasker', instead of using DJS, is it easy to manage?
I currently normally use two profiles:
42%: Chargingspan between 39% and 42%, max 500mA and 3.92V.
62%: Chargingspan between 59% and 62%, max 500mA. (I noticed that ACC crashed when limiting to 3.92V, I guess it freaks out when it needs to get above 3.92V to reach 62%, so I guess I need to increase the voltage, but have not done it yet).
Also occasionally when needed, I charge up to 80% or 100%, but I have not set any profiles for that yet.

So, anyone have a good tip/examples how to manually set profiles quickly via the terminal, and maybe also using 'tasker' to set a schedule?
[42]
acc -s rc=39 pc=42 mcc=500 mcv=3920

[62]
acc --set resume_capacity=59 pause_capacity=62 max_charging_current=500 max_charging_voltage=3920

[Occasionally charge up to 80 or 100%, without current/voltage restrictions]
acc -f 80
acc -f 100 or just acc -f

Until I finish working on the DJS update, you can set up Tasker to run those commands at specific times to switch profiles.

Notes
- [Tasker] Prepend su -c to the commands or mark the "run as root checkbook".
- acc -f does not modify the regular config - meaning, you don't have anything to undo. After the specified battery level is reached, accd restarts with your regular/previous config/profile. You can force that at any time (cancel acc -f) by just running accd (restarts the daemon).
 

fever7nova

New member
Oct 8, 2020
3
0
That's "battery idle mode" and it's fine*.
The phone draws power directly from the external power supply - meaning, the battery is not charged constantly. In fact, if you wait long enough, the level will drop and keep dropping slowly. The same (self-discharge) happens if you leave the battery outside the phone.

* It's only a problem if you leave the battery highly/fully charged for extended periods of time.
Note that lithium ion/polymer batteries last longer when stored 40-60% charged.

Thanks for reply!
So is this problem when i drive a car with open navigation and LTE and the phone is in "battery idle mode" about 6 hours? I have calibrated macrodroid with two macros. First: when i start a car (charger on) my phone become unlocked, GPS on, LTE on, Waze and Yanosik on. When I stop the venicle (charger off): GPS off, LTE off, Waze and Yanosik off and phone become locked. That is the reason why i want my phone being pluged to the charger all the time. Maybe you know solution for my problem? BTW. This app is awesome :)
 
Last edited:

VR25

Senior Member
Apr 20, 2013
1,753
4,376
Thanks for reply!
So is this problem when i drive a car with open navigation and LTE and the phone is in "battery idle mode" about 6 hours? I have calibrated macrodroid with two macros. First: when i start a car (charger on) my phone become unlocked, GPS on, LTE on, Waze and Yanosik on. When I stop the venicle (charger off): GPS off, LTE off, Waze and Yanosik off and phone become locked. That is the reason why i want my phone being pluged to the charger all the time. Maybe you know solution for my problem? BTW. This app is awesome :)
Simply put, if you want your phone to remain plugged for extended periods of time (e.g., several hours), don't charge the battery past 60%.
Pick a number within 40-60%.
That's where great longevity lives.
 

Koushik87

Senior Member
Nov 3, 2014
60
17
34
Kolkata
My bad... this issue was not solved by the previous version.
There's a new version.
Other Pixel users tested it and reported success.

I added relevant information to the readme.
This is a Samsung-specific issue.
To avoid it, you have to set the batt_slate_mode charging control file (acc -ss).

Thanks dev. But i have oneplus 6T. Never faced the issue with previous builds. Will test again based on suggestions and let know.
 

h-cspu

Senior Member
Jun 13, 2010
133
50
Baden-Württemberg
Aw, snap!
I forgot that point.

You mentioned "sleep 5" helps.
Is your data encrypted?

It seems /data/data/mattecarra.accapp/files/acc/service.sh is not readily accessible by the time your userinit.sh runs.

Code:
while [ ! -f /data/data/mattecarra.accapp/files/acc/service.sh ]
do
  sleep 5
done

Using this in place of "sleep 5" may be a more robust solution.

Btw, why don't you just let AccA do the initialization job?

My device is not encrypted.

I did a test. I wrote the result of the existence of /data/data/mattecarra.accapp/files/acc/service.sh during the run of userinit.sh in a log file. The file exists.

I used "sleep 5" only for a test. I wanted to know if accd will be started, if your script runs later in the boot process.

I think, a counter should be used to leave/stop the infinite while loop if the file will never exist.

Do you have any idea, why the call from init.d works with older acc versions but not with the latest ones?

Currently I use tasker to start acc.

I don't use AccA, because it always displays 0mA for "Current Now" and -1° for "Temperature".
 
Last edited:

VR25

Senior Member
Apr 20, 2013
1,753
4,376
My device is not encrypted.

I did a test. I wrote the result of the existence of /data/data/mattecarra.accapp/files/acc/service.sh during the run of userinit.sh in a log file. The file exists.

I used "sleep 5" only for a test. I wanted to know if accd will be started, if your script runs later in the boot process.

I think, a counter should be used to leave/stop the infinite while loop if the file will never exist.

Do you have any idea, why the call from init.d works with older acc versions but not with the latest ones?

Currently I use tasker to start acc.
I have an idea of what could be behind this issue.
An update will be up soon.

I don't use AccA, because it always displays 0mA for "Current Now" and -1° for "Temperature".
Share a fresh log archive generated by acc -le.
 
Last edited:

nxb

Senior Member
Aug 19, 2010
130
20
I installed ACCA. Had 2 issues.

1. It blocks using ADB. On my v20 the debugging setting is always turned off.

2. AccA needs to start at boot or the settings don't get applied, I guess this is good and bad. Putting it all in the on-boot line seems too much to type out.
 

VR25

Senior Member
Apr 20, 2013
1,753
4,376
I installed ACCA. Had 2 issues.

1. It blocks using ADB. On my v20 the debugging setting is always turned off.

2. AccA needs to start at boot or the settings don't get applied, I guess this is good and bad. Putting it all in the on-boot line seems too much to type out.
That's weird.
Are you using the latest version from https://GitHub.com/MatteCarra/AccA/releases/latest/ ?

Issue 1: that's the first report of its kind.
I'll keep an eye on it.

Issue 2: do you use EdXposed?
AccA does not have to start on boot if you use Magisk - i.e., Magisk takes care of initializing ACC.
EdXposed was found to prevent other modules' service.sh scripts from running.

apply_on_boot has nothing to do with regular settings.
It's similar to kernel tweaking apps in what it does - i.e., it's used for applying miscellaneous kernel settings.
 

nxb

Senior Member
Aug 19, 2010
130
20
No edExposed here, I'm on nougat. I installed the magisk version then got the gui so I didn't have type all the commands out. Disabled the boot receiver on the apk thinking the scripts would start and apply what I set in the gui.

For ADB it was consistent, tried every which way to enable debugging until I stopped the ACC service.
 

VR25

Senior Member
Apr 20, 2013
1,753
4,376
v2020.10.14 (202010140)

- acc -i: show additional power supply info, if any.
- build.sh: copy uninstaller to build dir.
- cooldown_current: instead of pausing charging periodically during the cooldown phase, lower the charging current (0mA or custom). This is the default behavior (smoother).
- Fetch current and voltage control files only once per boot session to prevent loss of default values.
- Fixed daemon restart/stop timeout issues.
- Fixed Zygote-related issue that prevented accd initialization on boot.
- Misc fixes & optimizations
- MTK switch delay ranges from 5 to 20 seconds.

https://github.com/VR-25/acc/releases/tag/2020.10.14

I don't use AccA, because it always displays 0mA for "Current Now" and -1° for "Temperature".
See whether this issue remains.
 
Last edited:

Top Liked Posts

Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone