Skip to content

feat(build): make debug builds installable beside release, with a badged icon - #21

Merged
doublepi123 merged 2 commits into
mainfrom
feat/debug-build-badge
Oct 18, 2026
Merged

doublepi123 merged 2 commits into
mainfrom
feat/debug-build-badge

Conversation

@doublepi123

Copy link
Copy Markdown
Owner

Our own test builds looked identical to the release on the home screen and could not be installed beside it. This makes the debug build type a separate, recognisable app.

What changes in debug builds

  • Separate package (applicationIdSuffix ".debug"): data, runtime and server password are kept apart from the release install.
  • Its own local OpenCode port, 4099: set through BuildConfig.LOCAL_RUNTIME_PORT_OVERRIDE, which replaces the runtime manifest's port when it is non-zero (release: 0). This avoids keeping a copied manifest, so the OpenCode version and checksums are defined in one place.
  • Name and version: a -debug version-name suffix, and the label "DoubleCode Debug" in all 8 locales.
  • Icon badge: an amber bug badge on the launcher icon, also on the themed (monochrome) icon. It sits in the empty space between the logo's legs, inside the adaptive-icon safe zone, so no mask shape clips it. All of it is vector, under src/debug/res.

Release builds are unchanged.

Side effect: the -debug.apk attached to releases changes package too. It no longer upgrades an old debug install that used the release package. The README now says so.

Verified

  • detekt spotlessCheck :app:lintGithubDebug :app:testGithubDebugUnitTest :app:assembleGithubDebug passes, including all 1411 unit tests.
  • The debug APK reports com.doublepi123.andcode.debug, 1.2.27-dp7-debug, "DoubleCode Debug".
  • On k70u (Redmi K70 Ultra), installed beside the release: the local runtime installed with port 4099 and listened on it.

Pre-PR review

Reviewed at 73b23cd: APPROVE. Follow-up 3b5b74f applies the review's suggestions:

  • a README note (en/ja) that debug installs as a separate app
  • the OAuth callback port caveat
  • a comment explaining the per-locale debug app_name copies

Report:

判定: APPROVE

ブロッカー

なし

提案(非ブロッキング)

  • .github/workflows/release.yml:123 / README.md:243, README.ja.md:243 — リリースに添付される and-code-$TAG-debug.apk のパッケージが com.doublepi123.andcode.debug に変わります。旧 CI debug APK(パッケージ com.doublepi123.andcode、debug 鍵で署名)を使っていた人は、更新しても上書きされず、新しいアプリとして初期状態から始まります。runtime・パスワード・設定は引き継がれません。リリースノートか README の「Install to device」に、debug は別アプリとして並んで入ることを一行足すと親切です。
  • 固定ポートを使う外部 OAuth コールバックは今回のポート分離の対象外です。対象は Codex の 127.0.0.1:1455(docs/CODEX.md:196)と Antigravity の localhost リダイレクトです。debug 版と release 版で同時にサインインすると衝突する可能性があります。めったに起きませんが、docs/ などに「同時サインインは不可」と書いておくとよいです。
  • 共有ストレージの同じワークスペースを両方のアプリで開いた場合、.and-code/browser-command.json を両方の GuestBrowserCommandWatcher(feature/browser/BrowserCommandWatcher.kt:29-40)がポーリングします。先に読んだ側がコマンドを消費します。これも同時利用時だけの話で、今回の対応範囲外として問題ありません。
  • app/src/debug/res/values-*/strings.xml — locale 別ファイルが必要な理由は、main 側の values-ja などの app_name が debug の values/ より優先されるためです。この理由は自明ではないので、values/strings.xml のコメントに一行あると、後で「重複だから」と消されるのを防げます。なお translatable="false" を locale ファイルに付けると lint ExtraTranslation に当たることがあります。報告どおり lintGithubDebug が通っているなら問題ありません。

チェック済み項目

  • shell 権限が拒否されたため git diff は実行できませんでした。代わりに、変更概要にあるファイルを worktree 上で直接読んで確認しました。全 hunk を diff で通読したわけではありません。
  • ビルド設定:app/build.gradle.kts:131-132,184-191 を確認。defaultConfig は LOCAL_RUNTIME_PORT_OVERRIDE=0、debug は applicationIdSuffix ".debug" / versionNameSuffix "-debug" / 4099 です。release には設定がなく、release の挙動は変わりません。
  • ポート上書き:LocalRuntimeManifest.kt:22,61,68 を確認。上書きは validate() の前に適用されるので、4099 にも範囲チェックがかかります。LocalRuntimeManifestReader を作っているのは LocalRuntimeInstaller.kt:21 だけで、manifestReader.read()(:82、port は :206 の metadata に書かれる)と manifestReader::port(:272)の両方に上書きが効きます。
  • 4097 移行ロジックとの関係:LocalRuntimePort.kt:42-44 は metadata が厳密に 4097 のときだけ書き換えます。debug は別パッケージで新規インストールになり、metadata には 4099 が直接書かれるので移行は起きません。release(4098)にも影響しません。テストは LocalRuntimeManifestTest.kt:34-47 に追加済みです。
  • ポートのハードコード:main ソースに 4098/4099 の直書きがないことを rg で確認しました。LocalOpenCodeBackend.kt:73、LocalRuntimeManager.kt:725、defaultServerOwnershipProbe はすべて metadata の port を使っています。
  • プロセス判定:findManagedRuntimeRootPids / findOpenCodeServerPids(LocalRuntimeProcessLauncher.kt:273-316)は runtimeDirectory の絶対パス(パッケージ名を含む)で絞り込んでいます。debug から release の proot を誤って kill することはありません。
  • Manifest:androidx-startup の authorities は ${applicationId} を使っているので衝突しません。FileProvider、<data> ディープリンク、カスタム <permission> は存在しません(rg で確認)。
  • Intent・ブロードキャスト:action 文字列は com.yugahashimoto.andcode.* 固定ですが、問題ありません。PendingIntent はすべて明示コンポーネント(RuntimeNotificationHelper.kt:299、ScheduleManager.kt:134、QuickInputWidgetProvider.kt:35,48)です。唯一の暗黙ブロードキャスト(AndCodeVoiceInteractionService.kt:102-104)も setPackage(context.packageName) で限定されていて、アプリ間で混ざりません。exported receiver はすべて exported="false" です。
  • 通知チャンネル・前景サービス・ウィジェット:通知チャンネル ID と NOTIFICATION_ID はパッケージごとに分かれるので衝突しません。ウィジェットも別 provider として並んで表示されます。voice_interaction_service.xml の FQCN はクラス名(namespace 側)なので suffix の影響を受けません。
  • benchmark / baseline profile:benchmark/build.gradle.kts:21-26 は benchmark buildType(fallback は release)だけを有効にしていて、debug の suffix は適用されません。packageName = "com.doublepi123.andcode" のハードコードはそのまま正しいです。
  • GitHub device flow:リダイレクト URI を使わない方式で、GITHUB_CLIENT_ID は build config から渡されるので、パッケージ名の影響を受けません。
  • i18n:i18n-check.yml:6,18,28 が見るのは app/src/main/res だけで、src/debug は対象外です。main の app_name は 8 ロケールすべてにそのまま残っていて CI は落ちません。debug 側にも 8 ロケール分の app_name(translatable="false")があることを確認しました。
  • アイコン:mipmap-anydpi-v26/v33 の ic_launcher / ic_launcher_round が main と同じ名前で上書きしていることを確認しました。v33 には monochrome レイヤもあります。layer-list が参照する @mipmap/ic_launcher_foreground / @mipmap/ic_launcher_monochrome は main に全密度分あります。バッジの vector は 108dp の viewport です。
  • テスト:ReleaseMetadataTest.kt:12-14 は BuildConfig.DEBUG で期待値を分けていて、testGithubDebugUnitTest と release 系テストの両方で通る形です。
  • 秘密情報:新たな秘密情報は追加されていません。

…ged icon

Our own test builds were indistinguishable from the release on the home
screen and could not be installed next to it. The debug build type now
has:

- its own package (applicationIdSuffix .debug), so data, runtime and
  server password are separate from the release install
- its own local OpenCode port (4099), set through a BuildConfig override
  of the runtime manifest's port rather than a copied manifest, so the
  OpenCode version and checksums stay single-sourced
- a "-debug" versionName suffix and the label "DoubleCode Debug"
- an amber bug badge on the launcher icon, also on the themed
  (monochrome) icon, placed inside the adaptive-icon safe zone

The CI debug APK attached to releases changes package with this, so it
no longer upgrades an older debug install that used the release package.
@doublepi123
doublepi123 merged commit 38981c5 into main Oct 18, 2026
6 checks passed
@doublepi123
doublepi123 deleted the feat/debug-build-badge branch October 18, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant