Skip to content

Commit 76ae185

Browse files
committed
chore(release): 发布 1.2.3
签名证书轮换、脚本多选批量操作、Shizuku Root 虚拟屏修复、长录制与用户录制稳定性修复。
1 parent 99ba3db commit 76ae185

49 files changed

Lines changed: 2132 additions & 387 deletions

Some content is hidden

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

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
- name: Verify release signature
112112
run: |
113113
set -euo pipefail
114-
EXPECTED="95392aa229296dbe946c52328450e22b73fc05b417e068dbf6ba2193a7771ea5"
114+
EXPECTED="9e4fcf501f6a2c84c8259ce13dfbf711cf81b3b622ec5e0356cb7f96f9db2db3"
115115
APKSIGNER="$(command -v apksigner || true)"
116116
if [ -z "$APKSIGNER" ]; then
117117
APKSIGNER="$(find "${ANDROID_HOME}/build-tools" -name apksigner -type f | sort -V | tail -1)"

‎.idea/deploymentTargetSelector.xml‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎CHANGELOG.md‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,44 @@
55
格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
66
版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
77

8+
## [1.2.3] - 2026-11-14
9+
10+
### 升级须知
11+
12+
- 1.2.3 起发布签名证书轮换,旧版本无法覆盖安装:请先在旧版导出配置与脚本,
13+
卸载后再安装新版本,并重新授予 Shizuku / 无障碍 / 通知等权限。
14+
15+
### 新增
16+
17+
- 脚本中心支持长按进入多选:可批量置顶 / 取消置顶、批量添加或移除标签、导出为单个
18+
zip、批量删除;删除后一次撤销即恢复全部脚本及其标签、置顶、运行参数、订阅、定时任务
19+
与编排引用。批量删除只触发一次列表刷新,撤销时脚本以新 id 重建。
20+
21+
### 修复
22+
23+
- 修复 Shizuku 以 Root 运行时后台虚拟屏创建失败
24+
(`SecurityException: packageName must match the calling uid`):虚拟屏特权服务在建屏前把
25+
调用身份从 root 降级到 shell(uid 2000),并按 uid 校验 `packageName`;切换失败时返回
26+
可操作提示并回退前台,不再直接暴露底层异常。`IVirtualScreenService` 服务版本号 +1,
27+
Shizuku 会重建仍在运行的旧服务进程。
28+
- 身份切换失败提示改为稳定错误码 + 本地化文案,英文界面不再混入中文原因;非 Root 的
29+
包名校验失败也不再误报为 Root 身份问题。
30+
- 删除脚本时若文件删除失败,会保留原有标签 / 置顶 / 运行参数并提示失败,撤销时也不会
31+
生成同名副本;批量删除支持部分成功提示。
32+
- 修复批量删除可能误删无关空编排的问题;批量导出的待导出列表在页面重建后仍可恢复。
33+
- 修复长录制后段页面内容丢失:默认帧上限 800 → 1600,并默认把最长边限制到 960px、
34+
JPEG 质量降到 82(长录制占用反而下降);达到上限后继续写 `stale` 截图事件,但不再把
35+
上限前的旧帧挂到新动作的 `beforeFrame`。页面切换后清空采样索引并强制写新帧,避免
36+
“新页面显示成上一页”。
37+
- 修复 MCP `recording timeline` 在长录制中只看到前 200 条、且被周期截图淹没的问题:
38+
默认只返回动作与页面切换,动作行新增 `before_frame` / `after_frame`,并返回
39+
`has_more` / `next_offset`;`events` 同样补充分页。需要截图行时传 `include_frames=true`。
40+
- 修复停止用户录制时丢失最后几步动作:停止前 drain 特权侧尚未 poll 的触摸,Shizuku
41+
采集改为单批最多 200 条并返回 `remaining` / `dropped`,积压时连续拉取;控件上下文
42+
队列改为等待落盘后再关闭。用户录制停止后再导出脚本不再缺步骤。
43+
- 用户录制在页面切换 / 自动跳转时会主动补一张新画面,并等待截图后端产出新帧,
44+
减少把缓存旧页写进录制。
45+
846
## [1.2.2] - 2026-11-14
947
### 修复
1048

@@ -551,7 +589,8 @@
551589
- 恢复界面动效并优化设置页布局。
552590
- 交互体验优化与 Android 16 兼容性修复。
553591

554-
[未发布]: https://github.com/BUGJI/IzukiJS/compare/v1.2.2...HEAD
592+
[未发布]: https://github.com/BUGJI/IzukiJS/compare/v1.2.3...HEAD
593+
[1.2.3]: https://github.com/BUGJI/IzukiJS/compare/v1.2.2...v1.2.3
555594
[1.2.2]: https://github.com/BUGJI/IzukiJS/compare/v1.2.1...v1.2.2
556595
[1.2.1]: https://github.com/BUGJI/IzukiJS/compare/v1.2.0...v1.2.1
557596
[1.2.0]: https://github.com/BUGJI/IzukiJS/compare/v1.1.12...v1.2.0

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ keyAlias=...
6666
keyPassword=...
6767
```
6868

69+
Debug 默认使用 AGP 的 debug 签名。需要本地 debug/release 覆盖安装并共享数据时,
70+
在 `gradle.properties` 设置 `izuki.debugSharedSignature=true`;仅当正式签名文件有效时
71+
才生效,debug 包可调试,不要分发。
72+
6973
`keystore.properties` 与 `*.jks` / `*.keystore` 已在 `.gitignore` 中,**不要提交**。
7074
正式发布流程见 [docs/RELEASING.md](docs/RELEASING.md)。
7175

‎app/build.gradle.kts‎

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ plugins {
77
alias(libs.plugins.kotlin.compose)
88
}
99

10-
val appVersionCode = providers.gradleProperty("izuki.versionCode").getOrElse("16").toInt()
11-
val appVersionName = providers.gradleProperty("izuki.versionName").getOrElse("1.2.1")
10+
val appVersionCode = providers.gradleProperty("izuki.versionCode").getOrElse("18").toInt()
11+
val appVersionName = providers.gradleProperty("izuki.versionName").getOrElse("1.2.3")
1212

1313
val keystorePropertiesFile = rootProject.file("keystore.properties")
1414
val keystoreProperties = Properties().apply {
@@ -17,6 +17,15 @@ val keystoreProperties = Properties().apply {
1717
}
1818
}
1919

20+
// 仅显式开启时才让 debug 复用正式证书;同时要求证书文件真实存在,
21+
// 避免只有 keystore.properties 而 storeFile 失效时把 debug 构建直接卡死。
22+
val debugSharedSignature =
23+
providers.gradleProperty("izuki.debugSharedSignature").orNull?.toBoolean() == true
24+
val releaseStoreFile = keystoreProperties.getProperty("storeFile")
25+
?.takeIf { it.isNotBlank() }
26+
?.let { file(it) }
27+
val releaseSigningAvailable = keystorePropertiesFile.exists() && releaseStoreFile?.exists() == true
28+
2029
android {
2130
namespace = "com.benton.izukijs"
2231
compileSdk {
@@ -58,8 +67,8 @@ android {
5867

5968
signingConfigs {
6069
create("release") {
61-
if (keystorePropertiesFile.exists()) {
62-
storeFile = file(keystoreProperties.getProperty("storeFile"))
70+
if (releaseSigningAvailable) {
71+
storeFile = releaseStoreFile
6372
storePassword = keystoreProperties.getProperty("storePassword")
6473
keyAlias = keystoreProperties.getProperty("keyAlias")
6574
keyPassword = keystoreProperties.getProperty("keyPassword")
@@ -68,20 +77,32 @@ android {
6877
}
6978

7079
buildTypes {
80+
debug {
81+
// 默认保持 AGP 的 debug 签名;只有 izuki.debugSharedSignature=true 且
82+
// 正式证书可用时才复用 release 签名,便于本地 debug/release 覆盖安装。
83+
if (debugSharedSignature && releaseSigningAvailable) {
84+
signingConfig = signingConfigs.getByName("release")
85+
} else if (debugSharedSignature) {
86+
logger.warn(
87+
"[Izuki] izuki.debugSharedSignature=true 但正式签名不可用," +
88+
"debug 继续使用 debug 签名。",
89+
)
90+
}
91+
}
7192
release {
7293
isMinifyEnabled = true
7394
isShrinkResources = true
7495
proguardFiles(
7596
getDefaultProguardFile("proguard-android-optimize.txt"),
7697
"proguard-rules.pro",
7798
)
78-
signingConfig = if (keystorePropertiesFile.exists()) {
99+
signingConfig = if (releaseSigningAvailable) {
79100
signingConfigs.getByName("release")
80101
} else {
81-
// 未配置正式签名时回退到 debug 签名,便于本地出包验证。
102+
// 未配置正式签名或 storeFile 失效时回退到 debug 签名,便于本地出包验证。
82103
// 明确告警,避免把 debug 签名的产物误当正式包分发。
83104
logger.warn(
84-
"[Izuki] keystore.properties 缺失,release 将使用 debug 签名,仅用于本地验证。",
105+
"[Izuki] 正式签名不可用,release 将使用 debug 签名,仅用于本地验证。",
85106
)
86107
signingConfigs.getByName("debug")
87108
}

‎app/src/main/aidl/com/benton/izukijs/privileged/IVirtualScreenService.aidl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import android.view.Surface;
55

66
/**
77
* 后台虚拟屏的特权服务面。运行在 Shizuku UserService 进程里,
8-
* 以 shell/root 身份创建 VirtualDisplay 并把目标应用拉到该屏。
8+
* 以 shell 身份创建 VirtualDisplay 并把目标应用拉到该屏;
9+
* Shizuku 以 root 运行时会在建屏前把调用身份降级到 shell。
910
*/
1011
interface IVirtualScreenService {
1112

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.benton.izukijs.controller.record
2+
3+
/** 一次成功写盘的采样帧;[timestamp] 为采集开始时间。 */
4+
data class FrameSample(val timestamp: Long, val path: String)
5+
6+
/**
7+
* 记录最近若干采样帧,并负责给动作挑选“动作前帧”。
8+
*
9+
* 与单纯的最近帧队列不同,这里有两个边界:
10+
* - 页面切换后由 [invalidate] 清空,避免把上一个页面的画面挂到新页面的动作上;
11+
* - 只接受 [maxAgeMs] 以内的样本,帧数上限后采样停止时不会继续返回很久以前的帧。
12+
*/
13+
class FrameSelector(
14+
private val maxSamples: Int = DEFAULT_MAX_SAMPLES,
15+
private val maxAgeMs: Long = DEFAULT_MAX_AGE_MS,
16+
) {
17+
private val samples = ArrayDeque<FrameSample>()
18+
19+
@Synchronized
20+
fun add(timestamp: Long, path: String): FrameSample {
21+
val sample = FrameSample(timestamp, path)
22+
samples.addLast(sample)
23+
while (samples.size > maxSamples) samples.removeFirst()
24+
return sample
25+
}
26+
27+
/** 动作时间点之前最近且未过期的帧。 */
28+
@Synchronized
29+
fun before(timestamp: Long): FrameSample? {
30+
val sample = samples.lastOrNull { it.timestamp <= timestamp } ?: return null
31+
return sample.takeIf { timestamp - it.timestamp <= maxAgeMs }
32+
}
33+
34+
/** 指定时间点之后最早的帧;用于动作后补帧时复用采样线程已抓到的画面。 */
35+
@Synchronized
36+
fun atOrAfter(timestamp: Long): FrameSample? =
37+
samples.firstOrNull { it.timestamp >= timestamp }
38+
39+
@Synchronized
40+
fun invalidate() {
41+
samples.clear()
42+
}
43+
44+
@Synchronized
45+
fun clear() {
46+
samples.clear()
47+
}
48+
49+
@Synchronized
50+
fun size(): Int = samples.size
51+
52+
companion object {
53+
const val DEFAULT_MAX_SAMPLES = 12
54+
55+
/** 超过采样间隔两倍仍没有新样本时,宁可判为“无动作前帧”,也不返回旧页面。 */
56+
const val DEFAULT_MAX_AGE_MS = 2_000L
57+
}
58+
}

‎app/src/main/java/com/benton/izukijs/controller/record/RecordingCaptureLoop.kt‎

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,29 @@ import kotlinx.coroutines.launch
1616
import kotlinx.coroutines.runBlocking
1717
import kotlinx.coroutines.withTimeoutOrNull
1818

19-
data class FrameSample(val timestamp: Long, val path: String)
20-
2119
/**
2220
* 用户录制期间的截图采样器。
2321
*
2422
* 以固定间隔抓帧并保存到 [RecordingWriter],同时维护最近若干帧的时间戳索引。
2523
* 用户动作发生时用 [frameBefore] 取动作前最近一帧,作为 `beforeFrame` 写入事件。
24+
*
25+
* 页面切换后调用 [invalidateSamples]:旧页面的样本不再参与 `beforeFrame`,
26+
* 避免把新页面的动作标成上一个页面的截图。
2627
*/
2728
class RecordingCaptureLoop(
2829
private val writer: RecordingWriter,
2930
private val intervalMs: Long,
3031
private val logBus: LogBus,
31-
private val captureProvider: () -> Bitmap?,
32+
/** [fresh] 为 true 时要求后端等待一帧比调用时刻更新的画面,避免拿到缓存的旧页。 */
33+
private val captureProvider: (fresh: Boolean) -> Bitmap?,
3234
private val onCaptureFailure: () -> Unit = {},
3335
) {
3436

3537
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
36-
private val lock = Any()
38+
private val samples = FrameSelector(
39+
maxAgeMs = maxOf(intervalMs * 2, FrameSelector.DEFAULT_MAX_AGE_MS),
40+
)
3741
private val afterLock = Any()
38-
private val samples = ArrayDeque<FrameSample>()
3942
private val afterJobs = mutableSetOf<Job>()
4043
private var job: Job? = null
4144

@@ -58,10 +61,10 @@ class RecordingCaptureLoop(
5861
acceptingAfter = true
5962
job = scope.launch {
6063
// 先抓一帧,保证第一下点击也有可用的“动作前”画面。
61-
captureOnce()
64+
captureOnce(fresh = false)
6265
while (isActive && !stopped) {
6366
delay(intervalMs.coerceAtLeast(MIN_INTERVAL_MS))
64-
captureOnce()
67+
captureOnce(fresh = false)
6568
}
6669
}
6770
}
@@ -88,33 +91,31 @@ class RecordingCaptureLoop(
8891
stopped = true
8992
scope.cancel()
9093
synchronized(afterLock) { afterJobs.clear() }
91-
synchronized(lock) { samples.clear() }
94+
samples.clear()
9295
}
9396

9497
/**
9598
* 返回动作时间点之前最近的一帧。
9699
*
97-
* 采样队列只保留最近 [MAX_SAMPLES] 帧。找不到动作前的帧时返回 null,
98-
* 不再用动作之后的画面冒充 beforeFrame。
100+
* 采样队列只保留最近若干帧,且页面切换后会被清空;找不到动作前的帧时返回 null,
101+
* 不再用动作之后或上一个页面的画面冒充 beforeFrame。
99102
*/
100-
fun frameBefore(timestamp: Long): String? = synchronized(lock) {
101-
samples.lastOrNull { it.timestamp <= timestamp }?.path
103+
fun frameBefore(timestamp: Long): String? = samples.before(timestamp)?.path
104+
105+
/** 页面切换后调用:丢弃旧页面样本,并要求下一帧强制写盘。 */
106+
fun invalidateSamples() {
107+
samples.invalidate()
108+
writer.requestFreshFrame()
102109
}
103110

104111
/** 动作后补一帧,捕捉页面跳转后的画面;[actionSeq] 用于把帧回填到动作。 */
105112
fun scheduleAfter(timestamp: Long, actionSeq: Long? = null) {
106113
if (stopped || !acceptingAfter) return
107-
if (writer.frameCapReached()) {
108-
writer.markFrameCapReached()
109-
return
110-
}
111114
val job = scope.launch {
112115
delay(AFTER_DELAY_MS)
113116
// 如果采样线程已经抓到了足够晚的帧,直接复用,避免重复截图。
114-
val existing = synchronized(lock) {
115-
samples.lastOrNull { it.timestamp >= timestamp + AFTER_DELAY_MS }
116-
}
117-
val sample = existing ?: captureOnce() ?: return@launch
117+
val existing = samples.atOrAfter(timestamp + AFTER_DELAY_MS)
118+
val sample = existing ?: captureOnce(fresh = true) ?: return@launch
118119
if (actionSeq != null && actionSeq > 0L) {
119120
writer.record(
120121
ContextEvent(
@@ -131,15 +132,22 @@ class RecordingCaptureLoop(
131132
}
132133
}
133134

134-
private fun captureOnce(): FrameSample? {
135+
private fun captureOnce(fresh: Boolean): FrameSample? {
135136
if (stopped) return null
137+
val startedWall = System.currentTimeMillis()
138+
// 到帧上限后继续写 stale screencap 事件,让时间线保持连续;但不再把旧帧
139+
// 计入样本索引,否则后续动作会被标成上限之前的页面。
136140
if (writer.frameCapReached()) {
137-
writer.markFrameCapReached()
141+
// 上限之后没有可信的新样本:清掉旧索引,避免后续动作继续挂上限前的页面。
142+
samples.invalidate()
143+
writer.recordCappedFrame(
144+
atMs = writer.timestampOf(startedWall),
145+
source = RecordSource.USER,
146+
)
138147
return null
139148
}
140-
val startedWall = System.currentTimeMillis()
141149
val bitmap = runCatching {
142-
OverlayCoordinator.withoutOverlay { captureProvider() }
150+
OverlayCoordinator.withoutOverlay { captureProvider(fresh) }
143151
}.getOrElse {
144152
noteCaptureFailure(it.message)
145153
return null
@@ -159,12 +167,7 @@ class RecordingCaptureLoop(
159167
if (path != null) {
160168
failureSinceUptime = 0L
161169
failureReported = false
162-
val sample = FrameSample(timestamp, path)
163-
synchronized(lock) {
164-
samples.addLast(sample)
165-
while (samples.size > MAX_SAMPLES) samples.removeFirst()
166-
}
167-
return sample
170+
return samples.add(timestamp, path)
168171
}
169172
return null
170173
} finally {
@@ -187,8 +190,7 @@ class RecordingCaptureLoop(
187190
private companion object {
188191
const val MIN_INTERVAL_MS = 250L
189192
const val AFTER_DELAY_MS = 220L
190-
const val MAX_SAMPLES = 12
191-
const val STOP_GRACE_MS = 350L
193+
const val STOP_GRACE_MS = 1_000L
192194
const val FAILURE_REPORT_GRACE_MS = 5_000L
193195
}
194196
}

‎app/src/main/java/com/benton/izukijs/controller/record/RecordingContextResolver.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class RecordingContextResolver(
2323
fun foreground(): String = runCatching { foregroundProvider() }.getOrNull().orEmpty()
2424

2525
/** 返回前台包名变化事件;没有变化返回 null。 */
26+
@Synchronized
2627
fun foregroundChanged(packageName: String): String? {
2728
val previous = lastForeground
2829
if (packageName.isBlank()) return null

0 commit comments

Comments
 (0)