Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,15 @@ fun DetailPaneSystemUI(
onEvent(SystemUIEvent.AOD.HideAODStatusBar(it))
}
)
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.light_mode),
title = stringResource(id = R.string.removeAODBrightnessLimit_title),
summary = stringResource(id = R.string.removeAODBrightnessLimit_summary),
checked = uiState.aod.removeAODBrightnessLimit,
onCheckedChange = {
onEvent(SystemUIEvent.AOD.RemoveAODBrightnessLimit(it))
}
)
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.today),
title = stringResource(id = R.string.aodLockSupportLunar_title),
Expand Down Expand Up @@ -1160,6 +1169,8 @@ sealed interface SystemUIEvent {

@JvmInline
value class HideAODStatusBar(val value: Boolean) : AOD
@JvmInline
value class RemoveAODBrightnessLimit(val value: Boolean) : AOD

@JvmInline
value class AODLockSupportLunar(val value: Boolean) : AOD
Expand Down Expand Up @@ -1749,6 +1760,16 @@ private fun SettingViewModel.onAODEvent(event: SystemUIEvent.AOD) {
)
}

is SystemUIEvent.AOD.RemoveAODBrightnessLimit -> {
preference.copy(
systemUI = preference.systemUI.copy(
aod = preference.systemUI.aod.copy(
removeAODBrightnessLimit = event.value
)
)
)
}

is SystemUIEvent.AOD.AODLockSupportLunar -> {
preference.copy(
systemUI = preference.systemUI.copy(
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<string name="aodWallpaperOnly_title">Afficher uniquement le fond d’écran sur l’AOD</string>
<string name="aodWallpaperOnly_summary">Afficher uniquement le fond d’écran sur l’AOD sans modifier l’écran de verrouillage normal. Activez le fond d’écran de verrouillage dans les paramètres AOD. Pour l’icône d’empreinte, accédez à Paramètres → Écran de verrouillage et AOD → Verrouillage de l’écran et biométrie → Empreintes → Afficher l’icône lorsque l’écran est éteint, puis sélectionnez « Appuyer pour afficher » ou « Jamais ». Redémarrez l’interface système pour appliquer les modifications.</string>
<string name="hideAODStatusBar_title">Masquer la barre d\'état sur l\'AOD</string>
<string name="removeAODBrightnessLimit_title">Supprimer la limite de luminosité de l\'AOD</string>
<string name="removeAODBrightnessLimit_summary">La luminosité de l\'AOD suit celle du système. Redémarrez System UI pour appliquer.</string>
<string name="hideAODChargingInfo_title">Masquer les informations de charge sur l\'AOD</string>
<string name="aodLockSupportLunar_title">Afficher le calendrier lunaire chinois sur l\'AOD</string>
<string name="enableChineseHolidayDisplay_title">Afficher les jours fériés chinois dans le calendrier</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<string name="aodWallpaperOnly_title">AOD에 배경화면만 표시</string>
<string name="aodWallpaperOnly_summary">일반 잠금화면은 변경하지 않고 AOD에 배경화면만 표시합니다. 시스템 AOD 설정에서 잠금화면 배경화면 표시를 켜세요. 지문 아이콘은 설정 → 잠금화면 및 AOD → 화면 잠금 및 생체 인식 → 지문 → 화면이 꺼져 있을 때 아이콘 표시에서 “눌러서 표시” 또는 “표시 안 함”을 선택하세요. 적용하려면 시스템 UI를 다시 시작하세요.</string>
<string name="hideAODStatusBar_title">AOD 상태바 숨기기</string>
<string name="removeAODBrightnessLimit_title">AOD 밝기 제한 해제</string>
<string name="removeAODBrightnessLimit_summary">AOD 밝기가 시스템 밝기를 따릅니다. 적용하려면 System UI를 다시 시작하세요.</string>
<string name="hideAODChargingInfo_title">AOD 충전 정보 숨기기</string>
<string name="aodLockSupportLunar_title">AOD/잠금 화면에 음력 표시</string>
<string name="enableChineseHolidayDisplay_title">캘린더에 중국 공휴일 표시</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<string name="aodWallpaperOnly_title">Только обои на AOD</string>
<string name="aodWallpaperOnly_summary">Показывать на AOD только обои, не изменяя обычный экран блокировки. Включите отображение обоев экрана блокировки в настройках AOD. Для значка отпечатка пальца откройте: Настройки → Экран блокировки и AOD → Блокировка экрана и биометрия → Отпечатки пальцев → Показывать значок при выключенном экране, затем выберите «Касание для отображения» или «Никогда». Для применения перезапустите интерфейс системы.</string>
<string name="hideAODStatusBar_title">Скрыть строку состояния на AOD</string>
<string name="removeAODBrightnessLimit_title">Снять ограничение яркости AOD</string>
<string name="removeAODBrightnessLimit_summary">Яркость AOD будет следовать системной яркости. Перезапустите System UI для применения.</string>
<string name="hideAODChargingInfo_title">Скрыть информацию о зарядке на AOD</string>
<string name="aodLockSupportLunar_title">Лунный календарь на AOD и экране блокировки</string>
<string name="enableChineseHolidayDisplay_title">Китайские праздники в календаре</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<string name="aodWallpaperOnly_title">息屏提醒仅显示壁纸</string>
<string name="aodWallpaperOnly_summary">仅保留息屏壁纸,不影响亮屏锁屏。需在系统息屏提醒设置中开启锁屏壁纸。指纹图标请前往:设置 → 锁定屏幕和息屏提醒 → 屏幕锁定和生物识别 → 指纹 → 屏幕关闭时显示图标,选择“点击来显示”或“从不”。重启系统 UI 后生效。</string>
<string name="hideAODStatusBar_title">隐藏息屏提醒的状态栏</string>
<string name="removeAODBrightnessLimit_title">移除息屏提醒亮度限制</string>
<string name="removeAODBrightnessLimit_summary">息屏提醒亮度跟随系统亮度。重启系统 UI 后生效。</string>
<string name="hideAODChargingInfo_title">隐藏息屏提醒的充电信息</string>
<string name="aodLockSupportLunar_title">息屏提醒显示中国农历</string>
<string name="enableChineseHolidayDisplay_title">日历中显示中国节假日</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<string name="aodWallpaperOnly_title">Wallpaper-only AOD</string>
<string name="aodWallpaperOnly_summary">Show only the AOD wallpaper without changing the normal lock screen. Enable lock screen wallpaper in AOD settings. For the fingerprint icon, go to Settings → Lock screen and AOD → Screen lock and biometrics → Fingerprints → Show icon when screen is off, and select “Tap to show” or “Never”. Restart System UI to apply.</string>
<string name="hideAODStatusBar_title">Hide AOD status bar</string>
<string name="removeAODBrightnessLimit_title">Remove AOD brightness limit</string>
<string name="removeAODBrightnessLimit_summary">Let AOD brightness follow the system brightness. Restart System UI to take effect.</string>
<string name="hideAODChargingInfo_title">Hide AOD charging information</string>
<string name="aodLockSupportLunar_title">Show Chinese Lunar calendar on AOD/Lock screen</string>
<string name="enableChineseHolidayDisplay_title">Show Chinese holidays in Calendar</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ data class Preference(
val hideAODStatusBar: Boolean = false,
val hideAODChargingInfo: Boolean = false,
val aodLockSupportLunar: Boolean = false,
val removeAODBrightnessLimit: Boolean = false,
)

@Serializable
Expand Down
4 changes: 4 additions & 0 deletions hook/src/main/java/io/github/soclear/oneuix/hook/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ class Main : XposedModule() {
AOD.hideAODStatusBar()
}

if (preference.systemUI.aod.removeAODBrightnessLimit) {
AOD.removeAODBrightnessLimit()
}

if (preference.systemUI.aod.aodLockSupportLunar) {
AOD.aodLockSupportLunar()
}
Expand Down
25 changes: 25 additions & 0 deletions hook/src/main/java/io/github/soclear/oneuix/hook/systemui/AOD.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package io.github.soclear.oneuix.hook.systemui
import android.annotation.SuppressLint
import android.graphics.Canvas
import android.os.Build
import android.provider.Settings
import android.view.View
import android.view.ViewGroup
import io.github.libxposed.api.XposedInterface
import io.github.libxposed.api.XposedModule
import io.github.soclear.oneuix.hook.util.afterAttachTry
import io.github.soclear.oneuix.hook.util.currentApplication
import io.github.soclear.oneuix.hook.util.reflect
import io.github.soclear.oneuix.hook.util.xlog

Expand Down Expand Up @@ -99,4 +101,27 @@ object AOD {
xposedModule.hook(method).intercept(hooker)
}
}

context(xposedModule: XposedModule)
fun removeAODBrightnessLimit() = afterAttachTry {
classLoader.loadClass("com.android.systemui.doze.AODScreenBrightness")
.getDeclaredMethod("updateDozeBrightness", Int::class.java, Int::class.java, Int::class.java)
.let { xposedModule.hook(it) }
.intercept { chain ->
try {
val min = runCatching { chain.thisObject.reflect["brightnessMin"] as? Int }.getOrNull() ?: 1
val max = runCatching { chain.thisObject.reflect["brightnessMax"] as? Int }.getOrNull() ?: 255
val resolver = currentApplication()?.contentResolver
val current = resolver?.let { Settings.System.getInt(it, "screen_brightness", -1) } ?: -1
if (current > 0) {
val newArgs = chain.args.toTypedArray()
newArgs[2] = current.coerceIn(min, max)
return@intercept chain.proceed(newArgs)
}
} catch (t: Throwable) {
xlog(t)
}
chain.proceed()
}
}
}
Loading