6.6.3 - Alpha - 修复无障碍服务关闭时音量加键停止所有脚本功能失效的问题

This commit is contained in:
SuperMonster003
2025-04-29 19:01:09 +08:00
parent 09190f44f3
commit 8903837b3b
3 changed files with 19 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
{
"$data": {
"v6.6.3": {
"released_date": "2025/04/26",
"released_date": "2025/04/29",
"feature": [
"timers.keepAlive 方法 (已全局化), 用于保持脚本活跃状态",
"engines.on('start/stop/error', callback) 等事件监听方法, 用于监听脚本引擎全局事件"
@@ -10,6 +10,7 @@
"主页文档标签显示在线文档时部分内容被系统导航栏遮挡的问题",
"部分设备代码编辑器空行显示方框字符的问题",
"主题色设置页面调色盘对话框可能无限叠加的问题",
"无障碍服务关闭时音量加键停止所有脚本功能失效的问题",
"APK 文件类型信息对话框可能无法获取应用名称及 SDK 信息的问题",
"dialogs 模块无法正常使用 customView 属性的问题 _[`issue #364`](http://issues.autojs6.com/364)_",
"console.setContentTextColor 方法导致日志字体颜色丢失默认值的问题 _[`issue #346`](http://issues.autojs6.com/346)_",

View File

@@ -1,10 +1,12 @@
package org.autojs.autojs.event;
import android.content.Context;
import android.util.Log;
import android.view.KeyEvent;
import org.autojs.autojs.AutoJs;
import org.autojs.autojs.core.accessibility.AccessibilityService;
import org.autojs.autojs.core.accessibility.OnKeyListener;
import org.autojs.autojs.core.inputevent.InputEventObserver;
import org.autojs.autojs.core.inputevent.ShellKeyObserver;
import org.autojs.autojs.core.pref.Pref;
@@ -24,30 +26,30 @@ public class GlobalKeyObserver implements OnKeyListener, ShellKeyObserver.KeyLis
private boolean mVolumeDownFromShell, mVolumeDownFromAccessibility;
private boolean mVolumeUpFromShell, mVolumeUpFromAccessibility;
private GlobalKeyObserver() {
private GlobalKeyObserver(Context applicationContext) {
mVolumeDownEventDispatcher = new EventDispatcher<>();
AccessibilityService.Companion.getStickOnKeyObserver().addListener(this);
// ShellKeyObserver observer = new ShellKeyObserver();
// observer.setKeyListener(this);
// InputEventObserver.getGlobal(GlobalAppContext.get()).addListener(observer);
ShellKeyObserver observer = new ShellKeyObserver();
observer.setKeyListener(this);
InputEventObserver.getGlobal(applicationContext).addListener(observer);
}
public static void initIfNeeded() {
if (Pref.isUseVolumeControlRunningEnabled()) makeSureSingletonInitialized();
public static void initIfNeeded(Context applicationContext) {
if (Pref.isUseVolumeControlRunningEnabled()) makeSureSingletonInitialized(applicationContext);
}
public static void init() {
makeSureSingletonInitialized();
public static void init(Context applicationContext) {
makeSureSingletonInitialized(applicationContext);
}
public static GlobalKeyObserver getSingleton() {
makeSureSingletonInitialized();
public static GlobalKeyObserver getSingleton(Context applicationContext) {
makeSureSingletonInitialized(applicationContext);
return sSingleton;
}
private static void makeSureSingletonInitialized() {
private static void makeSureSingletonInitialized(Context applicationContext) {
if (sSingleton == null) {
sSingleton = new GlobalKeyObserver();
sSingleton = new GlobalKeyObserver(applicationContext);
}
}

View File

@@ -1,5 +1,5 @@
#Sat Apr 26 11:16:55 CST 2025
BUILD_TIME=1745637415532
#Tue Apr 29 18:56:52 CST 2025
BUILD_TIME=1745924212962
COMPILE_SDK_VERSION=35
JAVA_VERSION=23
JAVA_VERSION_MIN_RADICAL=0
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=35
TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3167
VERSION_BUILD=3173
VERSION_NAME=6.6.3 Alpha
VSCODE_EXT_REQUIRED_VERSION=1.0.8