testapp: show APK build identity in menu
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-08-29 20:17:35 +08:00
parent c9c7a8aac6
commit a1bcea9bbc
5 changed files with 95 additions and 1 deletions

View File

@@ -0,0 +1,62 @@
# 30-01 Android Test App 版本标识 Codex 完成报告 v1
日期:2026-08-29
执行结论:`WAITING_MANUAL_VALIDATION`
## 1. 目标
在 Android Test App 主菜单列表顶部显示当前运行 APK 的版本与构建身份,使人工验证时能够直接确认设备上安装的是哪个 APK。
## 2. 基线与范围
- 分支:`particle/main`。
- 开始 HEAD:`c9c7a8aac6b72461b4d1b4dc6985da9d8fcc6146`。
- 开始时工作区无修改。
- 本轮只修改 Android Test App 菜单 UI,不修改 Core renderer、正式粒子实现、GPU、Mask、Vulkan 或 iOS。
- 按 30-01 指令书不创建或修改 Step。
## 3. 实现
`FeatureOverviewActivity` 在主菜单顶部显示:
```text
APK <versionName> (<versionCode>) · <renderer>/<buildType> · Git <revision>
```
数据全部来自 APK 构建产物自身:
- Test App `BuildConfig.VERSION_NAME`;
- Test App `BuildConfig.VERSION_CODE`;
- Test App `BuildConfig.FLAVOR`;
- Test App `BuildConfig.BUILD_TYPE`;
- MapLibre Android `BuildConfig.GIT_REVISION` 的前 10 位。
版本信息没有写死;不同 renderer、build type 或 Git 提交构建出的 APK 会显示对应身份。
## 4. 修改文件
- `platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/FeatureOverviewActivity.kt`
- `platform/android/MapLibreAndroidTestApp/src/main/res/layout/activity_feature_overview.xml`
- `platform/android/MapLibreAndroidTestApp/src/main/res/values/strings.xml`
- `粒子开发记录.md`
- 本完成报告。
## 5. 检查
- `git diff --check`:PASS。
- 两个修改 XML 使用 Python 标准库只读解析:PASS。
- Android/Gradle/Native 编译:未执行;用户明确要求 Codex 不编译。
- 设备显示结果:等待用户重新手工构建、安装后确认。
## 6. Git
- commit message:`testapp: show APK build identity in menu`。
- 本次 commit hash:因报告与实现同一提交,为避免自引用,在 Codex 最终回复中记录。
- push:提交后在 Codex 最终回复中记录。
- 目标远端:`origin/particle/main`。
## 7. 未完成
- 尚无用户手工 Android 构建与设备截图,因此不能宣称运行显示 PASS。
- 30-01 Core RenderLayer 的修复后实机验证仍为 `WAITING_MANUAL_VALIDATION`。

View File

@@ -8,6 +8,7 @@ import android.content.res.Resources.NotFoundException
import android.os.Bundle
import android.view.Menu
import android.view.View
import android.widget.TextView
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
@@ -18,6 +19,8 @@ import androidx.recyclerview.widget.RecyclerView.SimpleOnItemTouchListener
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.maplibre.android.BuildConfig as MapLibreBuildConfig
import org.maplibre.android.testapp.BuildConfig
import org.maplibre.android.testapp.R
import org.maplibre.android.testapp.adapter.FeatureAdapter
import org.maplibre.android.testapp.adapter.FeatureSectionAdapter
@@ -43,6 +46,14 @@ class FeatureOverviewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_feature_overview)
findViewById<TextView>(R.id.apkVersionView).text = getString(
R.string.apk_version_format,
BuildConfig.VERSION_NAME,
BuildConfig.VERSION_CODE,
BuildConfig.FLAVOR,
BuildConfig.BUILD_TYPE,
MapLibreBuildConfig.GIT_REVISION.take(GIT_REVISION_LENGTH)
)
recyclerView = findViewById<View>(R.id.recyclerView) as RecyclerView
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.addOnItemTouchListener(SimpleOnItemTouchListener())
@@ -218,5 +229,6 @@ class FeatureOverviewActivity : AppCompatActivity() {
companion object {
private const val KEY_STATE_FEATURES = "featureList"
private const val GIT_REVISION_LENGTH = 10
}
}

View File

@@ -5,10 +5,21 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/apkVersionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primaryDark"
android:padding="12dp"
android:textColor="@android:color/white"
android:textIsSelectable="true"
android:textSize="14sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"/>
</LinearLayout>

View File

@@ -8,6 +8,7 @@
<string name="activity_benchmark_world_tour">World Tour Benchmark</string>
<string name="description_world_tour_benchmark">Writes out avg. fps and 1% fps after world tour with .flyTo()</string>
<string name="search">Search</string>
<string name="apk_version_format">APK %1$s (%2$d) · %3$s/%4$s · Git %5$s</string>
<string name="category_data">Data Sources</string>
<string name="particle_validation_active">ACTIVE</string>
<string name="particle_validation_static">STATIC</string>

View File

@@ -54,3 +54,11 @@
- Linux OpenGL 对应目标对象编译通过;C++ 格式和 `git diff --check` 通过。
- 未运行 Android/Gradle/npm/ADB,等待用户在新提交上重新手工编译和实机运行。
- 当前结论仍为 `WAITING_MANUAL_VALIDATION`;未扩大到粒子、GPU ping-pong、Trail、Mask、Vulkan 或 iOS。
## 2026-08-29 — 30-01 Android Test App APK 版本标识
- 在 Test App 主菜单列表顶部增加当前 APK 构建身份显示。
- 显示 `versionName/versionCode`、renderer flavor、build type 和构建时 Git revision 前 10 位,均来自 BuildConfig,不写死版本。
- 版本条用于人工验证时区分旧 APK 与当前源码构建,避免只凭安装时间或文件名判断。
- `git diff --check` 与 Android XML 标准库解析通过;按用户要求未执行任何编译。
- 等待用户手工构建、安装后确认设备端显示。