diff --git a/apps/android/README.md b/apps/android/README.md index 008941ecda7..8ab8543acf4 100644 --- a/apps/android/README.md +++ b/apps/android/README.md @@ -34,7 +34,18 @@ cd ../.. bun run android:bundle:release ``` -`bun run android:bundle:release` auto-bumps Android `versionName`/`versionCode` in `apps/android/app/build.gradle.kts`, then builds a signed release `.aab`. +`bun run android:bundle:release` auto-bumps Android `versionName`/`versionCode` in `apps/android/app/build.gradle.kts`, then builds two signed release bundles: + +- Play build: `apps/android/build/release-bundles/openclaw--play-release.aab` +- Third-party build: `apps/android/build/release-bundles/openclaw--third-party-release.aab` + +Flavor-specific direct Gradle tasks: + +```bash +cd apps/android +./gradlew :app:bundlePlayRelease +./gradlew :app:bundleThirdPartyRelease +``` ## Kotlin Lint + Format @@ -194,6 +205,9 @@ Current OpenClaw Android implication: - APK / sideload build can keep SMS and Call Log features. - Google Play build should exclude SMS send/search and Call Log search unless the product is intentionally positioned and approved as a default-handler exception case. +- The repo now ships this split as Android product flavors: + - `play`: removes `READ_SMS`, `SEND_SMS`, and `READ_CALL_LOG`, and hides SMS / Call Log surfaces in onboarding, settings, and advertised node capabilities. + - `thirdParty`: keeps the full permission set and the existing SMS / Call Log functionality. Policy links: diff --git a/apps/android/app/build.gradle.kts b/apps/android/app/build.gradle.kts index 46afccbc3bf..73882f69439 100644 --- a/apps/android/app/build.gradle.kts +++ b/apps/android/app/build.gradle.kts @@ -65,14 +65,29 @@ android { applicationId = "ai.openclaw.app" minSdk = 31 targetSdk = 36 - versionCode = 2026031400 - versionName = "2026.3.14" + versionCode = 2026032000 + versionName = "2026.3.20" ndk { // Support all major ABIs — native libs are tiny (~47 KB per ABI) abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") } } + flavorDimensions += "store" + + productFlavors { + create("play") { + dimension = "store" + buildConfigField("boolean", "OPENCLAW_ENABLE_SMS", "false") + buildConfigField("boolean", "OPENCLAW_ENABLE_CALL_LOG", "false") + } + create("thirdParty") { + dimension = "store" + buildConfigField("boolean", "OPENCLAW_ENABLE_SMS", "true") + buildConfigField("boolean", "OPENCLAW_ENABLE_CALL_LOG", "true") + } + } + buildTypes { release { if (hasAndroidReleaseSigning) { @@ -140,8 +155,13 @@ androidComponents { .forEach { output -> val versionName = output.versionName.orNull ?: "0" val buildType = variant.buildType - - val outputFileName = "openclaw-$versionName-$buildType.apk" + val flavorName = variant.flavorName?.takeIf { it.isNotBlank() } + val outputFileName = + if (flavorName == null) { + "openclaw-$versionName-$buildType.apk" + } else { + "openclaw-$versionName-$flavorName-$buildType.apk" + } output.outputFileName = outputFileName } } diff --git a/apps/android/app/src/play/AndroidManifest.xml b/apps/android/app/src/play/AndroidManifest.xml new file mode 100644 index 00000000000..8793dce6d39 --- /dev/null +++ b/apps/android/app/src/play/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/apps/android/scripts/build-release-aab.ts b/apps/android/scripts/build-release-aab.ts index 30e4bb0390b..625b825e620 100644 --- a/apps/android/scripts/build-release-aab.ts +++ b/apps/android/scripts/build-release-aab.ts @@ -7,7 +7,28 @@ import { fileURLToPath } from "node:url"; const scriptDir = dirname(fileURLToPath(import.meta.url)); const androidDir = join(scriptDir, ".."); const buildGradlePath = join(androidDir, "app", "build.gradle.kts"); -const bundlePath = join(androidDir, "app", "build", "outputs", "bundle", "release", "app-release.aab"); +const releaseOutputDir = join(androidDir, "build", "release-bundles"); + +const releaseVariants = [ + { + flavorName: "play", + gradleTask: ":app:bundlePlayRelease", + bundlePath: join(androidDir, "app", "build", "outputs", "bundle", "playRelease", "app-play-release.aab"), + }, + { + flavorName: "third-party", + gradleTask: ":app:bundleThirdPartyRelease", + bundlePath: join( + androidDir, + "app", + "build", + "outputs", + "bundle", + "thirdPartyRelease", + "app-thirdParty-release.aab", + ), + }, +] as const; type VersionState = { versionName: string; @@ -88,6 +109,15 @@ async function verifyBundleSignature(path: string): Promise { await $`jarsigner -verify ${path}`.quiet(); } +async function copyBundle(sourcePath: string, destinationPath: string): Promise { + const sourceFile = Bun.file(sourcePath); + if (!(await sourceFile.exists())) { + throw new Error(`Signed bundle missing at ${sourcePath}`); + } + + await Bun.write(destinationPath, sourceFile); +} + async function main() { const buildGradleFile = Bun.file(buildGradlePath); const originalText = await buildGradleFile.text(); @@ -102,24 +132,28 @@ async function main() { console.log(`Android versionCode -> ${nextVersion.versionCode}`); await Bun.write(buildGradlePath, updatedText); + await $`mkdir -p ${releaseOutputDir}`; try { - await $`./gradlew :app:bundleRelease`.cwd(androidDir); + await $`./gradlew ${releaseVariants[0].gradleTask} ${releaseVariants[1].gradleTask}`.cwd(androidDir); } catch (error) { await Bun.write(buildGradlePath, originalText); throw error; } - const bundleFile = Bun.file(bundlePath); - if (!(await bundleFile.exists())) { - throw new Error(`Signed bundle missing at ${bundlePath}`); + for (const variant of releaseVariants) { + const outputPath = join( + releaseOutputDir, + `openclaw-${nextVersion.versionName}-${variant.flavorName}-release.aab`, + ); + + await copyBundle(variant.bundlePath, outputPath); + await verifyBundleSignature(outputPath); + const hash = await sha256Hex(outputPath); + + console.log(`Signed AAB (${variant.flavorName}): ${outputPath}`); + console.log(`SHA-256 (${variant.flavorName}): ${hash}`); } - - await verifyBundleSignature(bundlePath); - const hash = await sha256Hex(bundlePath); - - console.log(`Signed AAB: ${bundlePath}`); - console.log(`SHA-256: ${hash}`); } await main();