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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# CodePocket 更新日志

## [0.1.2] — 2026-11-25

引擎连接与慢设备启动修复。0.1.1 的真实运行暴露出:在极慢的 x86_64 软件模拟器上,`:engine` 进程冷启动超过 8 秒,主进程按旧超时判定失败,于是 Python 显示不可用;原生库、标准库和 C 扩展本身没有缺失。

### 修复

- `RemoteNativeEngine` 的 Binder 连接等待从 8 秒提高到 30 秒,覆盖冷启动、低端机和模拟器的慢绑定;不再把“慢”误判成“坏”。
- prepare 阶段的整体等待从 120 秒提高到 180 秒,给首次解压标准库、抽取 50+ C 扩展留出真实慢设备的余量;进度条仍持续可见。
- 不改变 `:engine` 独立进程边界,不把 Python 拉回主进程;0.1.1 的紧凑顶栏、按宽度分栏、抽屉宽度和动作网格全部保留。

### 真实验证

- x86_64 Android 15 模拟器(API 35,1080×2340,TCG 软件模拟)上,修正后的 release 在首次准备完成后打开 `main.py` 并运行,输出 `Hello from CodePocket!` 与 `1^2 + 2^2 + ... + 10^2 = 385`,退出码 0。
- 该轮首次准备在 TCG 下超过 2 分钟;这是纯软件模拟的耗时,不作为真机性能结论。
- 仍无 ARM64 真机验收;不宣称所有 ROM 都已跑通。

## [0.1.1] — 2026-11-25

移动端布局收口版本。不改 Python 引擎和 Git 地基,只把手机、横屏、平板和字体放大下的摆放做明确,避免继续靠“看起来差不多”。
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ Three runtimes are bundled inside the APK: a natively cross-compiled CPython 3.1
- **Python pdb debugger**: real stdlib `pdb`; breakpoints, next/step/continue, `p locals()`, stack, quit; quick-action bar in output panel
- **Offline by design**: no language server process, no model download, hard caps at 300 `.py` files / 512KB per file

### Mobile layout pass (0.1.1)
### 引擎连接修复(0.1.2)
- **慢设备绑定容错**:主进程等待 `:engine` Binder 的时间从 8 秒提高到 30 秒,冷启动慢的模拟器或低端机不再被误判成运行时损坏
- **准备预算**:首次准备标准库解压与 C 扩展抽取的总等待提高到 180 秒,期间仍显示进度;`:engine` 独立进程边界不变
- **真实运行证据**:x86_64 Android 15 模拟器上,准备完成后打开 `main.py` 运行,输出 `Hello from CodePocket!`,算出 `1^2 + ... + 10^2 = 385`,退出码 0
- **未宣称**:仍无 ARM64 真机验收;TCG 模拟器耗时不当成手机性能结论

### 移动布局收口(0.1.1)
- **Compact toolbar**: below 480dp or at 1.3× font scale, the top bar keeps only menu, save and run/stop; preview, command palette and debug move into a **更多** menu so 44dp touch targets stop squeezing the filename
- **Width-based two-pane**: 600dp tablets and short landscape phones (≥520dp wide) place output beside the editor; normal portrait phones keep the vertical stack so code height is not sacrificed
- **Adaptive drawer**: sidebar width is clamped to 200–272dp by screen width; quick actions switch from four to three columns on narrow screens or large fonts
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId = "com.devterminal"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 41
versionName = "0.1.1"
versionCode = 42
versionName = "0.1.2"
vectorDrawables { useSupportLibrary = true }
// 原生 CPython 引擎:同时打 arm64 与 x86_64(后者用于模拟器/ChromeOS)
ndk { abiFilters += listOf("arm64-v8a", "x86_64") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class RemoteNativeEngine(private val appContext: Context) : RunEngine {
if (!ok) messenger.completeExceptionally(IllegalStateException("无法绑定 Python 引擎进程"))
}

suspend fun await(): Messenger = withTimeout(8_000L) { messenger.await() }
suspend fun await(): Messenger = withTimeout(30_000L) { messenger.await() }

fun send(what: Int, id: Long = 0L, payload: String? = null): Boolean {
if (dead) return false
Expand Down Expand Up @@ -185,7 +185,7 @@ class RemoteNativeEngine(private val appContext: Context) : RunEngine {
throw IllegalStateException("无法向 Python 引擎进程发送初始化请求")
}
try {
withTimeout(120_000L) { done.await() }
withTimeout(180_000L) { done.await() }
} finally {
// 超时也必须摘掉监听器,否则后续事件会写进一个没人等待的 id。
listeners.remove(id)
Expand Down
37 changes: 37 additions & 0 deletions docs/RELEASE_NOTES_0.1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CodePocket 0.1.2 — 引擎连接与慢设备启动修复

**版本号**:0.1.2(versionCode 42)
**发布日期**:2026-11-25
**定位**:0.1.1 的真实验收暴露出的连接超时修复;保留 0.1.1 的全部移动布局改造,不改 `:engine` 独立进程边界。

## 问题

在 x86_64 Android 15 模拟器(API 35,TCG 纯软件模拟)上启动 0.1.1 release 时,输出面板报:

```text
[CodePocket] Python 原生运行时初始化失败,JavaScript/Lua 仍可运行;请点「自检」查看缺失项。
```

自检同时显示 CPU 架构、标准库、解释器、JNI 桥均可用,仅 C 扩展模块红。根因不是运行时资源缺失,而是 `:engine` 进程冷启动在本机超过主进程原先的 8 秒 Binder 等待;连接被判定失败后,准备步骤没有真正完成。

## 修复

- `RemoteNativeEngine` 的 Binder 连接等待从 **8 秒提高到 30 秒**,避免把慢启动误判成运行时损坏。
- 首次 prepare 的总等待从 **120 秒提高到 180 秒**,覆盖标准库解压与 50+ 个 C 扩展从 APK 抽取;进度条持续可见。
- 不改 0.1.0 的独立进程架构:主进程仍只持有 `RemoteNativeEngine`,`libpython` / `libpybridge` 仍在 `:engine` 加载。
- 0.1.1 的紧凑顶栏、按宽度分栏、抽屉宽度 200–272dp、窄屏三列快捷动作全部保留。

## 真实验证

- 在 x86_64 Android 15 模拟器安装 0.1.2 release,完成首次准备后打开 `main.py`:
- 标准输出:`Hello from CodePocket!`
- 计算结果:`1^2 + 2^2 + ... + 10^2 = 385`
- 进程退出码 0,耗时约 1.3 秒
- 同轮首次准备在 TCG 模拟器上耗时超过 2 分钟;这是纯软件模拟的耗时,不作为手机性能结论。
- 紧凑顶栏、更多菜单、抽屉三列、横屏两栏均有真实截图;截图见交付页。

## 明确边界

- **仍无 ARM64 真机验收**:本轮只有 x86_64 模拟器真实运行,不冒充物理 ARM64 结果。
- 不做 Gradle/Java/Kotlin 工程构建、完整 LSP、原生 wheel ABI;边界与 0.1.0/0.1.1 相同。
- 首次准备的 180 秒只是容错上限,不代表每次启动都慢;正常缓存后启动会跳过解压与抽取。
5 changes: 3 additions & 2 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h1>手机上真正离线的 <span class="grad">编程终端</span></h1>
<div class="badges">
<span class="badge"><b>100%</b> 离线运行</span>
<span class="badge"><b>Python 3.13</b> · <b>JS</b> · <b>Lua</b></span>
<span class="badge"><b>v0.1.1</b> 移动布局收口</span>
<span class="badge"><b>v0.1.2</b> 引擎连接修复</span>
<span class="badge"><b>0</b> 广告 · 免费开源</span>
</div>
<div class="cta">
Expand Down Expand Up @@ -169,6 +169,7 @@ <h3>开箱即用,装完即离线</h3>
<div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 9l-5 3 5 3M16 9l5 3-5 3M14 4l-4 16"/></svg></div>
<h3>现代 IDE 体验</h3>
<p>多文件 Tab、全局搜索、正则计数跳转、报错行点击直达源码、自动闭合括号、行号开关、自动换行、跳行、图片预览、双指缩放字号,还有 Git 面板、命令面板与分屏预览。</p>
<p><b>0.1.2 修复:</b><code>:engine</code> 冷启动 Binder 等待从 8 秒提高到 30 秒,首次准备预算提高到 180 秒,慢模拟器/低端机不再被误判成 Python 运行时损坏。x86_64 Android 15 模拟器已真实运行 <code>main.py</code>,输出 <code>Hello from CodePocket!</code> 与 <code>1^2 + ... + 10^2 = 385</code>,退出码 0;ARM64 真机仍待验收。</p>
<p><b>0.1.1 新增:</b>顶栏在 480dp 以下或 1.3 倍字体时只留菜单/保存/运行,其余动作进「更多」;600dp 平板与矮横屏切换左右两栏;抽屉宽度按屏幕夹在 200–272dp;快捷动作改三列。0.1.0 的引擎进程隔离、Git 暂存/Diff、纯 Python 包导入继续保留;179 个 JVM/Robolectric 测试把门。</p>
<p><b>0.0.34:</b>HTTPS Git clone、项目 zip 导入/导出、PTY 子进程 execve、命令进程组回收。</p>
<p><b>0.0.30:</b>手机端遮挡治理:所有面板按键盘上方可用高度布局,标题/输入框/按钮固定,只有正文滚动;终端全屏自适应、按键条贴键盘;键盘不再误触发布局切换。</p>
Expand Down Expand Up @@ -233,7 +234,7 @@ <h2>看一眼就知道</h2>

<section id="download">
<h2>下载 APK</h2>
<p class="lead"><b>v0.1.1 移动布局收口</b>:APK 内嵌 CPython 3.13 引擎、运行用标准库与 50+ 原生 C 扩展,安装即用;支持 arm64 手机与 x86_64 模拟器。0.1.1 把紧凑顶栏、宽屏两栏、抽屉宽度和快捷动作列数做成明确规则;0.1.0 的引擎进程隔离、Git 暂存/Diff、纯 Python 包导入继续保留。release 包约 24MB。真机交互仍需按机型人工验收,页面不冒充已跑通所有 ROM。</p>
<p class="lead"><b>v0.1.2 引擎连接修复</b>:APK 内嵌 CPython 3.13 引擎、运行用标准库与 50+ 原生 C 扩展;支持 arm64 手机与 x86_64 模拟器。0.1.2 把 <code>:engine</code> 冷启动等待提高到 30 秒、首次准备提高到 180 秒,保留 0.1.1 的紧凑顶栏、宽屏两栏、抽屉宽度和快捷动作列数。release 包约 24MB。真机交互仍需按机型人工验收,页面不冒充已跑通所有 ROM。</p>
<div class="dl">
<div class="card">
<h3>GitCode Release</h3>
Expand Down
Loading