Repository navigation
ADFA-7241: Custom IDE Builder Phase B: own name, icon and contact details - #182
Draft
davidschachterADFA wants to merge 35 commits into
Draft
davidschachterADFA wants to merge 35 commits into
davidschachterADFA wants to merge 35 commits into
Conversation
…inSdk Core (pure JVM) for Phase B, with tests. ARSCLib 1.4.0 edits the host's resources.arsc: app_name in every locale, other strings that name the app (except the host's protected strings, and any string with markup), and the files ic_launcher, ic_launcher_round, ic_launcher_foreground, ic_launcher_fg_vector and ic_cogo_notification resolve to, in every config. The new table is written stored and 4-byte aligned, with the PNGs beside it. Also the name rules, the picture look-alike hash, the minSdk reader and warning, and the gate that requires the ownership confirmation. Plugin version 1.0.0 -> 1.1.0, versionCode 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
… the screen Android layer for Phase B: a name field with a live check, a picture picker that crops, scales to every density and compares the picture with the host's own launcher icon, the ownership checkbox, and a warning under each plugin that needs a newer Android than the host. Tooltips, in-IDE help, gallery page and README describe the new fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
ResourceBranding.apply() re-reads the edited table and compares it with the original, but no test failed if apply() skipped that call. The check is now a parameter that defaults to verify(), and a test sees it run on the bytes apply() returns. It fails with the call removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Session.kt: kept Phase B's name/icon code beside Phase A's end(). Help pages: Phase A's required headings, with Phase B's renaming, icon, checks and minSdk text carried over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
F47: PluginMinSdk.fromArchive trusted the size the archive claims. It now counts bytes as it reads, with a 1 MiB cap; an oversized manifest or an OutOfMemoryError gives MinSdk.Unknown (a warning), never a crash. 6.7: tooltips for the app-name field, the icon preview and its status lines, the name status line and the minSdk warning rows; the Phase B long-press helper now shares Phase A's withTooltip. 6.6: help pages cover renaming, icon, checks, confirmation and minSdk warnings under the required headings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Conflicts: the Build APK help line keeps both the output file name and the new cancel wording; Session.build sets finished before reading the branding result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
On device the copy still showed Code on the Go's phone logo on the welcome screen, the main screen, About and the editor sidebar header. Those layouts use @drawable/cogo_brand_mark, a vector in resources/ with one entry and no density, and branding repointed only the launcher, foreground and notification icons. cogo_brand_mark is now a fourth icon role, repointed the same way: its entry names a new PNG, res/custom-ide-builder/mark-<density>.png, made from the whole picture at 80 dp (320 px at xxxhdpi, the file the density-less entry gets). The layouts fit it into 44 to 200 dp boxes with fitCenter, so a square picture shows square. Resource IDs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
… (F51) On device the app's own mipmap-xxxhdpi/ic_launcher.png, and a crop of it, passed as "Different". The only reference was drawable/ic_launcher, a vector whose phone fills the height of its square, while the legacy PNG pads the phone to two thirds of it. Their hashes were about 45 bits apart (threshold 14), so the shipped PNG never matched. The check now compares against every drawing of the icon and keeps the closest: the vector full-bleed, mipmap/ic_launcher and ic_launcher_round as the device resolves them (the masked adaptive icon, and its layers unmasked), cogo_brand_mark, and the raster files those resources name in the host APK, found through resources.arsc (HostIcons). Each pair is also compared trimmed to its content (IconTrim), so padding and crops do not count. Hashed pictures are 128 px instead of 64, so trimming has pixels to work with; the host's drawings are cached per APK. CogoIconCheckTest runs on copies of Code on the Go's real launcher PNGs (GPL-3.0, as this repository): every density, and crops and rescales of them, come within 9 bits; 300 unrelated pictures stay at 18 or more. The vector references are rebuilt from the PNG at the vectors' geometry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
On Android 9 a plugin with minSdk 33 (AI-Core) was refused as "could not read the plugin ID", so the minSdk warning never showed. AndroidBits.readPluginId used PackageManager.getPackageArchiveInfo, which will not parse an APK whose minSdk is above the device's, and returned null. PluginManifest (core) now reads plugin.id, plugin.main_class and the package name from the .cgp's compiled AndroidManifest.xml with ARSCLib, as PluginMinSdk already does for the minimum, and the way the host's PluginLoader reads them: plugin.id else the package name, plugin.main_class required, only text values, the last entry of a name winning. The manifest read is capped at 1 MiB. getPackageArchiveInfo is no longer used. The warning now reads "... so on a device below Android 13 (API 33) AI Core will not work." and adds "This device has Android 9 (API 28)." when the phone the builder runs on is older than the plugin needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
…s it A .cgp is untrusted, and ARSCLib allocates by the sizes in the headers. Both manifest readers now require the XML magic, a chunk size equal to the byte count and a string pool that fits before parsing, and refuse otherwise (the archive readers then report no readable manifest). Also drops a stale finding ID from a test comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
…s folder A template was accepted on its first four bytes. TemplateCheck opens it with java.util.zip.ZipFile and refuses a file that does not parse or holds an absolute, drive-letter, backslash, control-character or .. entry name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
A 1000 x 100000 picture was decoded whole because only min(width, height) chose the sample size. ImageSampling.sampleSize also keeps the decode within 16 Mi pixels (64 MiB), and the cap wins over the target side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Session.end also clears the name, icon, icon verdict and ownership box, and IconImages.release drops the cached host icons; a drawing still running at dispose cannot refill the cache. The icon preview is dropped rather than recycled, because the screen may still draw it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
The output-name question in Session meets the custom app name: the name asked about and saved is built from the custom name when one is set. Session.build now returns a small Saved record, so the Done message can name the actual file and still report the skipped styled texts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Leaving both empty used to build an unbranded copy named Code on the Go with its icon, while typing that name or picking that icon was refused. Every copy now needs its own name, an icon that passes the icon check and the ticked confirmation. BrandingGate.isCustom is gone and nameToWrite never returns null; an empty name and a missing icon each get their own gate message. Branding holds a name and an icon, never a null part, which removes the null branches in ResourceBranding.apply and verify. Pipeline and ApkRewriter still accept no Branding: the rewrite and signing tests build synthetic hosts with no resource table. The screen drops the "optional" texts and the confirmation box is always enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
…equired Help tooltips, the in-IDE help page, the gallery page and the README no longer describe the name and icon as optional or say that leaving them empty keeps Code on the Go's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Conflicts resolved keeping both sides: Phase B's branding (Branding, BrandingGate, the minSdk on Chosen, the branded output name and BuildInput) with Phase A's progress coalescing, itemsVersion, endsBuild and password clearing. The min-SDK warning moves with the add-on rows into rebuildItems, and refreshBranding stays on the full refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
The full refresh rebuilt every add-on row with a fresh MinSdkCheck and a fresh read of the host's package details per row. Rows are now rebuilt only when the list changes, and the warning is kept on the Chosen item the first time its row is built; the host's details are read at most once per rebuild, and only for a row not yet checked. While they cannot be read nothing is flagged and nothing is kept, so a later rebuild tries again. refreshBranding stays on the full refresh, never on a progress update, and sets the icon preview only when the picture changed. The branding stages reach the screen through Pipeline's progress callback, which is coalesced like every other stage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
VerifyReport.signerSha256 is nullable, and Saved.signer is not, so a real
build of Session.kt failed with an argument type mismatch. The build now
throws BuildException("The finished APK carries no signer certificate.")
when it is null, before anything is written to the folder. The pipeline has
already verified the APK, so this should never happen, and the result line
can never say "Signed with certificate null".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
ResXmlElement.listElements(String) is deprecated in ARSCLib 1.4.0, and it only copies getElements(String) into a list (CollectionUtil.toList(getElements(name))). The loop now walks that iterator directly. Nothing in the loop changes the tree, so it reads the same elements in the same order. PluginManifestTest and MinSdkTest pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Conflict: kept Phase B's Saved record; both sides already throw on a missing signer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Contacts holds the seven fields a copy can show in place of App Dev For All's: website, contact and feedback emails, support link, forum, Telegram and YouTube. ContactCheck trims each field and accepts a blank one (hide); a link must be an absolute https URL with a host, no user info, no whitespace or control characters, at most 2048 characters and % only as a %XX escape; an email must be a plain local@domain, since the app pastes it unescaped into a mailto: link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
ContactBranding sets about_website_url, adfa_email, feedback_email, github_sponsors_url, github_discussions_url, telegram_channel_url and youtube_channel_url in every config they have, blank as "", always empties bilibili_video_url, and checks the values on read-back with the name and icon edit. A host whose resources.arsc has no about_website_url cannot carry them, so HostSupport refuses the build before any work and names the plugin's minimum version, which a test keeps equal to the manifest's plugin.min_ide_version. Invalid details join the gate's list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Seven labelled fields between "Name and icon" and the signing key, each with a tooltip and a line naming its problem. The values live in Session, survive the Fragment being rebuilt, are cleared by Session.end() and are remembered in the screen's preferences. Build checks the installed app for the contact strings before asking anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
The help pages and the README say where the copy's About links and feedback emails come from, that blank hides, that the values are remembered, and that the builder needs a Code on the Go with ADFA-7313. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Conflicts: kept both sides in Session.kt (branding and contact setters plus activate/deactivate), BuilderFragment.refresh (refreshBranding/Contacts plus the disabled password fields) and the Build APK help line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Conflict: kept Phase B's accept() signature and binary-manifest plugin ID; the template check is the same on both sides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADFA-7241
Custom IDE Builder, Phase B: every copy the builder makes gets its own name, its own icon and its own contact details, so it can't pass for Code on the Go. Stacked on #179 (Phase A), and based on its branch so this diff shows only Phase B. Draft until #179 merges. Plugin version 1.1.0.
Depends on CoGo ADFA-7313 (#2316). The builder refuses a host whose
resources.arsclacks ADFA-7313'sabout_website_urlstring, and says which Code on the Go it needs. Until a release carries ADFA-7313, every build is refused.plugin.min_ide_version(26.48 here) andHostSupport.MIN_IDE_VERSIONmust then be raised together to that release; a test fails if they differ.What changes
core/AppNameCheck.kt,core/Branding.kt):app_namein every config with ARSCLib 1.4.0 (Apache-2.0), then read back to verify;IconImages.kt,core/IconCheck.kt,core/HostIcons.kt):cogo_brand_mark) PNGs at every density;core/Contacts.kt,core/ContactBranding.kt,core/HostSupport.kt):"", which ADFA-7313 hides, andbilibili_video_urlis always"";%only as%XX. Emails must be a plainlocal@domain, because the app puts them in amailto:unescaped;core/BrandingGate.kt): Build needs a valid name, an icon that passes the check, valid contact details and the "this is my own" tick. Each problem has its own message.core/MinSdk.kt):plugin.id,plugin.main_classand the minSdk are read from the.cgp's binary manifest after a header check. A plugin for a newer Android than the device's is now identified rather than reported unreadable, and the warning names the device's Android version.Verification
core/): 232 pass, none skipped. They include CoGo's realic_launcher.pngat all five densities as fixtures (GPL-3.0, like this repo). Each regression test was checked to fail with its fix reverted.assemblePluginpasses with no compiler warnings,testDebugUnitTestpasses all 232, andaddons checkis clean. The.cgp's provenance record readsrevision=4c0a476145b4,revision_source=git, not dirty. On 719134c, D8 reported no duplicate classes, and ARSCLib's six bundled framework stubs (android.util.AttributeSet,XmlResourceParser,org.xmlpull.v1.*) ran on Android 9 with no verify errors. CoGo's plugin loader is parent-first.app_nameis set in every config, and both add-ons are bundled byte for byte;"", and Bilibili is"";out-*folder and logs no signing afterwards. After re-enabling, a build works. During a build, the password fields and key picker are disabled.Limitations accepted
xn--form.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw