diff --git a/README.md b/README.md
index f33472ef..712aa475 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,7 @@
- 自定义关机菜单按钮(包括软重启)
- 隐藏锁屏紧急呼叫按钮
+- 滑动后再进行人脸解锁
- 禁用截图声音
- 隐藏所选音乐应用的实时活动和媒体通知
- 允许所有旋转角度
@@ -269,6 +270,7 @@
- Customize power menu actions (including soft reboot)
- Hide the lock screen emergency call button
+- Defer face unlock until swipe
- Disable screenshot sound
- Hide ongoing media activity and media notifications for selected apps
- Allow all rotation angles
diff --git a/app/src/main/java/io/github/soclear/oneuix/ui/category/DetailPaneSystemUI.kt b/app/src/main/java/io/github/soclear/oneuix/ui/category/DetailPaneSystemUI.kt
index 105e9e78..13c5e55a 100644
--- a/app/src/main/java/io/github/soclear/oneuix/ui/category/DetailPaneSystemUI.kt
+++ b/app/src/main/java/io/github/soclear/oneuix/ui/category/DetailPaneSystemUI.kt
@@ -910,6 +910,17 @@ fun DetailPaneSystemUI(
checked = uiState.other.hideLockscreenEmergencyButton,
onCheckedChange = { onEvent(SystemUIEvent.Other.HideLockscreenEmergencyButton(it)) }
)
+ if (ONE_UI_VERSION >= 80500) {
+ SwitchItem(
+ icon = ImageVector.vectorResource(id = R.drawable.lock_open),
+ title = stringResource(R.string.deferFaceUnlockUntilSwipe_title),
+ summary = stringResource(R.string.deferFaceUnlockUntilSwipe_summary),
+ checked = uiState.other.deferFaceUnlockUntilSwipe,
+ onCheckedChange = {
+ onEvent(SystemUIEvent.Other.DeferFaceUnlockUntilSwipe(it))
+ }
+ )
+ }
}
}
@@ -1205,6 +1216,9 @@ sealed interface SystemUIEvent {
@JvmInline
value class DisableScreenshotCaptureSound(val value: Boolean) : Other
+
+ @JvmInline
+ value class DeferFaceUnlockUntilSwipe(val value: Boolean) : Other
}
}
@@ -1877,6 +1891,16 @@ private fun SettingViewModel.onOtherEvent(event: SystemUIEvent.Other) {
)
)
}
+
+ is SystemUIEvent.Other.DeferFaceUnlockUntilSwipe -> {
+ preference.copy(
+ systemUI = preference.systemUI.copy(
+ other = preference.systemUI.other.copy(
+ deferFaceUnlockUntilSwipe = event.value
+ )
+ )
+ )
+ }
}
}
}
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 0d9edc9f..68332b65 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -242,6 +242,8 @@
Mode portrait uniquement. Conserve la hauteur de la barre d’état et les marges des applications.
Masquer le bouton d’appel d’urgence sur l’écran de verrouillage
Supprime le raccourci d’appel d’urgence de l’écran de déverrouillage et rend les appels d’urgence moins accessibles.
+ Déverrouillage facial après balayage
+ Ne pas lancer la reconnaissance faciale avant le balayage de l\'écran de verrouillage
Modifier la marge inférieure du dock de l’écran d’accueil
Téléphones en mode portrait : %1$.1f dp. Réglez sur 0 pour supprimer la marge inférieure. Peut chevaucher la zone des gestes.
Page média avec application (expérimental)
diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml
index 1db34a1a..7c1d30a6 100644
--- a/app/src/main/res/values-ko/strings.xml
+++ b/app/src/main/res/values-ko/strings.xml
@@ -242,6 +242,8 @@
세로 모드에서만 적용됩니다. 상태바 높이와 앱의 상단 여백은 유지됩니다.
잠금 화면 긴급 전화 버튼 숨기기
잠금 해제 화면의 긴급 전화 바로가기를 제거하여 긴급 전화 접근이 어려워집니다.
+ 스와이프 후 얼굴 잠금 해제
+ 잠금 화면을 스와이프할 때까지 얼굴 인식을 시작하지 않음
홈 화면 하단 독 여백 변경
휴대전화 세로 모드: %1$.1f dp. 0으로 설정하면 하단 여백이 제거됩니다. 제스처 영역과 겹칠 수 있습니다.
앱 미디어 페이지 (실험 기능)
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 6d7aa4fa..0149db00 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -242,6 +242,8 @@
Только в портретном режиме. Высота строки состояния и отступы приложений сохраняются.
Скрыть кнопку экстренного вызова на экране блокировки
Удаляет ярлык экстренного вызова с экрана разблокировки, затрудняя доступ к экстренному набору.
+ Разблокировка лицом после свайпа
+ Не запускать распознавание лица до свайпа по экрану блокировки
Изменить нижний отступ док-панели главного экрана
Телефоны в портретном режиме: %1$.1f dp. Установите 0, чтобы убрать нижний отступ. Возможно перекрытие области жестов.
Приложение на медиастранице (экспериментально)
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index f7f7a878..fb30d5c0 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -242,6 +242,8 @@
仅竖屏生效,保留状态栏原高度和应用顶部避让区域
隐藏锁屏紧急呼叫按钮
移除解锁界面的紧急呼叫快捷入口,会降低紧急拨号的便捷性。
+ 滑动后再进行人脸解锁
+ 在滑动锁屏之前不启动人脸识别
修改桌面底部栏下边距
手机竖屏:%1$.1f dp,设为 0 移除底部留白,可能与手势区域重叠。
应用负一屏(实验性)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d7ed2fd4..5bb99d5c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -242,6 +242,8 @@
Portrait mode only. Keeps the original status bar height and app insets.
Hide lock screen emergency call button
Removes the emergency call shortcut from the unlock screen. This makes emergency dialing less accessible.
+ Defer face unlock until swipe
+ Do not start face recognition until the lock screen is swiped
Modify home screen dock bottom padding
Phones in portrait mode: %1$.1f dp. Set to 0 to remove bottom padding. May overlap the gesture area.
App media page (experimental)
diff --git a/common/src/main/java/io/github/soclear/oneuix/common/Preference.kt b/common/src/main/java/io/github/soclear/oneuix/common/Preference.kt
index c0038cde..a55a9add 100644
--- a/common/src/main/java/io/github/soclear/oneuix/common/Preference.kt
+++ b/common/src/main/java/io/github/soclear/oneuix/common/Preference.kt
@@ -163,6 +163,7 @@ data class Preference(
val hideLockscreenEmergencyButton: Boolean = false,
val disableScreenshotCaptureSound: Boolean = false,
val allowLowBatteryFlashlight: Boolean = false,
+ val deferFaceUnlockUntilSwipe: Boolean = false,
val customPowerMenu: Boolean = false,
val powerMenuActions: List = PowerMenuAction.defaultPreferences()
)
diff --git a/hook/src/main/java/io/github/soclear/oneuix/hook/Main.kt b/hook/src/main/java/io/github/soclear/oneuix/hook/Main.kt
index 48bc511d..2aeca9ce 100644
--- a/hook/src/main/java/io/github/soclear/oneuix/hook/Main.kt
+++ b/hook/src/main/java/io/github/soclear/oneuix/hook/Main.kt
@@ -309,6 +309,10 @@ class Main : XposedModule() {
SystemUIOther.hideLockscreenEmergencyButton()
}
+ if (preference.systemUI.other.deferFaceUnlockUntilSwipe) {
+ SystemUIOther.deferFaceUnlockUntilSwipe()
+ }
+
if (preference.systemUI.statusBar.hideBatteryPercentageSign) {
StatusBar.hideBatteryPercentageSign()
}
diff --git a/hook/src/main/java/io/github/soclear/oneuix/hook/systemui/Other.kt b/hook/src/main/java/io/github/soclear/oneuix/hook/systemui/Other.kt
index 0079447c..7510f6d3 100644
--- a/hook/src/main/java/io/github/soclear/oneuix/hook/systemui/Other.kt
+++ b/hook/src/main/java/io/github/soclear/oneuix/hook/systemui/Other.kt
@@ -4,10 +4,16 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Build
+import android.util.Log
import android.view.View
import io.github.libxposed.api.XposedModule
+import io.github.soclear.oneuix.common.ONE_UI_VERSION
import io.github.soclear.oneuix.hook.util.afterAttachTry
import io.github.soclear.oneuix.hook.util.reflect
+import io.github.soclear.oneuix.hook.util.xlog
+import java.lang.reflect.Field
+import java.lang.reflect.Method
+import java.util.concurrent.atomic.AtomicBoolean
@SuppressLint("PrivateApi")
object Other {
@@ -62,4 +68,86 @@ object Other {
xposedModule.hook(it).intercept { }
}
}
+
+ context(xposedModule: XposedModule)
+ fun deferFaceUnlockUntilSwipe() = afterAttachTry(ONE_UI_VERSION >= 80500) {
+ val monitorClass = classLoader.loadClass("com.android.keyguard.KeyguardSecUpdateMonitorImpl")
+
+ // Members may be inherited from KeyguardUpdateMonitor.
+ fun fieldOrNull(type: Class<*>, name: String): Field? = runCatching {
+ type.getDeclaredField(name).apply { isAccessible = true }
+ }.getOrNull()
+
+ fun methodOrNull(type: Class<*>, name: String, vararg parameterTypes: Class<*>): Method? =
+ runCatching { type.getDeclaredMethod(name, *parameterTypes) }.getOrNull()
+
+ fun findField(name: String): Field? {
+ var type: Class<*>? = monitorClass
+ while (type != null) {
+ fieldOrNull(type, name)?.let { return it }
+ type = type.superclass
+ }
+ return null
+ }
+
+ fun findMethod(name: String, vararg parameterTypes: Class<*>): Method? {
+ var type: Class<*>? = monitorClass
+ while (type != null) {
+ methodOrNull(type, name, *parameterTypes)?.let { return it }
+ type = type.superclass
+ }
+ return null
+ }
+
+ val willShowField = findField("mPrimaryBouncerIsOrWillBeShowing")
+ val fullyShownField = findField("mPrimaryBouncerFullyShown")
+ val shouldListenForFaceMethod = findMethod("shouldListenForFace")
+ val bouncerChangedMethod = findMethod(
+ "handlePrimaryBouncerChanged",
+ Int::class.javaPrimitiveType!!,
+ Int::class.javaPrimitiveType!!
+ )
+
+ // Don't suppress face recognition permanently if the state is unavailable.
+ if ((willShowField == null && fullyShownField == null) ||
+ shouldListenForFaceMethod == null || bouncerChangedMethod == null
+ ) {
+ xlog(
+ "deferFaceUnlockUntilSwipe: required members not found " +
+ "(fields=${willShowField != null}/${fullyShownField != null}, " +
+ "methods=${shouldListenForFaceMethod != null}/${bouncerChangedMethod != null})",
+ priority = Log.WARN
+ )
+ return@afterAttachTry
+ }
+
+ val bouncerVisible = AtomicBoolean(false)
+
+ fun readBouncerVisible(monitor: Any): Boolean {
+ fun read(field: Field?): Boolean =
+ field != null && runCatching { field.getBoolean(monitor) }.getOrDefault(false)
+ return read(willShowField) || read(fullyShownField)
+ }
+
+ xposedModule.hook(shouldListenForFaceMethod).intercept { chain ->
+ if (!bouncerVisible.get()) {
+ bouncerVisible.set(readBouncerVisible(chain.thisObject))
+ }
+ if (bouncerVisible.get()) {
+ chain.proceed()
+ } else {
+ false
+ }
+ }
+
+ xposedModule.hook(bouncerChangedMethod).intercept { chain ->
+ val isOrWillBeShowing = (chain.args.getOrNull(0) as? Int) == 1
+ val fullyShown = (chain.args.getOrNull(1) as? Int) == 1
+ val visible = isOrWillBeShowing || fullyShown
+ if (bouncerVisible.getAndSet(visible) != visible) {
+ xlog("bouncer visible=$visible", priority = Log.INFO)
+ }
+ chain.proceed()
+ }
+ }
}