commit 380e50e2683feee4e903e9bcf59ed2699686a3d5 Author: Wang Zhiyu Date: Mon Jul 20 07:31:05 2026 +0800 upload scripts diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..72ba701 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# 1.0.0 + +* Initial release diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..28b48e5 --- /dev/null +++ b/META-INF/com/google/android/update-binary @@ -0,0 +1,33 @@ +#!/sbin/sh + +################# +# Initialization +################# + +umask 022 + +# echo before loading util_functions +ui_print() { echo "$1"; } + +require_new_magisk() { + ui_print "*******************************" + ui_print " Please install Magisk v20.4+! " + ui_print "*******************************" + exit 1 +} + +######################### +# Load util_functions.sh +######################### + +OUTFD=$2 +ZIPFILE=$3 + +mount /data 2>/dev/null + +[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk +. /data/adb/magisk/util_functions.sh +[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk + +install_module +exit 0 diff --git a/META-INF/com/google/android/updater-script b/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..11d5c96 --- /dev/null +++ b/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/README.md b/README.md new file mode 100644 index 0000000..eb1cbf0 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Minimum Brightness for OnePlus Turbo 6X + +This module ensures the screen brightness of the phone does not go below 1, +to prevent screen from failing to turn back on under LineageOS GSI. + +thanks to https://github.com/agross/poco-x5-pro-5g-min-brightness diff --git a/customize.sh b/customize.sh new file mode 100644 index 0000000..66c9abe --- /dev/null +++ b/customize.sh @@ -0,0 +1,2 @@ +ui_print "Making $MODPATH/min-brightness.sh executable" +set_perm "$MODPATH/min-brightness.sh" 0 0 0755 diff --git a/min-brightness.sh b/min-brightness.sh new file mode 100644 index 0000000..a53286c --- /dev/null +++ b/min-brightness.sh @@ -0,0 +1,13 @@ +#!/system/bin/sh + +# This script checks the current brightness ensures a minimum brightness of 2. +# This prevents the black screen if the brightness is 1(screen_brightness). + +BRIGHTNESS_FILE=/sys/devices/platform/mtk-leds/leds/lcd-backlight/brightness +BRIGHTNESS="$(cat "$BRIGHTNESS_FILE")" + +if [ "$BRIGHTNESS" -lt 15 ]; then + settings put system screen_brightness 2 +fi + +exit 0 diff --git a/module.prop b/module.prop new file mode 100644 index 0000000..911091a --- /dev/null +++ b/module.prop @@ -0,0 +1,7 @@ +id=oneplus-turbo-6x-min-brightness +version=1.0.0 +versionCode=1 +name=OnePlus Turbo 6X Minimum Brightness +author=pluvium27 @ GitHub +description=Enforces minimum screen brightness on OnePlus Turbo 6X to prevent black screen +support=https://github.com/pluvium27/oneplus-turbo-6x-min-brightness/issues diff --git a/service.sh b/service.sh new file mode 100644 index 0000000..94f6a5d --- /dev/null +++ b/service.sh @@ -0,0 +1,25 @@ +#!/system/bin/sh + +# Do NOT assume where your module will be located. ALWAYS use $MODDIR if you +# need to know where this script and module is placed. This will make sure your +# module will work if Magisk changes it's mount point in the future. +MODDIR="${0%/*}" + +BRIGHTNESS_FILE=/sys/devices/platform/mtk-leds/leds/lcd-backlight/brightness +BRIGHTNESS_SCRIPT="$MODDIR/min-brightness.sh" + +until [ "$(getprop sys.boot_completed)" = 1 ] && \ + [ "$(getprop dev.bootcomplete)" = 1 ] && \ + [ "$(getprop service.bootanim.exit)" = 1 ] && \ + [ "$(getprop init.svc.bootanim)" = stopped ]; do + sleep 5 +done + +# Monitor writes to $BRIGHTNESS_FILE and call $BRIGHTNESS_SCRIPT. + +while true; do + /system/bin/sh "$BRIGHTNESS_SCRIPT" + sleep 2 +done + +exit 0