Magic charging switch for android (Magisk Modul) - Android General

hello friend
Sorry for my bad engish
This is the best mod for your android mobile
Control your charger using this trick
Your charger has stop charging automatically in your setting type
For example - you set your device charge 90% this modul is stoped your charger after your device is charged 90%
You also controll charger using time paired like
30 minets
1h 30m etc.
How to install it -
1. Root your device with letest magisk root
2. Go to downlod option in magisk manager
3. Download "Magic charging switch" & install it then active it
4. Reboot your device
5. download terminal emulator
6. Type "su" & then type "mcs "
Its chek your device is supported /nonsupported
Now injoy ????
Commonds for using this modul--
- Run `su` first, ALWAYS -- or make sure `su -c` goes before `mcs` (i.e., `su -c mcs -e 30m`).
- Run `su` first, ALWAYS -- or make sure `su -c` goes before `mcs` (i.e., `su -c mcs -e 30m`).
mcs [-b] [-h] [-i] [-r] [-v] [debug] [-k LEVEL] [PAUSE% RESUME%] [PAUSE%] [-m PAUSE% RESUME%] [-s --enable/disable] [-t PAUSE% RESUME%] [-d %/TIMEOUT] [-e %/TIMEOUT] [-x /path/to/switch ON_key OFF_key]
`-b` --> reset battery stats on demand (does not work on all devices)
`-h` --> mcs usage instructions
`-i` --> display battery info
`-r` --> reset cs to its initial state
`-s` --> pause/resume, --enable/disable service
`-v` --> toggle extensive (loops) verbose
`-x` --> pick a different charging switch from the database
`debug` --> gather debugging data & save it to /sdcard/mcs_debug-DEVICE.log
just `mcs` --> run MCS with default/saved settings
`-k` LEVEL --> keep/maintain battery power at a constant LEVEL (pauses MCS service)
`PAUSE% RESUME%` --> pause charging at PAUSE% value (default 90); resume if battery drops below RESUME% (default 80). This is the `initial setup command`. If auto-run is OFF, the command works as is; else, new settings are saved and automatically picked up by MCS service.
`-m/-t PAUSE% RESUME%` --> generate automation config (-m for MacroDroid; -t for Tasker -- pick one)
`-d [%/TIMEOUT (optional)]` --> disable charging on demand (pauses MCS service)
`-e [%/TIMEOUT (optional)]` --> enable charging on demand (pauses MCS service)
`-x` /path/to/switch ON_key OFF_key -- > manually set a charging switch; if keys match one of the following as is or in reverse oder -- you don't have to specify them: 1/0, enable/disable, enabled/disabled, true/false, on/off, 100/3
### Usage Examples/Tips
`mcs 85` --> pause charging at 85%; resume when battery level is less or equal to 80% (default).
`mcs 80 20` --> pause charging at 80%; resume when battery level is less or equal to 20%.
`mcs -d` --> disable charging.
`mcs -e` --> enable charging.
`mcs -d 30m` --> keep charging disabled for 30 minutes
`mcs -e 1h` --> keep charging enabled for 1 hour).
`mcs -e 80%` --> Charge until battery level equals 80%.
`mcs -d 40%` --> Charge until battery level equals 40%.
`mcs -e 120 && mcs -d 30m && mcs -e 1h` --> charge for 120 seconds, pause for 30 minutes, then charge again for 1h.
`mcs -e 30m && mcs -d 30m && mcs -e 90%` --> charge for 30 minutes, pause for 30 minutes, then charge again, but this time until battery level is greater or equal to 90%.
`mcs -e 50% && mcs -d 5h && mcs -e 80% && mcs -d 30m && mcs -e 90%` --> charge until 50%, pause for 5 hours, charge until 80%, pause for 30 minutes, charge until 90%.
Ideally, you want your battery level between 40-60% - best, 20-80% - average, 10-90% - fair.
For best convenience, stick with mcs 90 80; mcs 80 70 for a perfect balance between convenience & battery wear. If you want the longest battery lifespan, use mcs 42 41 or mcs -k 42 (best for prolonged usage -- i.e., navigation).
mcs [-b] [-h] [-i] [-r] [-v] [debug] [-k LEVEL] [PAUSE% RESUME%] [PAUSE%] [-m PAUSE% RESUME%] [-s --enable/disable] [-t PAUSE% RESUME%] [-d %/TIMEOUT] [-e %/TIMEOUT] [-x /path/to/switch ON_key OFF_key]
`-b` --> reset battery stats on demand (does not work on all devices)
`-h` --> m cs usage instructions
`-i` --> display battery info
`-r` --> resetmccs to its initial state
`-s` --> pause/resume, --enable/disable service
`-v` --> toggle extensive (loops) verbose
`-x` --> pick a different charging switch from the database
`debug` --> gather debugging data & save it to /sdcard/mcs_debug-DEVICE.log
just `mcs` --> run MCS with default/saved settings
`-k` LEVEL --> keep/maintain battery power at a constant LEVEL (pauses MCS service)
`PAUSE% RESUME%` --> pause charging at PAUSE% value (default 90); resume if battery drops below RESUME% (default 80). This is the `initial setup command`. If auto-run is OFF, the command works as is; else, new settings are saved and automatically picked up by MCS service.
`-m/-t PAUSE% RESUME%` --> generate automation config (-m for MacroDroid; -t for Tasker -- pick one)
`-d [%/TIMEOUT (optional)]` --> disable charging on demand (pauses MCS service)
`-e [%/TIMEOUT (optional)]` --> enable charging on demand (pauses CS service)
`-x` /path/to/switch ON_key OFF_key -- > manually set a charging switch; if keys match one of the following as is or in reverse oder -- you don't have to specify them: 1/0, enable/disable, enabled/disabled, true/false, on/off, 100/3
### Usage Examples/Tips
`mcs 85` --> pause charging at 85%; resume when battery level is less or equal to 80% (default).
`mcs 80 20` --> pause charging at 80%; resume when battery level is less or equal to 20%.
`mcs -d` --> disable charging.
`mcs -e` --> enable charging.
`mcs -d 30m` --> keep charging disabled for 30 minutes
`mcs -e 1h` --> keep charging enabled for 1 hour).
`mcs -e 80%` --> Charge until battery level equals 80%.
`mcs -d 40%` --> Charge until battery level equals 40%.
`mcs -e 120 && mcs -d 30m && mcs -e 1h` --> charge for 120 seconds, pause for 30 minutes, then charge again for 1h.
`mcs -e 30m && mcs -d 30m && mcs -e 90%` --> charge for 30 minutes, pause for 30 minutes, then charge again, but this time until battery level is greater or equal to 90%.
`mcs -e 50% && mcs -d 5h && mcs -e 80% && mcs -d 30m && cs -e 90%` --> charge until 50%, pause for 5 hours, charge until 80%, pause for 30 minutes, charge until 90%.
Ideally, you want your battery level between 40-60% - best, 20-80% - average, 10-90% - fair.
For best convenience, stick with mcs 90 80; mcs 80 70 for a perfect balance between convenience & battery wear. If you want the longest battery lifespan, use mcs 42 41 or mcs -k 42 (best for prolonged usage -- i.e., navigation).
-Credit -
1. Magisk devlopers for make this
2. Me for shared this post
For mor info Go to my youtube channal
D-AZ Dinesh
And watch full toturial
Dont forget to thank ||

Where can I get zip file for this old magisk module
As it was updated as acc, it seems complicated to me
I had no problem with mcs or even older cs regarding setting up lower and upper limit

prajj said:
Where can I get zip file for this old magisk module
As it was updated as acc, it seems complicated to me
I had no problem with mcs or even older cs regarding setting up lower and upper limit
Click to expand...
Click to collapse
Yes exactly what i'm thinking!!
I'm perfect with MCS, ACC is just too complicated for my simple need.
Here i have it, it was fine till idk why i can't install it with latest magisk (19.3)

iiandskater said:
Yes exactly what i'm thinking!!
I'm perfect with MCS, ACC is just too complicated for my simple need.
Here i have it, it was fine till idk why i can't install it with latest magisk (19.3)
Click to expand...
Click to collapse
I had flashed with your .zip module but it throw me error "magisk_merge.img mount point not found".

Related

[MOD] %Battery Drain/Hr Widget using Tasker and Minimalistic Text

Cool %Battery Drain/Hr Widget using Tasker and Minimalistic Text
Minimalist widget that displays:
- % of battery drain or charge per hour... ie "-6.89 /hr"
- time in hours remaining till fully charged or discharged at the accumulated average % drain per hour... ie "14.2 hrs"
- % of battery lost or gained in hours since plugged in or unplugged... ie "-2% in 0.29"
Requires Minimalistic Text App from Market: https://market.android.com/details?id=de.devmil.minimaltext&hl=en
If anyone has any suggestions on how to simplify it... let me know.
4 Profiles Total:
Profile 1 - OnBoot - Clears and sets variables for new battery drain/charge stats
Profile 2 - PluggedIn (AC or USB) - Clears and sets variables for new battery drain/charge stats
Profile 3 - BattCharging - Calculates %charge/hr, time till 100% charge and %battery increase since start of charging
Profile 4 - BattDraining - Calculates %drain/hr, time till 0% charge and %battery decrease since start of discharging
The first two profiles are designed to clear and reset the battery% and timestart variables when the phone boots up or when the power profile changes. The first one is the OnBoot profile which is a useful profile to have in the first place. You can have your phone start a program or do some other useful task when your phone first starts up.
The second one will activate when the phone is plugged in either via usb or the wall plug. This is also a useful profile for other reasons... for example you can make your timeout longer when the phone is plugged in and make it go back to a shorter timeout when it's unplugged with the exit task.
I would imagine some people already have an OnBoot and a Charging profile, so just add the following tasklist to them to keep from cluttering up your tasks if it's viable, otherwise just create the profiles as they are below.
Profile 1: OnBoot
Context: Event > System > Device Boot
Task:
1. Variable Clear: %BATTSTART
2. Variable Clear: %TIMESTART
3. Variable Set: %BATTSTART To %BATT
4. Variable Set: %TIMESTART To %TIMES
5. Minimalistic Text: Configuration - %BATTDRAIN = Please
6. Minimalistic Text: Configuration - %BATTLEFT = wait...
7. Minimalistic Text: Configuration - %TIMEBATT = (blank)
Profile 2: PluggedIn
Context: - Choose State > Power > Power > Source: Any
Task:
1. Variable Clear: %BATTSTART
2. Variable Clear: %TIMESTART
3. Variable Set: %BATTSTART To %BATT
4. Variable Set: %TIMESTART To %TIMES
5. Minimalistic Text: Configuration - %BATTDRAIN = Please
6. Minimalistic Text: Configuration - %BATTLEFT = wait...
7. Minimalistic Text: Configuration - %TIMEBATT = (blank)
Exit Task:
1. Variable Clear: %BATTSTART
2. Variable Clear: %TIMESTART
3. Variable Set: %BATTSTART To %BATT
4. Variable Set: %TIMESTART To %TIMES
5. Minimalistic Text: Configuration - %BATTDRAIN = Please
6. Minimalistic Text: Configuration - %BATTLEFT = wait...
7. Minimalistic Text: Configuration - %TIMEBATT = (blank)
The next two profiles are where all the math is done. One profile is setup for when the phone is plugged in and charging. The other is setup for when the phone is unplugged and discharging. An IF statement was implemented because Tasker seems to track battery changes very frequently even when the actual battery percent hasn't changed. So a variable called %BATTPREV was created to do a quick check... If the battery % hasn't changed then it doesn't do anything until it does change. Also... I personally have the results written to a battlog.txt file because I found it handy to see a log of data.
I used the Variable Section task to drop one of the decimal points... Precision to 3 decimals is not necessary I don't feel, but there is no way to round it to 1 or 2 decimals yet. I think to the 10ths is plenty for this application.
Profile 3: BattCharging:
Context: Event > Power > Battery Changed
Context: State > Power > Power > Source: Any
Task:
1. If - %BATT !~ %BATTPREV
2. Variable Set: %BATTUSED To %BATT - %BATTSTART - Check "Do Maths"
3. Variable Set: %TIMEBATT To (%TIMES - %TIMESTART)/3600 - Check "Do Maths"
4. Variable Section: %TIMEBATT From 1 Length 4
5. Variable Set: %BATTDRAIN To %BATTUSED/%TIMEBATT - Check "Do Maths"
6. Variable Section: %BATTDRAIN From 1 Length 4
7. Variable Set: %BATTLEFT To (100-%BATT)/%BATTDRAIN - Check "Do Maths"
8. Variable Section: %BATTLEFT From 1 to Length 4
9. Minimalistic Text: Configuration - %BATTLEFT = %BATTLEFT hrs
10. Minimalistic Text: Configuration - %BATTDRAIN = +%BATTDRAIN /hr
11. Minimalistic Text: Configuration - %TIMEBATT = +%BATTUSED in %TIMEBATT
12. OPTIONAL - Write File: battlog.txt Append:On - Text:"CHG: %DATE, %TIME, %BATT, +%BATTDRAIN / hr %UPS"
13. End If
14. Variable Set: %BATTPREV To %BATT
Profile 4: BattDraining:
Context: Event > Power > Battery Changed
Context: State > Power > Power > Source: Any INVERT!!
Task:
1. If - %BATT !~ %BATTPREV
2. Variable Set: %BATTUSED To %BATT - %BATTSTART - Check "Do Maths"
3. Variable Set: %TIMEBATT To (%TIMES - %TIMESTART)/3600 - Check "Do Maths"
4. Variable Section: %TIMEBATT From 1 Length 4
5. Variable Set: %BATTDRAIN To (%BATTUSED/%TIMEBATT)*-1 - Check "Do Maths"
6. Variable Section: %BATTDRAIN From 1 Length 4
7. Variable Set: %BATTLEFT To %BATT/%BATTDRAIN - Check "Do Maths"
8. Variable Section: %BATTLEFT From 1 to Length 4
9. Minimalistic Text: Configuration - %BATTLEFT = %BATTLEFT hrs
10. Minimalistic Text: Configuration - %BATTDRAIN = +%BATTDRAIN /hr
11. Minimalistic Text: Configuration - %TIMEBATT = -%BATTUSED in %TIMEBATT
12. OPTIONAL - Write File: battlog.txt Append:On - Text:"CHG: %DATE, %TIME, %BATT, -%BATTDRAIN / hr %UPS"
13. End If
14. Variable Set: %BATTPREV To %BATT
Finally.... Create a Minimalistic Text Widget size of 1x1 to display the data on your homescreen
Setup a Custom Layout with 3 Levels...
Level 1: Add Local Variable from the Misc tab: Variable Name: %BATTDRAIN, Style: Normal Override Size: 15
Level 2: Add Local Variable from the Misc tab: Variable Name: %BATTLEFT, Style: Normal, Override Size: 15
Level 3 (OPTIONAL): Add Local Variable from the Misc tab: Variable Name: %TIMEBATT, Style: Normal, Override Size: 10
Thanks man.
You have no idea how long I was investigating somethig light and easy way to show discharge rate on the home screen.
I test your build and can confrim, that it works as prescribed even after 2 years you wrote first post.
Anyway I hope you did not stop to work on it and you can improve it. After few first days I am planning to study deeper your original work. I am new not new to Tasker but I never work with variables.
I would like to improve and add some stuff:
1. I want to see current discharge rate of last 1%.
2. show time in format "X hours X minutes"
Lol... blast from the past
Actually I still use it... but I've made some modifications and tweaks since.
I've simplified it a bit and changed what it watches for...
When it is draining it keeps track of:
Drain/hr... (ex) -2.5 %/h
Estimated time remaining: (ex) 10h 53m
Screen on time accumulated/total screen time expected: (ex) 0.48 / 4.58
When it's charging it keeps track of the first two things... charge per hour and estimated time till 100% and the bottom figure counts how many % have charged since plugged in and how long it's been.
Works reliably still... I've been meaning to program it in java and make a tiny app independent of these 3rd part apps... but eh.
Glad you like it.
Sent from my SM-N900T using Tapatalk
This is how it looks now while discharging.
Sent from my SM-N900T using Tapatalk
This is on my home screen
Do you mind sharing version with screen on time?
Give me a day or two and I'll write a detailed update for the profiles.
I really should just learn to program this sometime. It would be a lot easier.
Sent from my SM-N900T using Tapatalk
It's too much too type... I exported the profiles. Remember... you need minimalistic text to display the information on your home screen. I'm including the profiles and the minimalistic text profile as well. You can figure out how to import tasker profiles and the minimalistic folder is accessed from within the program... you have to save it to the sdcard/Minimalistic TextPreferences folder on your phone to be accessed.
Good luck!!
There are six profiles.
1. BatteryDraining - Tracks when your phone is unplugged and only performs a % drain / hour calculation when the battery % goes down and displays on the minimalistic text widget.
2. BatteryCharging - Tracks when your phone is plugged in and only performs a %charge / hour calculation when the battery % goes up and displays on the minimalistic text widget.
3. PluggedIn - Resets the variables used by the BatteryCharging profile in order to track charging % / hour statistics. When phone is unplugged variables are again reset for the BatteryDrain profile to track drain % / hour. (You may want to edit this profile because I have it set my screen time out to 15 minutes when it's plugged in and goes back to 30 seconds when unplugged. Also writes the stats to a text file on the phone storage... this is not necessary, but it's interesting for logging purposes to me.)
4. OnBoot - Resets all variables and will automatically calculate and display % drain or % charge wether phone is plugged in or not. (This profile also appends some information to the same battery log on the phone memory.)
5. ScreenOn - simple profile that sets the time that the phone screen is turned on
6. ScreenOff - another simple profile that sets the time that the screen is turned off and appends cumulative screen time and calculates an estimate of maximum screen on time which displays via minimlalistic text widget when phone is unplugged.
Alright... it works really well and I use it constantly. Next to zero battery drain because it only does anything when the battery actually changes. There is no active "monitor" mechanism.. it works entirely on reports of the system of battery changes.
Thanks for profiles, but i have a problem.
PluggedIn profile points to BattFull Profile Status...
I have exclamation mark on that profile, under Profile Status.
I set it to PluggedIn, and I'm testing it right now.
Will report later
It works fine, thanks again
Oh yeah... BattFull is another profile I created. It is very simple... when battery hits 100% it makes a sound and then turns itself off. When you plug in the phone it activates BattFull again. You can just delete that task... or make battful
Sent from my SM-N900T using Tapatalk
I'm not trying to do this exactly but something similar and maybe you can help me.
What I'm trying to do is make tasker alert me if my battery drops more than 2% per hour during my workday.
This is a little long so please bear with me:
I have 2 profiles. The first happens at 8:45 AM. The second happens every hour from 9:30AM to 4:30PM
Profile 1)
Variable Set %BATTLEVEL to %BATT
Profile 2)
Variable Set %CURRENTBATT to %BATT
Variable Set %BATTDIFF to %BATTLEVEL - %CURRENTBATT (do maths checked)
Alert - Notification LED - If %DIFFBATT > 2
This should happen at the 1/2 hour mark in each hour, but it is not performing the Variable Set tasks. The thing is I know these profiles are active and working because I have them doing other things like turing my data off, setting ringer volumes...and all those things are working.
The battery was at 56% at 2:15 PM when i set this up. So at 2:45PM I ran a test task Flash %BATTLEVEL, and Flash %CURRENTBATT, it gave me 56% for both. Then I purposefully drained it to 53% by 3:15PM so that I could test to see if it was working. I was expecting it to start flashing my notification light at 3:30PM. But it did not, so at 3:45 PM I checked the test task and the %BATTLEVEL and %CURRENTBATT are still at 56. So it just never ran the Variable Set commands. I don't understand why it wouldn't run those. Any suggestions?
Is that Calendar widget Tasker-based? If so, do you mind sharing?
Has anyone got a profile for estimating how long until the battery is fully charged?
Is there anyway to display the battery stats in a notification instead of a widget?
Please guide me how to add current mA to this settlement

Using Tasker to set Moto Mod battery to start charge lower than 80%

You need root to do this.
You can use the Run Code function in Tasker and put - dumpsys battery unplug
This will stop the phone from charging (thru all charging methods) until battery level drops.
If you wish to permanently stop charging the phone until a certain % then you have to set Moto Mod to efficiency mode then trick the phone to thinking it is still within a certain % with - dumpsys battery set level 81
This will artificially set the battery level to 81%, above the efficiency mode level and, stop the phone from polling battery stats.
To restart polling of battery stats use - dumpsys battery reset
Use Tasker events to control the execution of commands.
For example:
On Display On:
dumpsys battery reset
On Display On and if Battery Level is Between 50 to 81:
dumpsys battery set level 81
dumpsys battery unplug

Xperia XZ dual - phone idle, google play services, android OS battery consumption

Hi All,
Do you know when Sony will issue a SW update to solve the high battery consumption of (phone idle, google play services, and android OS) processes.
I am on Nougat, 39.2.A.0.442
Thanks,
well they are kind of slow in getting updates on time...only issue i wish they fix is battery drainage...phone idle consumed 1050 mah of battery in 2 days, why Sony?is system doing something from behind that we dont know or what LOL.im also on latest Nougat .442
I debloated my phone on fw 442, build.prop and init.qcom.post_boot.sh tweaks and get 8-10 hrs SOT [without any cpu profile or underclock or vm tweaks!]
Without all of that, can get 5-6 hrs SOT too. (1-2 hrs play Clash Royal on LTE or 3G)
My Galaxy S6 get 4-5 hr on marshmallow and 5-6 on Lollipop.
I think for a LCD panel, not any problems at Sony battery consuming!
Can you share details about power usage for google play services? This is google fault not sony software!
---------- Post added at 07:03 PM ---------- Previous post was at 06:42 PM ----------
If you on stock fw without root check:
1- In Settings>Location click on 3dots menu an select "scan" then check wifi and blutooth scan is off?
2- don't use vibration at all (notifications and calls. touching display, keyboards, dialling, etc)
3- turn off auto-sync
4- turn off trust agent if do not use smart locks
5- turn off auto update for play store and firmware
6- check which app use data in background (and manage restriction for each of them)
7- at Settings>google>nearby, click on gear icon and turn of "nearby links" and "device ready to setup"
8- turn off "double touch to wake up" (optional)
i have the same issue on my Dual Sim Sony Xperia XZ. 8hrs idle and lost 15%. its same every day. Shame Sony!!! Its your flagship device.....
mzeshanhakeem said:
i have the same issue on my Dual Sim Sony Xperia XZ. 8hrs idle and lost 15%. its same every day. Shame Sony!!! Its your flagship device.....
Click to expand...
Click to collapse
It's easy to blame Sony when a simple change in your settings can make a huge difference in power consumption while the phone is idle.
Maybe you should check this rom if sony's stock software doesn't satisfy you https://forum.xda-developers.com/xperia-xz/development/duality-rom-legendary-battery-beta-t3574300
I'm on my way to 11h of SoT with moderate use, play services together to idle struggle to get to 20% after two days.
GenomeX said:
I debloated my phone on fw 442, build.prop and init.qcom.post_boot.sh tweaks and get 8-10 hrs SOT [without any cpu profile or underclock or vm tweaks!]
Without all of that, can get 5-6 hrs SOT too. (1-2 hrs play Clash Royal on LTE or 3G)
My Galaxy S6 get 4-5 hr on marshmallow and 5-6 on Lollipop.
I think for a LCD panel, not any problems at Sony battery consuming!
Can you share details about power usage for google play services? This is google fault not sony software!
---------- Post added at 07:03 PM ---------- Previous post was at 06:42 PM ----------
If you on stock fw without root check:
1- In Settings>Location click on 3dots menu an select "scan" then check wifi and blutooth scan is off?
2- don't use vibration at all (notifications and calls. touching display, keyboards, dialling, etc)
3- turn off auto-sync
4- turn off trust agent if do not use smart locks
5- turn off auto update for play store and firmware
6- check which app use data in background (and manage restriction for each of them)
7- at Settings>google>nearby, click on gear icon and turn of "nearby links" and "device ready to setup"
8- turn off "double touch to wake up" (optional)
Click to expand...
Click to collapse
Thanks alot... I did most of that, will monitor and let you know
Dears... and did you ever notice some cut in the notification sounds? especially whatsapp? ... random behaviour
Thanks,
for rooted user follow this tutrial for fix battery drain at android 7.0 fw...
open /system/etc/init.qcom.post_boot.sh and find this (method for msm8996)
Code:
case "$target" in
"msm8996")
# disable thermal bcl hotplug to switch governor
add red line:
Code:
echo 0 > /sys/module/msm_thermal/core_control/enabled
[COLOR="Red"]echo N > /sys/module/msm_thermal/parameters/enabled[/COLOR]
and
Code:
# Enable Adaptive LMK
echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
[COLOR="red"] # Configure virtual memory for battery drain
echo 500 > /proc/sys/vm/dirty_expire_centisecs
echo 3000 > /proc/sys/vm/dirty_writeback_centisecs
echo 100 > /proc/sys/vm/vfs_cache_pressure[/COLOR]
now find
Code:
echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
and change like this:
Code:
echo [COLOR="red"]100[/COLOR] > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
above # online cpu2
add this:
Code:
[COLOR="red"]echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down[/COLOR]
# online CPU2
above # Override with SOMC tuning parameters for governor
add this:
Code:
[COLOR="red"] echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/fast_ramp_down
# Disable touch-boost
echo 0 > /sys/module/msm_performance/parameters/touchboost[/COLOR]
# Override with SOMC tuning parameters for governor
now re-enable hotplug
Code:
# re-enable thermal and BCL hotplug
echo 1 > /sys/module/msm_thermal/core_control/enabled
[COLOR="red"] echo Y > /sys/module/msm_thermal/parameters/enabled[/COLOR]
==============================================================
now let's go to edit build.prop
end of the file add this:
Code:
#
# CUSTOM_BUILD_PROPERTIES
#
ro.ril.power_collapse=1
ro.ril.disable.power.collapse=0
ro.ril.fast.dormancy.rule=0
pm.sleep_mode=1
power.saving.mode=1
wifi.supplicant_scan_interval=180
windowsmgr.max_events_per_sec=90
persist.sys.scrollingcache=3
ro.media.enc.jpeg.quality=100
persist.sys.purgeable_assets=1
reboot and enjoy
GenomeX said:
for rooted user follow this tutrial for fix battery drain at android 7.0 fw...
open /system/etc/init.qcom.post_boot.sh and find this (method for msm8996)
Code:
case "$target" in
"msm8996")
# disable thermal bcl hotplug to switch governor
add red line:
Code:
echo 0 > /sys/module/msm_thermal/core_control/enabled
[COLOR="Red"]echo N > /sys/module/msm_thermal/parameters/enabled[/COLOR]
and
Code:
# Enable Adaptive LMK
echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
[COLOR="red"] # Configure virtual memory for battery drain
echo 500 > /proc/sys/vm/dirty_expire_centisecs
echo 3000 > /proc/sys/vm/dirty_writeback_centisecs
echo 100 > /proc/sys/vm/vfs_cache_pressure[/COLOR]
now find
Code:
echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
and change like this:
Code:
echo [COLOR="red"]100[/COLOR] > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
above # online cpu2
add this:
Code:
[COLOR="red"]echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down[/COLOR]
# online CPU2
above # Override with SOMC tuning parameters for governor
add this:
Code:
[COLOR="red"] echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/fast_ramp_down
# Disable touch-boost
echo 0 > /sys/module/msm_performance/parameters/touchboost[/COLOR]
# Override with SOMC tuning parameters for governor
now re-enable hotplug
Code:
# re-enable thermal and BCL hotplug
echo 1 > /sys/module/msm_thermal/core_control/enabled
[COLOR="red"] echo Y > /sys/module/msm_thermal/parameters/enabled[/COLOR]
==============================================================
now let's go to edit build.prop
end of the file add this:
Code:
#
# CUSTOM_BUILD_PROPERTIES
#
ro.ril.power_collapse=1
ro.ril.disable.power.collapse=0
ro.ril.fast.dormancy.rule=0
pm.sleep_mode=1
power.saving.mode=1
wifi.supplicant_scan_interval=180
windowsmgr.max_events_per_sec=90
persist.sys.scrollingcache=3
ro.media.enc.jpeg.quality=100
persist.sys.purgeable_assets=1
reboot and enjoy
Click to expand...
Click to collapse
nice to see that...looks like im going for root soon Thanks
GenomeX said:
for rooted user follow this tutrial for fix battery drain at android 7.0 fw...
open /system/etc/init.qcom.post_boot.sh and find this (method for msm8996)
Code:
case "$target" in
"msm8996")
# disable thermal bcl hotplug to switch governor
add red line:
Code:
echo 0 > /sys/module/msm_thermal/core_control/enabled
[COLOR="Red"]echo N > /sys/module/msm_thermal/parameters/enabled[/COLOR]
and
Code:
# Enable Adaptive LMK
echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
[COLOR="red"] # Configure virtual memory for battery drain
echo 500 > /proc/sys/vm/dirty_expire_centisecs
echo 3000 > /proc/sys/vm/dirty_writeback_centisecs
echo 100 > /proc/sys/vm/vfs_cache_pressure[/COLOR]
now find
Code:
echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
and change like this:
Code:
echo [COLOR="red"]100[/COLOR] > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
above # online cpu2
add this:
Code:
[COLOR="red"]echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down[/COLOR]
# online CPU2
above # Override with SOMC tuning parameters for governor
add this:
Code:
[COLOR="red"] echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/fast_ramp_down
# Disable touch-boost
echo 0 > /sys/module/msm_performance/parameters/touchboost[/COLOR]
# Override with SOMC tuning parameters for governor
now re-enable hotplug
Code:
# re-enable thermal and BCL hotplug
echo 1 > /sys/module/msm_thermal/core_control/enabled
[COLOR="red"] echo Y > /sys/module/msm_thermal/parameters/enabled[/COLOR]
==============================================================
now let's go to edit build.prop
end of the file add this:
Code:
#
# CUSTOM_BUILD_PROPERTIES
#
ro.ril.power_collapse=1
ro.ril.disable.power.collapse=0
ro.ril.fast.dormancy.rule=0
pm.sleep_mode=1
power.saving.mode=1
wifi.supplicant_scan_interval=180
windowsmgr.max_events_per_sec=90
persist.sys.scrollingcache=3
ro.media.enc.jpeg.quality=100
persist.sys.purgeable_assets=1
reboot and enjoy
Click to expand...
Click to collapse
I do this thing but the result is the same at before. I must wait some cycle of charge? I copy the files on pc and i do this things there and then i replace those files in their directory
djgigi94 said:
I do this thing but the result is the same at before. I must wait some cycle of charge? I copy the files on pc and i do this things there and then i replace those files in their directory
Click to expand...
Click to collapse
Maybe one of your third-party app call google play services.
Reboot to safe mode and see is the problem still alive.
When writing this comment, I am on 67% battery and Play Services only drain 3%, android system only 7%!
I get 2hr sot (%36 drain)
play Asphalt8 for 45min (set on hi-graphic)
surface web with chrome for 30min
telegram for 10min
Instagram for 10min
7min call with SIM1 (gsm) and my SIM2 is on LTE when use social networking and web browsing.
I think this is where good battery life for a flagship smartphone with same useage.
I never problem with Standby; (becuse i use my phone always LOL)
Try (okey try if i can LOL) to change my useage and live the phone alone for few hours (really hard job for a internet lover you know) and share with you: is phone idle really a problem or not?
You can see i have not any battery drain problem with 7.0 firmware
http://uupload.ir/files/m6hi__20170406_065247.jpg
I use my phone from 100-95 (4G network) before sleep, after wakeup drain only 1%, 8hrs idle. (the 4G network was on)
** consider i debloated my phone too. Maybe some Sony or third-party apps may the real problem, not fault of play services or android 7.0 or kernel codes! (Pixel, HTC10, Moto Z, are normal with 7.x. Deep customized android firmware like Xperia X, XZ and Galaxy S6,S7 have issue)
*** use cpu monitoring apps to find cpu deep sleeping work correct and whiche services wakeup processor in background.
the strange thing here... after some days of phone usage, the phone seems to learn my usage. now battery takes hell of time before it drains! which is good
I don't see the point of having to turn off some settings in order to get by 5-6 hours of SOT...you shouldn't have to do that with phones in 2017.
I wish I could root my Japanese XZ, but I'd lost my mobile payments and that is too valuable.

Prevent my phone from being awake while charging

Hello everyone,
I have used so many times the XDA forums to find some answers and I have found mostly all the answers I needed on other threads. But for once, I might have a more complicated problem to submit to the experts on this forum.
My use case is to create the lightest app that can do a job (namely taking a picture) on a regular interval of time and consume the least battery possible to be able to run for the most time without external power source (that is to say, the phone plugged in a wall outlet).
From what I experienced so far, I managed to have my application run for about 10 straight days doing the job every 10 minutes on a rooted Moto G5 phone. To achieve this, I force the phone to go in Doze mode at the beggining, by calling :
Code:
dumpsys deviceidle force-idle
Doing that, I schedule my jobs using the AlarmManager with the "setExactAndAllowWhileIdle" method thus respecting the super-9 minutes window my alarms should respect in order to be triggered correctly while the phone gets in deep sleep (following the official documentation).
For the moment, this is working as expected, because when I make a bugreport and import it into the Battery Historian tool, I can see that the phone is awake only when my job is running (for around 1 minute) and all the rest of the time, the device is sleeping and even better when I look in logcat, the phone suspends the CPU's for most of the time, which is great to consume less battery when not needed.
Now comes my problem, in order to make the app run for a longer period of time without having a wall outlet nearby, AND without touching the phone, I want to extend my battery life by using an external power bank plugged into my phone. My problem is that I cannot manage to make the phone not be awake while charging the phone. I guess that the phone is keeping some kind of wakelock when charging, so the USB connection keeps the phone awake and make my phone consume 3x more than when it goes in deep sleep, suspending the CPUs and is not awake. I tried to put some flags in a lot of files in order to trick the phone to think nothing is connected to the USB port but it didn't work. I tried those files:
Code:
"echo 0 > /sys/class/power_supply/battery/charging_enabled"
"echo 0 > /sys/devices/virtual/android_usb/android0/enable"
"echo 0 > /sys/class/power_supply/usb/present"
"echo 0 > /sys/class/power_supply/usb/ch_present"
"echo 0 > /sys/class/power_supply/usb/online"
"echo 0 > /sys/class/android_usb/android0/enable"
"echo 0 > /sys/class/android_usb/android0/remote_wakeup"
The only thing that stops the charge is when I put a 0 in the following file:
Code:
"echo 0 > /sys/class/power_supply/battery/charging_enabled"
It effectively stops the charge but the CPUs are still in an "awake" state, meaning there is probably still a wakelock being kept.
Do you have any idea how can I do, only using software, other than what I tried to stop the phone from being awake while having a charger plugged in (even if not charging) ?
Thanks a lot in advance for your answers.
Hi,
I am Aurelien, a colleague of Rafouuuuuu. Some precisions:
We use a "always-on" battery.
Phone awake = cpu is not stopped.
According to the historian report, the wakeup reason is "unknown".
These lines:
Code:
"echo 0 > /sys/class/power_supply/usb/present"
"echo 0 > /sys/class/power_supply/usb/ch_present"
"echo 0 > /sys/class/power_supply/usb/online"
"echo 0 > /sys/class/android_usb/android0/enable"
disable usb connection and charge but the cpu is always on.
We try to stop adbd service (if adbd get a wakelock if usb plugged)
We try to disable developer option.

[Script] Raspberry 3 Image that stops charging your phone after it reaches xx percent

Hi Forum!
I have recently installed AccuBattery and faced the problem of overnight charging and stopping at 80% without a rooted phone. After some tinkering, I figured out that on a Raspberry Pi 3 I can turn off the USB power and I can also query the battery percentage via adb. Combining both, I was able to put together a script that reads the percentage every minute and stops charging for 30 minutes as soon as 80% is reached.
The script itself is quite simple
Code:
#!/bin/bash
THRESHOLD=80
PAUSE=30
LEVEL=`adb shell dumpsys battery | grep " level" | rev | cut -d" " -f1 | rev`
if [ $LEVEL -gt $THRESHOLD ]; then
shutdown -r $PAUSE
echo '1-1' | tee /sys/bus/usb/drivers/usb/unbind
fi
Now, I can only test that with the phones I have available and it works nicely with my Oneplus 6 and satisfacotry with my Moto G5. A full howto and a shortcut (just a sd card image) are available here:
https://metabubble.net/android/how-...roid-when-a-certain-battery-level-is-reached/
I would love to hear your comments about that. Is there a better solution for non-root users? (Did I even waste a lot of time because something like that existed?) Please let me know.

Categories

Resources