Skip to content

Commit 9d4d91e

Browse files
committed
Update Lite Mode Props and Logic,
> Removed Disable Vsync > Added Renderer Props > Update Bypass charge compatibility checks
1 parent 018c6dc commit 9d4d91e

2 files changed

Lines changed: 97 additions & 73 deletions

File tree

tweakfls/sys.azenith-profilesettings.sh

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,9 @@ CONFIGPATH="/data/adb/.config/AZenith"
2626
list_logger="logd traced statsd tcpdump cnss_diag subsystem_ramdump charge_logger wlan_logging"
2727
curprofile=$(<"$CONFIGPATH/API/current_profile")
2828
POLICIES=$(ls /sys/devices/system/cpu/cpufreq | grep policy)
29-
BYPASSPATHLIST="
30-
MTK_BYPASS_CHARGER:/sys/devices/platform/charger/bypass_charger
31-
MTK_CURRENT_CMD:/proc/mtk_battery_cmd/current_cmd
32-
TRAN_AICHG:/sys/devices/platform/charger/tran_aichg_disable_charger
33-
MTK_DISABLE_CHARGER:/sys/devices/platform/mt-battery/disable_charger
34-
"
3529

3630
# Properties
3731
LIMITER=$(getprop persist.sys.azenithconf.freqoffset | sed -e 's/Disabled/100/' -e 's/%//g')
38-
DND_STATE="$(getprop persist.sys.azenithconf.dnd)"
3932
LOGD_STATE="$(getprop persist.sys.azenithconf.logd)"
4033
DEBUGMODE="$(getprop persist.sys.azenith.debugmode)"
4134
DTHERMAL_STATE="$(getprop persist.sys.azenithconf.DThermal)"
@@ -47,7 +40,7 @@ JUSTINTIME_STATE="$(getprop persist.sys.azenithconf.justintime)"
4740
BYPASSCHG_STATE="$(getprop persist.sys.azenithconf.bypasschg)"
4841
DISTRACE_STATE="$(getprop persist.sys.azenithconf.disabletrace)"
4942
CLEARAPPS="$(getprop persist.sys.azenithconf.clearbg)"
50-
LITEMODE="$(getprop persist.sys.azenithconf.cpulimit)"
43+
LITEMODE="$(getprop persist.sys.azenithconf.litemode)"
5144
VSYNCVALUE="$(getprop persist.sys.azenithconf.vsync)"
5245
BYPASSPROPS="persist.sys.azenithconf.bypasspath"
5346
BYPASSPATH="$(getprop persist.sys.azenithconf.bypasspath)"
@@ -1099,12 +1092,7 @@ performance_profile() {
10991092
else
11001093
setsGPUMali "$default_maligov" && dlog "Applying GPU Mali Governor to : $default_maligov"
11011094
fi
1102-
fi
1103-
1104-
# Set DND Mode
1105-
if [ "$DND_STATE" -eq 1 ]; then
1106-
cmd notification set_dnd priority && dlog "DND enabled" || dlog "Failed to enable DND"
1107-
fi
1095+
fi
11081096

11091097
# Bypass Charge
11101098
if [ "$BYPASSCHG_STATE" -eq 1 ]; then
@@ -1260,12 +1248,7 @@ balanced_profile() {
12601248
default_maligov=$(load_default_gpumaligov)
12611249
setsGPUMali "$default_maligov" && dlog "Applying GPU Mali Governor to : $default_maligov"
12621250
fi
1263-
1264-
# Disable DND
1265-
if [ "$DND_STATE" -eq 1 ]; then
1266-
cmd notification set_dnd off && dlog "DND disabled" || dlog "Failed to disable DND"
1267-
fi
1268-
1251+
12691252
# Bypass Charge
12701253
if [ "$BYPASSCHG_STATE" -eq 1 ]; then
12711254
sys.azenith-utilityconf disableBypass
@@ -1343,15 +1326,14 @@ balanced_profile() {
13431326
zeshia TTWU_QUEUE /sys/kernel/debug/sched_features
13441327
fi
13451328

1346-
if [ "$LITEMODE" -eq 0 ]; then
1347-
case "$(getprop persist.sys.azenithdebug.soctype)" in
1348-
1) mediatek_balance ;;
1349-
2) snapdragon_balance ;;
1350-
3) exynos_balance ;;
1351-
4) unisoc_balance ;;
1352-
5) tensor_balance ;;
1353-
esac
1354-
fi
1329+
case "$(getprop persist.sys.azenithdebug.soctype)" in
1330+
1) mediatek_balance ;;
1331+
2) snapdragon_balance ;;
1332+
3) exynos_balance ;;
1333+
4) unisoc_balance ;;
1334+
5) tensor_balance ;;
1335+
esac
1336+
13551337

13561338
AZLog "Balanced Profile applied successfully!"
13571339

@@ -1406,11 +1388,6 @@ eco_mode() {
14061388
setfreq
14071389
fi
14081390
dlog "Set CPU freq to low Frequencies"
1409-
1410-
# Disable DND
1411-
if [ "$DND_STATE" -eq 1 ]; then
1412-
cmd notification set_dnd off && dlog "DND disabled" || dlog "Failed to disable DND"
1413-
fi
14141391

14151392
# Bypass Charge
14161393
if [ "$BYPASSCHG_STATE" -eq 1 ]; then
@@ -2191,29 +2168,7 @@ initialize() {
21912168
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
21922169
# INITIALIZE BYPASS CHARGING PATH
21932170
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
2194-
if [ -z "$BYPASSPATH" ]; then
2195-
supported=0
2196-
while IFS=":" read -r name path; do
2197-
[ -z "$name" ] && continue
2198-
2199-
name="${name//[[:space:]]/}"
2200-
path="${path//[[:space:]]/}"
2201-
2202-
if [ -e "$path" ]; then
2203-
setprop "$BYPASSPROPS" "$name"
2204-
dlog "Detected Bypass Charging path: $name"
2205-
supported=1
2206-
break
2207-
fi
2208-
done <<< "$BYPASSPATHLIST"
2209-
2210-
if [ "$supported" -eq 0 ]; then
2211-
dlog "Bypass Charging unsupported: no valid path found"
2212-
setprop "$BYPASSPROPS" "UNSUPPORTED"
2213-
fi
2214-
else
2215-
dlog "Bypass Charging path set: $BYPASSPATH"
2216-
fi
2171+
sys.azenith-utilityconf checkBypass
22172172

22182173
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
22192174
# APPLY DISABLE VSYNC IF AVAILABLE

tweakfls/sys.azenith-utilityconf.sh

Lines changed: 85 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CONFIGPATH="/data/adb/.config/AZenith"
2525
# Properties
2626
DEBUGMODE="$(getprop persist.sys.azenith.debugmode)"
2727
BYPASSPATH="$(getprop persist.sys.azenithconf.bypasspath)"
28+
BYPASSPROPS="persist.sys.azenithconf.bypasspath"
2829
FSTRIM_STATE="$(getprop persist.sys.azenithconf.fstrim)"
2930

3031
# Bypass Charging Path
@@ -44,6 +45,13 @@ MTK_DISABLE_CHARGER="/sys/devices/platform/mt-battery/disable_charger"
4445
MTK_DISABLE_CHARGER_ON="1"
4546
MTK_DISABLE_CHARGER_OFF="0"
4647

48+
BYPASSPATHLIST="
49+
MTK_BYPASS_CHARGER:/sys/devices/platform/charger/bypass_charger
50+
MTK_CURRENT_CMD:/proc/mtk_battery_cmd/current_cmd
51+
TRAN_AICHG:/sys/devices/platform/charger/tran_aichg_disable_charger
52+
MTK_DISABLE_CHARGER:/sys/devices/platform/mt-battery/disable_charger
53+
"
54+
4755
# Logging Functions
4856
AZLog() {
4957
if [ "$DEBUGMODE" = "true" ]; then
@@ -149,24 +157,34 @@ FSTrim() {
149157
fi
150158
}
151159

152-
disablevsync() {
160+
enableDND() {
161+
cmd notification set_dnd priority && dlog "DND enabled" || dlog "Failed to enable DND"
162+
}
163+
164+
disableDND() {
165+
cmd notification set_dnd off && dlog "DND disabled" || dlog "Failed to disable DND"
166+
}
167+
168+
setrefreshrates() {
169+
settings put system peak_refresh_rate $1
170+
settings put system min_refresh_rate $1.0
171+
dlog "Set current refresh rates to: $1hz"
172+
}
173+
174+
setrender() {
153175
case "$1" in
154-
60hz)
155-
service call SurfaceFlinger 1035 i32 2
156-
dlog "Applied 60hz DisableVsync"
157-
;;
158-
90hz)
159-
service call SurfaceFlinger 1035 i32 1
160-
dlog "Applied 90hz DisableVsync"
161-
;;
162-
120hz)
163-
service call SurfaceFlinger 1035 i32 0
164-
dlog "Applied 120hz DisableVsync"
165-
;;
166-
Disabled)
167-
echo "disabled"
168-
;;
176+
vulkan)
177+
setprop debug.hwui.renderer skiavk
178+
;;
179+
skiagl)
180+
setprop debug.hwui.renderer skiagl
181+
;;
182+
*)
183+
# system default → jangan sentuh renderer
184+
return
185+
;;
169186
esac
187+
dlog "Set current renderer to: $1"
170188
}
171189

172190
# Read current ampere
@@ -247,6 +265,57 @@ disableBypass() {
247265
dlog "Bypass charge disabled"
248266
}
249267

268+
checkBypass() {
269+
if ! ischarging; then
270+
dlog "Skipping bypass compatibility check: device not charging"
271+
return 0
272+
fi
273+
274+
[ -n "$BYPASSPATH" ] && {
275+
dlog "Bypass Charging path already set: $BYPASSPATH"
276+
return 0
277+
}
278+
279+
supported=0
280+
281+
while IFS=":" read -r name path; do
282+
[ -z "$name" ] && continue
283+
284+
name="${name//[[:space:]]/}"
285+
path="${path//[[:space:]]/}"
286+
287+
[ ! -e "$path" ] && continue
288+
289+
on_key="${name}_ON"
290+
off_key="${name}_OFF"
291+
on_val="$(eval echo \${$on_key})"
292+
off_val="$(eval echo \${$off_key})"
293+
294+
dlog "Testing bypass charging path: $name"
295+
296+
zeshia "$on_val" "$path"
297+
sleep 1
298+
299+
cur_ma="$(read_current_ma)"
300+
dlog "Charging current: ${cur_ma}mA"
301+
302+
zeshia "$off_val" "$path"
303+
sleep 1
304+
305+
if [ "$cur_ma" -lt 10 ]; then
306+
dlog "Bypass Charging SUPPORTED via $name"
307+
setprop "$BYPASSPROPS" "$name"
308+
BYPASSPATH="$name"
309+
supported=1
310+
return 0
311+
fi
312+
done <<< "$BYPASSPATHLIST"
313+
314+
dlog "Bypass Charging unsupported: no effective path found"
315+
setprop "$BYPASSPROPS" "UNSUPPORTED"
316+
return 1
317+
}
318+
250319
saveLog() {
251320
log_file="/sdcard/AZenithLog_$(date +"%Y-%m-%d_%H-%M").txt"
252321
echo "$log_file"

0 commit comments

Comments
 (0)