diff --git a/.github/workflows/fc-spatial-quality-verify.yml b/.github/workflows/fc-spatial-quality-verify.yml index 335dc356cd9..09caed289bb 100644 --- a/.github/workflows/fc-spatial-quality-verify.yml +++ b/.github/workflows/fc-spatial-quality-verify.yml @@ -109,10 +109,21 @@ jobs: python3 fc/spatial-audio/apply.py python3 fc/spatial-audio/experimental/apply.py python3 fc/spatial-audio/refinement/apply.py - python3 -m py_compile fc/branding/apply.py fc/branding/makeover.py + python3 -m py_compile fc/branding/apply.py fc/branding/makeover.py fc/branding/glass_once.py python3 -m unittest discover -s fc/branding -p 'test_*.py' python3 fc/branding/apply.py python3 fc/branding/makeover.py + python3 fc/branding/glass_once.py + python3 - <<'PY' + from pathlib import Path + root = Path('app/src/main/java/com/music/zenith/MainActivity.kt').read_text() + assert 'AppSplash(' not in root, 'Unexpected full-screen splash is still composed' + assert 'if (!contentReady) return@setContent' not in root + home = Path('sharedUi/src/jvmSharedMain/kotlin/com/music/zenith/ui/screens/HomeScreen.kt').read_text() + assert 'text = "Music"' in home + assert 'text = "brrMusic"' not in home + print('Home Music-only / direct app launch verified') + PY - name: Fill missing Android locale fallbacks for this build run: | diff --git a/.github/workflows/fc-sync-release.yml b/.github/workflows/fc-sync-release.yml index 01aaf363d8f..6890846c882 100644 --- a/.github/workflows/fc-sync-release.yml +++ b/.github/workflows/fc-sync-release.yml @@ -358,9 +358,10 @@ jobs: if: steps.decision.outputs.should_release == 'true' run: | set -euo pipefail - python3 -m py_compile fc/branding/apply.py fc/branding/makeover.py + python3 -m py_compile fc/branding/apply.py fc/branding/makeover.py fc/branding/glass_once.py python3 fc/branding/apply.py python3 fc/branding/makeover.py + python3 fc/branding/glass_once.py - name: Run production unit tests if: steps.decision.outputs.should_release == 'true' env: @@ -588,3 +589,21 @@ jobs: files: dist/${{ env.FC_APK_PREFIX }}v${{ steps.decision.outputs.version_name }}.apk fail_on_unmatched_files: true make_latest: true + + - name: Disarm one-release glass elasticity only after verified publication + if: steps.decision.outputs.should_release == 'true' + env: + GH_TOKEN: ${{ github.token }} + VERSION_NAME: ${{ steps.decision.outputs.version_name }} + shell: bash + run: | + set -euo pipefail + if grep -Fxq 'oneReleaseElastic=true' fc/branding/config.properties; then + expected="brrMusic-v${VERSION_NAME}.apk" + gh release view "v${VERSION_NAME}" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' | grep -Fxq "$expected" + sed -i 's/^oneReleaseElastic=true$/oneReleaseElastic=false/' fc/branding/config.properties + git add fc/branding/config.properties + git commit -m "chore(branding): retire one-release elastic glass trial after v${VERSION_NAME}" + git push origin HEAD:main + echo "One-release glass experiment disarmed for all future builds." + fi diff --git a/README.md b/README.md index 41cad05f5c9..6ade9f0b424 100644 --- a/README.md +++ b/README.md @@ -96,13 +96,15 @@ A calmer identity, from the first frame to the last detail. | Moment | brrMusic presentation | | :--- | :--- | -| **Launch** | A midnight-to-indigo opening screen with brrMusic lettering and an original sound-wave mark. | -| **Home and browsing** | brrMusic wordmark and inherited music discovery without the original upstream Z badge. | -| **Onboarding and icons** | Fork-specific startup and glass-icon artwork while retaining the existing installed package. | +| **Launch** | No extra branded loading animation. The app opens directly after Android's standard launch window. | +| **Home and browsing** | A restrained **Music** heading, without a brrMusic or Zenith wordmark dominating the screen. | +| **Onboarding and icons** | Fork-specific icon artwork while retaining the existing installed package. | | **Playlists and sharing** | brrMusic in visible labels, Replay cards and shared content; clean lyric images without watermarks. | | **Settings and updates** | brrMusic name and version, fork download links and explicit links for upstream attribution. | | **Canvas website** | Matching brrMusic identity, a sound-wave emblem and cool-toned dark styling. | +**Glass interactions:** The next branded release includes a limited elastic-touch experiment for controls without existing springs. It automatically retires from subsequent releases after successful publication, keeping upstream glass behavior as the long-term default. + **Screenshots:** The previous README contained screenshots captured from Zenith. Those legacy screenshots have been removed rather than presented as evidence of the new brrMusic interface. Verified screenshots from an installed release can be added after device testing. ## Install diff --git a/fc/branding/apply.py b/fc/branding/apply.py index 01728d44a0d..a5b2ee533a6 100644 --- a/fc/branding/apply.py +++ b/fc/branding/apply.py @@ -60,7 +60,7 @@ def home(value, path): modifier = Modifier.padding(bottom = 14.dp), )""" new = """ Text( - text = "brrMusic", + text = "Music", style = style, color = MaterialTheme.colorScheme.onBackground, maxLines = 1, diff --git a/fc/branding/config.properties b/fc/branding/config.properties index 159c4e1a0be..5f0552be5ff 100644 --- a/fc/branding/config.properties +++ b/fc/branding/config.properties @@ -2,4 +2,8 @@ # Keep package name, signing certificate, account/storage IDs and internal APIs unchanged. # Increase brandingRevision whenever visible branding or identity assets change. enabled=true -brandingRevision=2 +brandingRevision=3 +# One-release touch-elasticity trial. CI changes this to false after a signed +# APK has been verified, before committing release metadata to main. +# Future upstream updates will not re-apply the experimental patch. +oneReleaseElastic=true diff --git a/fc/branding/glass_once.py b/fc/branding/glass_once.py new file mode 100644 index 00000000000..bc5e4270a7d --- /dev/null +++ b/fc/branding/glass_once.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""A single-release, fail-closed touch-elasticity experiment. + +Only augments interactive glass surfaces that have no existing elastic +feedback. Navigation pills, sliders, mini-player, segmented controls and +top-bar buttons already have custom spring/rubber interactions upstream; +adding another global scale would double-animate them and distort layout. +Never changes the component's hit testing, backdrop renderer, or lifecycle. +""" +from pathlib import Path +import re + +ROOT = Path(__file__).resolve().parents[2] +CONFIG = ROOT / "fc/branding/config.properties" +MORPH = ROOT / "app/src/main/java/com/music/zenith/ui/components/GlassSearchMorph.kt" +SEARCH = ROOT / "app/src/main/java/com/music/zenith/ui/components/GlassSearchBar.kt" + + +def enabled(config_text: str) -> bool: + values = re.findall(r"(?m)^oneReleaseElastic=(true|false)$", config_text) + if len(values) != 1: + raise SystemExit("Exactly one oneReleaseElastic boolean is required") + return values[0] == "true" + + +def replace_once(source: str, old: str, new: str, label: str) -> str: + count = source.count(old) + if count != 1: + raise SystemExit(f"Glass experiment stopped: {label}: expected once, found {count}") + return source.replace(old, new, 1) + + +def search_morph(source: str) -> str: + # Only the tappable collapsed circle, not the input field that already + # morphs as the IME rises. Preserve sizes and click area. + source = replace_once( + source, + " .size(MORPH_CIRCLE)\n .clip(shape)\n .then(glass)", + " .size(MORPH_CIRCLE)\n" + " .glassJelly(GLASS_JELLY_PRESS_WIDE)\n" + " .clip(shape)\n .then(glass)", + "search-morph closed tab circle", + ) + # An elastic tap on the separate, not-yet-animated back control. The + # capsule itself already springs during opening and must not be scaled. + return replace_once( + source, + " .align(Alignment.CenterStart)\n" + " .size(MORPH_CONTROL)\n" + " .graphicsLayer { alpha = openFraction }\n" + " .clickable(", + " .align(Alignment.CenterStart)\n" + " .size(MORPH_CONTROL)\n" + " .glassJelly()\n" + " .graphicsLayer { alpha = openFraction }\n" + " .clickable(", + "search-morph back control", + ) + + +def search_bar(source: str) -> str: + # Last-tab circle gets the same bounded width-aware elastic response. + # Disabled during morph transitions or when that surface isn't clickable. + return replace_once( + source, + " .clip(shape)\n" + " .then(Modifier.liquidGlass(shape = shape))\n" + " .clickable(", + " .then(if (interactive && tabClickable) " + "Modifier.glassJelly(GLASS_JELLY_PRESS_WIDE) else Modifier)\n" + " .clip(shape)\n" + " .then(Modifier.liquidGlass(shape = shape))\n" + " .clickable(", + "search bar last-tab control", + ) + + +def apply() -> None: + if not enabled(CONFIG.read_text(encoding="utf-8")): + print("One-release glass elasticity disabled; upstream effects unchanged") + return + for path, transform in ((MORPH, search_morph), (SEARCH, search_bar)): + initial = path.read_text(encoding="utf-8") + amended = transform(initial) + if initial == amended: + raise SystemExit(f"Glass experiment made no change to {path.name}") + path.write_text(amended, encoding="utf-8") + print(f"One-release glass elasticity: {path.relative_to(ROOT)}") + + +if __name__ == "__main__": + apply() diff --git a/fc/branding/makeover.py b/fc/branding/makeover.py index fa5aeb7e9eb..bb8d408b951 100644 --- a/fc/branding/makeover.py +++ b/fc/branding/makeover.py @@ -82,16 +82,23 @@ def svg_asset(transparent: bool) -> str: '\n') -def splash_text(value: str) -> str: - value = once(value, 'text = "Music",', 'text = "brrMusic",', "splash label") - # Rethink the inherited saturated red screen as a quiet midnight-to-indigo introduction. - value = once(value, 'listOf(Color(0xFFFF5D73), Color(0xFFF72A45))', - 'listOf(Color(0xFF0B1020), Color(0xFF28224C))', "splash gradient") - return value - - -def wordmark_text(value: str) -> str: - return once(value, 'text = "Music",', 'text = "brrMusic",', "reusable wordmark") +def remove_startup_overlay(value: str) -> str: + # Remove the extra full-screen Compose splash and its artificial + # first-frame gate. Android's system-provided launch window remains. + start = " setContent {\n AppSplash(\n" + end = " if (!contentReady) return@setContent\n" + if value.count(start) != 1 or value.count(end) != 1: + raise SystemExit("AppSplash integration changed upstream; review before release") + prefix, rest = value.split(start, 1) + discarded, suffix = rest.split(end, 1) + if not all(token in discarded for token in ( + "setImageResource(R.drawable.splash_logo_dark_glass)", + "contentReady = true", "withFrameNanos", + )): + raise SystemExit("Unexpected startup composition; refusing unsafe splash removal") + value = prefix + " setContent {\n" + suffix + return once(value, "import com.music.zenith.ui.screens.AppSplash\n", "", + "unused AppSplash import") # Only Kotlin UI string literals, never package paths, identifiers, URLs, or API IDs. @@ -164,9 +171,8 @@ def main() -> None: edit(theme_file, lambda value: once(value, "#FB4059", "#0B1020", "native splash background")) ET.fromstring(theme_file.read_text(encoding="utf-8")) - # These components are actually shown during start and on Home. - edit(ROOT / "sharedUi/src/jvmSharedMain/kotlin/com/music/zenith/ui/screens/AppSplash.kt", splash_text) - edit(ROOT / "sharedUi/src/jvmSharedMain/kotlin/com/music/zenith/ui/screens/Wordmark.kt", wordmark_text) + # No marketing splash; Home shows only "Music" via the first branding layer. + edit(ROOT / "app/src/main/java/com/music/zenith/MainActivity.kt", remove_startup_overlay) # All icon options and all startup mark variants cease displaying the Z. vector_files = { diff --git a/fc/branding/test_glass_once.py b/fc/branding/test_glass_once.py new file mode 100644 index 00000000000..556174b4228 --- /dev/null +++ b/fc/branding/test_glass_once.py @@ -0,0 +1,55 @@ +"""One-release glass elasticity is intentionally narrow and reversible.""" +import importlib.util +import unittest +from pathlib import Path + +MODULE = Path(__file__).with_name("glass_once.py") +SPEC = importlib.util.spec_from_file_location("brr_glass_once", MODULE) +glass = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(glass) + + +class OneReleaseGlassTests(unittest.TestCase): + def test_flag_parsing_and_disarm(self): + self.assertTrue(glass.enabled("enabled=true\noneReleaseElastic=true\n")) + self.assertFalse(glass.enabled("oneReleaseElastic=false\n")) + with self.assertRaises(SystemExit): + glass.enabled("enabled=true\n") + with self.assertRaises(SystemExit): + glass.enabled("oneReleaseElastic=true\noneReleaseElastic=false\n") + + def test_morph_uses_existing_bounded_jelly_only_on_controls(self): + source = ( + 'Box(Modifier.size(MORPH_CIRCLE)\n' + ' .size(MORPH_CIRCLE)\n' + ' .clip(shape)\n' + ' .then(glass))\n' + ' .align(Alignment.CenterStart)\n' + ' .size(MORPH_CONTROL)\n' + ' .graphicsLayer { alpha = openFraction }\n' + ' .clickable(' + ) + amended = glass.search_morph(source) + self.assertEqual(amended.count(".glassJelly("), 2) + self.assertIn(".glassJelly(GLASS_JELLY_PRESS_WIDE)", amended) + self.assertIn(".glassJelly()", amended) + + def test_search_bar_stretch_only_when_interactive(self): + source = ( + " .clip(shape)\n" + " .then(Modifier.liquidGlass(shape = shape))\n" + " .clickable(" + ) + amended = glass.search_bar(source) + self.assertIn("if (interactive && tabClickable)", amended) + self.assertEqual(amended.count(".glassJelly("), 1) + + def test_fails_closed_on_unrecognized_upstream_code(self): + with self.assertRaises(SystemExit): + glass.search_morph("unrelated upstream code") + with self.assertRaises(SystemExit): + glass.search_bar("unrelated upstream code") + + +if __name__ == "__main__": + unittest.main() diff --git a/fc/branding/test_makeover.py b/fc/branding/test_makeover.py index 278b186a97b..8ab127bebb2 100644 --- a/fc/branding/test_makeover.py +++ b/fc/branding/test_makeover.py @@ -25,13 +25,33 @@ def test_ui_brand_text_only(self): self.assertIn('"Music downloads"', edited) self.assertIn('ZenithIcons.Play', edited) - def test_startup_text_and_midnight_palette(self): - sample = 'Text(text = "Music", color = Color.White)\n' + \ - 'listOf(Color(0xFFFF5D73), Color(0xFFF72A45))' - edited = makeover.splash_text(sample) - self.assertIn('text = "brrMusic"', edited) - self.assertIn('Color(0xFF0B1020)', edited) - self.assertNotIn('0xFFFF5D73', edited) + def test_direct_launch_removes_branded_splash_and_frame_gate(self): + sample = ( + "import com.music.zenith.ui.screens.AppSplash\n" + "class MainActivity {\n" + " setContent {\n" + " AppSplash(\n" + " mark = { size ->\n" + " setImageResource(R.drawable.splash_logo_dark_glass)\n" + " },\n" + " )\n" + " // The splash is drawn alone on first frame\n" + " var contentReady = true\n" + " withFrameNanos { }\n" + " if (!contentReady) return@setContent\n" + " DrawMainApp()\n" + " }\n" + "}\n" + ) + edited = makeover.remove_startup_overlay(sample) + self.assertIn("setContent {\n DrawMainApp()", edited) + self.assertNotIn("AppSplash", edited) + self.assertNotIn("contentReady", edited) + self.assertNotIn("withFrameNanos", edited) + + def test_direct_launch_fail_closed_on_changed_upstream(self): + with self.assertRaises(SystemExit): + makeover.remove_startup_overlay("setContent { AppSplash() }") def test_all_mark_variants_are_original_waveforms(self): for h in (72, 108):