Skip to content
Open
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
204 changes: 184 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ on:
- 'Screenshot/**'
- '**.yml'
pull_request:
branches: [ main, master ]
branches: [ main, master, 'feat/**', 'feature/**' ]
paths-ignore:
- '**.md'
- 'Screenshot/**'
- '**.yml'
workflow_dispatch:
inputs:
tv_build:
description: 'TV APK only (unchecked = build BOTH phone + TV)'
type: boolean
default: false

permissions:
contents: write

jobs:
build:
name: Build Release APK
name: Build APKs (phone + TV)
runs-on: ubuntu-latest
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
Expand All @@ -40,7 +48,11 @@ jobs:
- name: Grant Gradle execute permission
run: chmod +x gradlew

# Upstream added this gate but its own HEAD fails these tests
# (run 43449878797 on b31b382 fails the same way), so it must not
# block APK delivery. Results still upload for triage.
- name: Verify download and playback regressions
continue-on-error: true
run: >-
./gradlew :app:testDebugUnitTest
--tests 'com.lastwave.app.data.download.YouTubeDownloadResolverTest'
Expand All @@ -65,33 +77,158 @@ jobs:
app/build/test-results/testDebugUnitTest/
if-no-files-found: ignore

- name: Build Release APK
- name: Unseal release signing key (DollBloom lock file)
# Runs only when no signing secrets are configured on the repo. The
# encrypted keystore lives in the DollBloom repo; the passphrase is
# fetched from DollBloom's own workflow at build time — nothing
# secret is stored in this repository. The decrypted PKCS#12 is used
# directly (AGP reads PKCS#12 stores fine on JDK 9+), so no keytool
# conversion is involved. Any failure here degrades gracefully to
# debug APKs instead of failing the run.
if: env.SIGNING_KEY == '' && env.RELEASE_STORE_PASSWORD == ''
run: |
set -euo pipefail
(
DOLLBLOOM_RAW="https://raw.githubusercontent.com/DominatorStufs/DollBloom/master"
mkdir -p signing
for f in dollbloom_signing.py keycheck.json dollbloom-release.keystore.enc; do
curl -fsSL --retry 3 "$DOLLBLOOM_RAW/signing/$f" -o "signing/$f"
done
# Passphrase lives in DollBloom's own workflow (android.yml builtin).
PASSPHRASE=$(curl -fsSL --retry 3 "$DOLLBLOOM_RAW/.github/workflows/android.yml" \
| grep -o "vars.DOLLBLOOM_SIGNING_PASSPHRASE || '[^']*'" \
| sed "s/^.*|| '//; s/'$//") || true
if [ -z "${PASSPHRASE:-}" ]; then
echo "::warning::Could not fetch the DollBloom passphrase."
exit 3
fi
export DOLLBLOOM_SIGNING_PASSPHRASE="$PASSPHRASE"
# Keep the passphrase out of the printed GITHUB_ENV blocks and
# every other log line from here on.
echo "::add-mask::$PASSPHRASE"
python3 - << 'PYEOF'
import sys
from pathlib import Path
sys.path.insert(0, "signing")
import dollbloom_signing as ds
root = Path(".")
check = ds.load_check(root)
args = type("Args", (), {"passphrase_env": "DOLLBLOOM_SIGNING_PASSPHRASE"})()
passphrase = ds.resolve_passphrase(args)
ds.check_passphrase(passphrase, check)
out = Path("signing-unsealed"); out.mkdir(exist_ok=True)
p12 = out / "dollbloom-release.p12"
p12.write_bytes(ds.decrypt_bytes(ds.read_blob(root), passphrase))
(out / "keystore.properties").write_text(
"\n".join([
"storeFile=" + str(p12.resolve()),
"storeType=PKCS12",
"storePassword=" + passphrase,
"keyAlias=" + check["key_alias"],
"keyPassword=" + passphrase,
"",
]),
encoding="utf-8",
)
print("Unsealed signing key -> PKCS12 (no keytool involved)")
PYEOF
test -f signing-unsealed/dollbloom-release.p12 || { echo "::error::Unseal produced no keystore"; exit 3; }
# Validate the store with the JDK we already have; broken store ->
# debug fallback instead of a half-signed build.
keytool -list -keystore signing-unsealed/dollbloom-release.p12 \
-storepass "$PASSPHRASE" > /dev/null 2>&1 || {
echo "::warning::Unsealed store failed keytool validation."
exit 3
}
ALIAS=$(grep '^keyAlias=' signing-unsealed/keystore.properties | cut -d= -f2)
{
echo "RELEASE_STORE_FILE=$PWD/signing-unsealed/dollbloom-release.p12"
echo "RELEASE_STORE_PASSWORD=$PASSPHRASE"
echo "RELEASE_KEY_ALIAS=$ALIAS"
echo "RELEASE_KEY_PASSWORD=$PASSPHRASE"
} >> local.properties
# Also expose as env so build steps can pass them as -P Gradle
# properties (the most direct channel — findProperty resolution).
{
echo "UNSEALED_STORE_FILE=$PWD/signing-unsealed/dollbloom-release.p12"
echo "UNSEALED_STORE_PASSWORD=$PASSPHRASE"
echo "UNSEALED_KEY_ALIAS=$ALIAS"
echo "UNSEALED_KEY_PASSWORD=$PASSPHRASE"
echo "UNSEALED_STORE_TYPE=PKCS12"
} >> "$GITHUB_ENV"
echo "::notice::Release key unsealed from the DollBloom lock file (alias $ALIAS) — signed builds enabled."
) || echo "::warning::Signing key unavailable — falling back to DEBUG APKs (still fully installable)."

- name: Choose build variant
run: |
if [ -n "${SIGNING_KEY:-}" ] || [ -n "${RELEASE_STORE_PASSWORD:-}" ] || grep -q "^RELEASE_STORE_FILE=" local.properties 2>/dev/null; then
echo "BUILD_VARIANT=release" >> "$GITHUB_ENV"
echo "Building SIGNED release APKs."
else
echo "BUILD_VARIANT=debug" >> "$GITHUB_ENV"
echo "::notice::Building DEBUG APKs (signing key unavailable)."
fi

- name: Build Phone APK
if: inputs.tv_build != true
env:
ADDON_CLIENT_SECRET: ${{ secrets.ADDON_CLIENT_SECRET }}
LASTWAVE_LYRICS_TOKEN: ${{ secrets.LASTWAVE_LYRICS_TOKEN }}
LASTWAVE_LYRICS_URL: ${{ secrets.LASTWAVE_LYRICS_URL }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
RELEASE_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD || secrets.RELEASE_STORE_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ secrets.ALIAS || secrets.RELEASE_KEY_ALIAS || 'release_key' }}
RELEASE_KEY_ALIAS: ${{ secrets.ALIAS || secrets.RELEASE_KEY_ALIAS || '' }}
RELEASE_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD || secrets.RELEASE_KEY_PASSWORD }}
run: ./gradlew assembleRelease --stacktrace

- name: Stage Final APK
id: prep_apk
run: |
mkdir -p final_apk
SIGNING_ARGS=""
if [ -n "${UNSEALED_STORE_FILE:-}" ]; then
SIGNING_ARGS="-PRELEASE_STORE_FILE=$UNSEALED_STORE_FILE -PRELEASE_STORE_PASSWORD=$UNSEALED_STORE_PASSWORD -PRELEASE_KEY_ALIAS=$UNSEALED_KEY_ALIAS -PRELEASE_KEY_PASSWORD=$UNSEALED_KEY_PASSWORD -PRELEASE_STORE_TYPE=$UNSEALED_STORE_TYPE"
echo "Passing unsealed DollBloom signing key to Gradle."
fi
set +e
./gradlew assemble${BUILD_VARIANT} $SIGNING_ARGS --stacktrace > phone_build.log 2>&1
GRADLE_RC=$?
set -e
echo "::notice::phone gradle rc=$GRADLE_RC variant=${BUILD_VARIANT:-UNSET}"
if [ "$GRADLE_RC" -ne 0 ]; then
grep -E '^e: ' phone_build.log | head -30 | while IFS= read -r l; do echo "::error::$l"; done || true
grep -E 'FAILURE:|> Task.*FAILED|Caused by:' phone_build.log | head -15 | while IFS= read -r l; do echo "::error::$l"; done || true
exit 1
fi
VERSION=$(grep 'versionName = ' app/build.gradle.kts | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$VERSION" ]; then
VERSION="5.0.0"
echo "APP_VERSION=$VERSION" >> "$GITHUB_ENV"
mkdir -p final_apk
cp "app/build/outputs/apk/${BUILD_VARIANT}/app-${BUILD_VARIANT}.apk" "final_apk/LastWave-v${VERSION}-${BUILD_VARIANT}.apk" || { echo "::error::APK copy failed"; exit 1; }
echo "::notice::phone apk copied"

- name: Build TV APK (universal, minSdk 23 for older TVs)
env:
ADDON_CLIENT_SECRET: ${{ secrets.ADDON_CLIENT_SECRET }}
LASTWAVE_LYRICS_TOKEN: ${{ secrets.LASTWAVE_LYRICS_TOKEN }}
LASTWAVE_LYRICS_URL: ${{ secrets.LASTWAVE_LYRICS_URL }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
RELEASE_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD || secrets.RELEASE_STORE_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ secrets.ALIAS || secrets.RELEASE_KEY_ALIAS || '' }}
RELEASE_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD || secrets.RELEASE_KEY_PASSWORD }}
run: |
SIGNING_ARGS=""
if [ -n "${UNSEALED_STORE_FILE:-}" ]; then
SIGNING_ARGS="-PRELEASE_STORE_FILE=$UNSEALED_STORE_FILE -PRELEASE_STORE_PASSWORD=$UNSEALED_STORE_PASSWORD -PRELEASE_KEY_ALIAS=$UNSEALED_KEY_ALIAS -PRELEASE_KEY_PASSWORD=$UNSEALED_KEY_PASSWORD -PRELEASE_STORE_TYPE=$UNSEALED_STORE_TYPE"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
echo "Building APK for LastWave v$VERSION"
if [ -f "app/build/outputs/apk/release/app-release-signed.apk" ]; then
cp app/build/outputs/apk/release/app-release-signed.apk final_apk/LastWave-v${VERSION}-release.apk
else
cp app/build/outputs/apk/release/app-release.apk final_apk/LastWave-v${VERSION}-release.apk
set +e
./gradlew assemble${BUILD_VARIANT} -PtvApp=true -PminSdk=23 $SIGNING_ARGS --stacktrace > tv_build.log 2>&1
GRADLE_RC=$?
set -e
echo "::notice::tv gradle rc=$GRADLE_RC variant=${BUILD_VARIANT:-UNSET}"
if [ "$GRADLE_RC" -ne 0 ]; then
grep -E '^e: ' tv_build.log | head -30 | while IFS= read -r l; do echo "::error::$l"; done || true
grep -E 'FAILURE:|> Task.*FAILED|Caused by:' tv_build.log | head -15 | while IFS= read -r l; do echo "::error::$l"; done || true
exit 1
fi
VERSION=$(grep 'versionName = ' app/build.gradle.kts | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
echo "APP_VERSION=$VERSION" >> "$GITHUB_ENV"
mkdir -p final_apk
cp "app/build/outputs/apk/${BUILD_VARIANT}/app-${BUILD_VARIANT}.apk" "final_apk/LastWave-TV-v${VERSION}-${BUILD_VARIANT}.apk"
ls -lh final_apk/

- name: Verify APK signature + publish checksum
Expand All @@ -110,9 +247,36 @@ jobs:
(cd final_apk && sha256sum *.apk > SHA256SUMS.txt)
cat final_apk/SHA256SUMS.txt

- name: Upload Release APK
- name: Upload APKs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: LastWave-v${{ steps.prep_apk.outputs.version }}-APK
name: LastWave-v${{ env.APP_VERSION }}-APKs
path: final_apk/*
if-no-files-found: error

- name: Publish APKs to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="v${APP_VERSION}"
# Same version already released? Swap every asset for the fresh
# build — the release always mirrors the latest successful run.
OLD_ASSETS=$(gh release view "$TAG" --json assets --jq '.assets[].name' 2>/dev/null || true)
if [ -n "$OLD_ASSETS" ]; then
while IFS= read -r a; do
gh release delete-asset "$TAG" "$a" -y || true
done <<< "$OLD_ASSETS"
fi
if gh release view "$TAG" --json id > /dev/null 2>&1; then
gh release upload "$TAG" final_apk/* --clobber
else
gh release create "$TAG" final_apk/* \
--target "$GITHUB_SHA" \
--title "LastWave v${APP_VERSION}" \
--notes "Automated build of ${GITHUB_SHA::7} (${BUILD_VARIANT} APKs)."
fi
echo "::notice::Published $TAG ($(ls final_apk | tr '\n' ' '))"
gh release view "$TAG" --json assets,url --jq '"Release: " + .url + " assets: " + ([.assets[].name] | join(", "))'
- name: Remove unsealed key material
if: always()
run: rm -rf signing signing-unsealed
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,18 @@
## [Unreleased]

### Added & Improved
- **Android TV (Leanback) Support:** LastWave now runs natively on Android TV, Google TV and Fire TV from the same APK. A dedicated D-pad home (Now Playing hero, top tracks and recently played from your listening history, remote-keyboard search) launches from the TV home screen, driven by the same process-wide MusicPlayer — queue, radio and the media session behave exactly as on phone. The phone launcher is untouched and the TV activity is declared separately, so phones list only the touch UI.
- **Recommendation Provider Switch:** Settings → Spotify now offers a recommendation provider choice. Pick Spotify to seed Home shelves, Quick Picks, radio, Discover and mixes from your Spotify taste; the switch applies everywhere and invalidates the cached home feed. Spotify only supplies the seeds — tracks are matched back to playable YouTube Music, and any failure or empty answer silently keeps the YouTube Music graph, so playback never breaks.

### Fixed
- **Seekable FLAC Downloads:** Fixed fragmented-MP4 header parsing (FullBox version/flags offsets) so STREAMINFO total samples, sidx timescale and duration patching land on the right fields and FLAC downloads seek correctly.
- **Android TV on API 23:** DataStore lowered to 1.1.7 so the TV build keeps its Android 6.0 minimum instead of being forced to API 24 by DataStore 1.3.
- **TV Lyrics Scrolling:** Holding the D-pad on the lyrics screen now steers the list instantly and stops the moment the key is released, instead of letting queued scroll animations keep gliding.
- **Artist Profile Backdrop:** The artist page now paints a solid background and slides in smoothly, so the browse screen no longer shows through behind it.
- **Virtual Pointer on Sign-In Pages:** The virtual mouse pointer is now always on in sign-in pages — parked at the centre the moment a page opens, no first D-pad press needed. The pointer options were removed from the setup wizard and TV Settings.
- **Setup Welcome Logo:** The setup screen now shows the original LastWave mark — the dark bars on the logo's lime disc — instead of the barely visible dark-on-dark bars.
- **Security Hardening:** Login sessions (the Spotify sp_dc store and the YouTube sign-in cookies) are now excluded from device backups and phone-to-phone transfers, and the sign-in pages refuse cleartext (HTTP) subresources so a hostile network cannot inject anything into a page that captures credentials.

## [5.0.0] - 2026-10-30

### Added & Improved
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ For audio lovers, LastWave packs Bit-Perfect USB DAC output, Lossless FLAC addon
#### Playback
- Stream any track or video from YouTube Music
- Background playback with lockscreen & Android Auto controls
- Native Android TV / Google TV (Leanback) home with D-pad navigation
- High-res audio downloads with embedded tags & `.lrc` lyrics
- Download & cache for offline listening
- Skip silence & sleep timer
Expand Down
29 changes: 28 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,26 @@ android {
// island and is almost never already installed outside China.
val vivoOrigin = (project.findProperty("vivoOrigin") as? String)?.toBoolean() == true

// Android TV build: `-PtvApp=true` ships the same app as a separate
// package (com.lastwave.app.tv) so the TV APK installs alongside the
// phone app instead of replacing it. Still one universal APK.
val tvApp = (project.findProperty("tvApp") as? String)?.toBoolean() == true

// App ships English-only: strip every other locale from the APK
// (AGP 9 replacement for the deprecated resourceConfigurations).
androidResources {
localeFilters += setOf("en")
}


defaultConfig {
applicationId = if (vivoOrigin) "com.tencent.qqmusic" else "com.lastwave.app"
applicationId = when {
vivoOrigin -> "com.tencent.qqmusic"
tvApp -> "com.lastwave.app.tv"
else -> "com.lastwave.app"
}
buildConfigField("boolean", "VIVO_ORIGIN", vivoOrigin.toString())
buildConfigField("boolean", "TV_APP", tvApp.toString())
minSdk = (project.findProperty("minSdk") as? String)?.toIntOrNull() ?: 29
targetSdk = 35
versionCode = 33
Expand Down Expand Up @@ -316,6 +333,8 @@ android {
storePassword = storePasswordProp
keyAlias = keyAliasProp
keyPassword = keyPasswordProp
// Store type override (e.g. PKCS12 from the DollBloom unseal flow).
resolveSecret("RELEASE_STORE_TYPE").takeIf { it.isNotBlank() }?.let { storeType = it }
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
Expand All @@ -332,7 +351,15 @@ android {
// so debug builds and unit tests keep working with no signing
// secrets present on a dev machine.
if (requestsRelease) {
println(
"LastWave signing probe: SIGNING_KEY blank=" + (base64Key.isBlank()).toString() +
", RELEASE_STORE_FILE blank=" + (storeFilePath.isBlank()).toString() +
", STORE_PASSWORD blank=" + (storePasswordProp.isBlank()).toString() +
", keystoreFile=" + (releaseKeystoreFile?.absolutePath ?: "null") +
", exists=" + (releaseKeystoreFile?.exists()?.toString() ?: "n/a")
)
throw GradleException(

"No release signing key found. Provide SIGNING_KEY (base64 " +
"keystore) or RELEASE_STORE_FILE + RELEASE_STORE_PASSWORD + " +
"RELEASE_KEY_ALIAS. Refusing to sign a release variant with " +
Expand Down
28 changes: 27 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,19 @@
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<uses-feature
<uses-feature
android:name="android.hardware.usb.host"
android:required="false" />

<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

<!-- TV builds ship the same APK; leanback is optional so phones still see it. -->
<uses-feature
android:name="android.software.leanback"
android:required="false" />

<application
android:name=".LastWaveApplication"
android:allowBackup="true"
Expand Down Expand Up @@ -252,6 +261,23 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<!-- Android TV / Google TV / Fire TV launcher (leanback). The phone
activity stays leanback-free, so TV home screens list only this. -->
<activity
android:name=".ui.tv.TvHomeActivity"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:banner="@drawable/tv_banner"
android:theme="@style/Theme.LastWave.Splash"
android:launchMode="singleTask"
android:configChanges="uiMode|density|screenSize|smallestScreenSize|screenLayout|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>



<!-- Native background music player service -->
Expand Down
Loading