Skip to content

Commit 5a97640

Browse files
committed
Translate code comments to English
1 parent bf2098d commit 5a97640

146 files changed

Lines changed: 1187 additions & 1185 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ Rules:
99
- Repository-level architecture notes, public-release boundaries, allowed change scope, and validation requirements are defined by `CLAUDE.md`.
1010
- If `README`, old comments, historical docs, or this file conflict with `CLAUDE.md`, follow `CLAUDE.md`.
1111
- If a subdirectory adds its own `CLAUDE.md` later, it may only add implementation details for that subtree; repository-level rules still come from the root `CLAUDE.md`.
12+
- For source-available public-release work, keep code comments, KDoc/JSDoc, and test `describe` / `it` names in English.
13+
- Chinese and other localized text may remain in localized docs, user-visible product copy, real-app UI matching strings, mock/sample data, and other runtime content where the language is part of the behavior.

client/automation/src/main/java/com/coremate/opengui/automation/AMServiceManager.kt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,38 @@ import com.coremate.opengui.automation.biz.permission.AMPermissionDialog
2626
class AMServiceManager {
2727

2828
companion object {
29-
///全局上下文
29+
///Global Context
3030
lateinit var applicationContext: Context
3131
val instance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
3232
AMServiceManager()
3333
}
3434
}
3535

36-
//是否开启前台服务
36+
//Whether foreground service is enabled
3737
private var isStartService = false
3838

39-
//前台服务图标
39+
//Foreground service icon
4040
var notificationImg: Int? = null
4141

4242
// var cozeAIManager: CozeAIManager? = null
4343

4444
/**
45-
* 初始化
46-
* @param context 必须是ApplicationContext
45+
* Initialize
46+
* @param context must be Application Context
4747
*/
4848
fun init(context: Context) {
4949
applicationContext = context
5050
}
5151

5252
/**
53-
* 获取无障碍服务
53+
* Get Accessibility service
5454
*/
5555
fun accessibilityService(): AccessibilityService? {
5656
return SelectToSpeakService.service
5757
}
5858

5959
/**
60-
* 检测权限
60+
* Check Permission
6161
* */
6262
fun checkPermission(
6363
context: Activity,
@@ -77,12 +77,12 @@ class AMServiceManager {
7777
}
7878

7979
/**
80-
* 开启前台服务
81-
* @param notificationImg 图标
80+
* Start foreground service
81+
* @param notification Img icon
8282
*/
8383
fun startForegroundService(context: Activity, requestCode: Int, notificationImg: Int? = null) {
8484
this.notificationImg = notificationImg
85-
//请求通知权限
85+
//Request notification permission
8686
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
8787
if (context.checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
8888
context.requestPermissions(
@@ -99,7 +99,7 @@ class AMServiceManager {
9999

100100
private fun startForeground(context: Activity) {
101101
isStartService = true
102-
//再次启动Service
102+
//Start Service again
103103
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
104104
val intentFive = Intent(context, AMForegroundService::class.java)
105105
context.startForegroundService(intentFive)
@@ -110,10 +110,10 @@ class AMServiceManager {
110110
}
111111

112112
/**
113-
* 关闭前台服务
113+
* Stop foreground service
114114
*/
115115
fun stopForegroundService(context: Context?) {
116-
//停止Service
116+
//Stop Service
117117
if (context != null) {
118118
if (isStartService) {
119119
isStartService = false
@@ -131,7 +131,7 @@ class AMServiceManager {
131131
}
132132

133133
/**
134-
* 开启自启动权限
134+
* Open autostart permission settings
135135
*/
136136
fun gotoOppoAutoStartSettings(context: Context) {
137137
AlertDialog.Builder(context)
@@ -156,7 +156,7 @@ class AMServiceManager {
156156
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
157157
context.startActivity(intent)
158158
} catch (e: Exception) {
159-
// fallback:跳转到应用详情页
159+
// fallback: navigate to the app details page
160160
val fallbackIntent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
161161
fallbackIntent.data = Uri.parse("package:${context.packageName}")
162162
fallbackIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@@ -172,9 +172,9 @@ class AMServiceManager {
172172
}
173173

174174
/**
175-
* 执行任务
176-
* @param context 当前调用的actviity
177-
* @param param - bizType 和 对应的bean(参数)
175+
* Execute task
176+
* @param context current calling activity
177+
* @param param biz Type and the corresponding parameter bean
178178
*/
179179
fun processTask(context: Activity, param: AMDataContainer) {
180180
AMCore.instance.context = context
@@ -190,21 +190,21 @@ class AMServiceManager {
190190
}
191191

192192
/**
193-
* 添加任务监听
193+
* Add task listener
194194
* */
195195
fun addObserver(listener: IAMProcessListener) {
196196
AMCore.instance.addObserver(listener)
197197
}
198198

199199
/**
200-
* 移除任务监听
200+
* Remove task listener
201201
* */
202202
fun removeObserver(listener: IAMProcessListener) {
203203
AMCore.instance.removeObserver(listener)
204204
}
205205

206206
/**
207-
* 移除所有监听
207+
* Remove all listeners
208208
* */
209209
fun removeAllObserver() {
210210
AMCore.instance.removeAllObserver()

client/automation/src/main/java/com/coremate/opengui/automation/base/AMCore.kt

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import kotlin.reflect.KClass
2727
internal class AMCore : IAMProcessListener {
2828

2929
companion object {
30-
//跳转到权限页面之前的activity
30+
//Activity before navigating to the permission page
3131
@JvmStatic
3232
@SuppressLint("StaticFieldLeak")
3333
var activityByOp: Activity? = null
@@ -44,11 +44,11 @@ internal class AMCore : IAMProcessListener {
4444

4545
private val mainHandler = Handler(Looper.getMainLooper())
4646

47-
///待执行的(目前只存自动回复的任务)
47+
///Pending tasks; currently only auto-reply tasks are stored
4848
var waitTasks = mutableListOf<AMDataContainer>()
4949

5050
/**
51-
* 添加任务监听
51+
* Add task listener
5252
* */
5353
fun addObserver(listener: IAMProcessListener) {
5454
synchronized(this) {
@@ -57,7 +57,7 @@ internal class AMCore : IAMProcessListener {
5757
}
5858

5959
/**
60-
* 移除任务监听
60+
* Remove task listener
6161
* */
6262
fun removeObserver(listener: IAMProcessListener) {
6363
synchronized(this) {
@@ -66,7 +66,7 @@ internal class AMCore : IAMProcessListener {
6666
}
6767

6868
/**
69-
* 移除所有监听
69+
* Remove all listeners
7070
* */
7171
fun removeAllObserver() {
7272
synchronized(this) {
@@ -76,19 +76,19 @@ internal class AMCore : IAMProcessListener {
7676

7777
/////////////////////////////////////////////////////////////////////////////////
7878
//
79-
// 核心调度
79+
// Core scheduler
8080
//
8181
/////////////////////////////////////////////////////////////////////////////////
8282

83-
///消费
83+
///Consume
8484
fun consume() {
8585
if (amContext?.taskManager?.isStartTool == true) {
8686
return
8787
}
8888
if (waitTasks.isNotEmpty()) {
8989
val param = waitTasks.first()
9090
waitTasks.removeAt(0)
91-
///前置consume()操作
91+
///Pre-consume operation
9292
when (param.bizType) {
9393
AMTaskBizType.TK_PUBLISH_VIDEO_MIX -> {
9494
val clipboard =
@@ -138,7 +138,7 @@ internal class AMCore : IAMProcessListener {
138138
}
139139

140140
/**
141-
* 开始调度
141+
* Start scheduling
142142
* */
143143
@JvmOverloads
144144
fun executes(
@@ -148,9 +148,9 @@ internal class AMCore : IAMProcessListener {
148148
threadFactory: ThreadFactory,
149149
data: AMDataContainer? = null,
150150
) {
151-
//先释放,防止之前的任务相关还存在
151+
//Release first to clear any leftover task state
152152
destroyAll()
153-
//设置上下文执行操作
153+
//Set up context execution operations
154154
amContext = AMContext(
155155
activity = context,
156156
targetApps = targetApps,
@@ -162,20 +162,20 @@ internal class AMCore : IAMProcessListener {
162162
}.apply {
163163
taskManager.isStartTool = true
164164
}
165-
//判断是否在app内
165+
//Check whether inside the app
166166
if (AMContext.isInTargetApp) {
167167
Handler(Looper.getMainLooper()).post {
168168
targetApps.first().openThirdApp()
169-
//执行任务
169+
//Execute task
170170
AMLog.onEDebugLog("开始执行任务")
171171
amContext?.taskManager?.onExecute(taskCls, data)
172172
}
173173
} else {
174174
targetApps.first().openThirdApp()
175175
Handler(Looper.getMainLooper()).postDelayed({
176-
//强制在目标app内
176+
//Force execution inside the target app
177177
AMContext.isInTargetApp = true
178-
//执行任务
178+
//Execute task
179179
AMLog.onEDebugLog("进入目标app后,开始执行任务")
180180
amContext?.taskManager?.onExecute(taskCls, data)
181181
}, 850)
@@ -184,34 +184,34 @@ internal class AMCore : IAMProcessListener {
184184

185185
/////////////////////////////////////////////////////////////////////////////////
186186
//
187-
// 服务检测
187+
// Service check
188188
//
189189
/////////////////////////////////////////////////////////////////////////////////
190190

191191
/**
192-
* 辅助监测
192+
* Helper monitoring
193193
* */
194194
fun onAccessibilityEvent(event: AccessibilityEvent) {
195-
//过滤当前app的包名
195+
//Filter the current app package name
196196
val packageName = AMServiceManager.applicationContext.packageName ?: ""
197197
if (event.packageName == packageName) {
198198
AMContext.isInTargetApp = false
199199
return
200200
}
201-
//开始检测执行
201+
//Start check execution
202202
amContext?.checkTargetAndDispatchTaskManager(event)
203203
}
204204

205205
/**
206-
* 服务中断
206+
* Service interruption
207207
* */
208208
fun onAccessibilityInterrupt() {
209209
if (amContext?.taskManager?.taskState == AMTaskState.STOP) {
210210
AMLog.onEDebugLog(
211211
"无障碍服务中断,但是任务已经结束",
212212
)
213213
} else {
214-
//打印记录
214+
//Print records
215215
AMLog.onEDebugLog(
216216
"无障碍服务中断",
217217
)
@@ -223,12 +223,12 @@ internal class AMCore : IAMProcessListener {
223223

224224
/////////////////////////////////////////////////////////////////////////////////
225225
//
226-
// 整体流程状态回调 IAMProcessListener
226+
// Overall process status callback IAM Process Listener
227227
//
228228
/////////////////////////////////////////////////////////////////////////////////
229229

230230
/**
231-
* 任务开始
231+
* Task started
232232
* */
233233
override fun onProcessTaskStart() {
234234
amContext?.taskManager?.setTaskResume = true
@@ -241,7 +241,7 @@ internal class AMCore : IAMProcessListener {
241241
}
242242

243243
/**
244-
* 任务暂停
244+
* Task paused
245245
* */
246246
override fun onProcessTaskPause(isActive: Boolean) {
247247
amContext?.taskManager?.setTaskState(AMTaskState.PAUSE)
@@ -253,7 +253,7 @@ internal class AMCore : IAMProcessListener {
253253
}
254254

255255
/**
256-
* 任务恢复
256+
* Task resumed
257257
* */
258258
override fun onProcessTaskResume() {
259259
amContext?.taskManager?.setTaskState(AMTaskState.RESUME)
@@ -265,11 +265,11 @@ internal class AMCore : IAMProcessListener {
265265
}
266266

267267
/**
268-
* 任务成功完成
269-
* @param isSuccess 是否成功
270-
* @param elapsedTime 耗时
271-
* @param data 完成后的数据
272-
* @param exception 异常
268+
* Task completed successfully
269+
* @param is Success whether execution succeeded
270+
* @param elapsed Time elapsed time
271+
* @param data data after completion
272+
* @param exception exception
273273
* */
274274
override fun onProcessTaskFinish(
275275
isSuccess: Boolean,
@@ -279,12 +279,12 @@ internal class AMCore : IAMProcessListener {
279279
) {
280280
synchronized(this) {
281281
AMLog.onEDebugLog("onProcessTaskFinish")
282-
//任务结束 (完成之后,不用在抛出停止异常)
282+
//Task ended; after completion, no need to throw a stop exception
283283
amContext?.taskManager?.setTaskState(AMTaskState.STOP)
284284
mainHandler.post {
285-
//关闭核心功能
285+
//Close core functionality
286286
amContext?.taskManager?.isStartTool = false
287-
//任务释放
287+
//Release task resources
288288
amContext?.destroyCompsAndTask()
289289
listeners.forEach {
290290
it.onProcessTaskFinish(isSuccess, elapsedTime, exception, sucData)
@@ -297,7 +297,7 @@ internal class AMCore : IAMProcessListener {
297297

298298
/////////////////////////////////////////////////////////////////////////////////
299299
//
300-
// 释放所有
300+
// Release all resources
301301
//
302302
/////////////////////////////////////////////////////////////////////////////////
303303

@@ -308,7 +308,7 @@ internal class AMCore : IAMProcessListener {
308308
}
309309
}
310310

311-
//异常监听
311+
//Exception listener
312312
private inner class ATThreadFactory :
313313
ThreadFactory {
314314
override fun newThread(r: Runnable?): Thread {
@@ -318,7 +318,7 @@ internal class AMCore : IAMProcessListener {
318318
if (e is AMTaskException) {
319319
when (e.reason) {
320320
AMTaskErrorReason.PAUSE -> {
321-
//... 暂停不处理
321+
//... Pause is not handled
322322
}
323323

324324
AMTaskErrorReason.STOP -> {

0 commit comments

Comments
 (0)