diff --git a/App_Resources/Android/app.gradle b/App_Resources/Android/app.gradle index 99e36fe3..f610bbff 100644 --- a/App_Resources/Android/app.gradle +++ b/App_Resources/Android/app.gradle @@ -264,15 +264,21 @@ if (faceclawVersionFile.exists()) { faceclawVersionName = faceclawVersionMatch.group(1) } } +def faceclawBuildRevision = System.getenv("FACECLAW_ANDROID_BUILD_REVISION") ?: "0" +if (!(faceclawBuildRevision ==~ /[0-4]/)) { + throw new GradleException("FACECLAW_ANDROID_BUILD_REVISION must be an integer from 0 to 4") +} def faceclawVersionCode = { // Prerelease labels belong in versionName, not the numeric versionCode. def parts = (faceclawVersionName.split('-')[0].tokenize('.') + ["0", "0"]).take(3)*.toInteger() - return parts[0] * 10000 + parts[1] * 100 + parts[2] + // Last digit: build revision * 2, plus form factor (phone 0, Wear OS 1). + // Play requires distinct version codes even on separate form-factor tracks. + return (parts[0] * 10000 + parts[1] * 100 + parts[2]) * 10 + faceclawBuildRevision.toInteger() * 2 }() android { - compileSdkVersion 35 - buildToolsVersion "35" + compileSdkVersion 36 + buildToolsVersion "36.0.0" // ndkVersion "" sourceSets.main { @@ -282,7 +288,7 @@ android { defaultConfig { minSdkVersion 24 - targetSdkVersion 35 + targetSdkVersion 36 ndk { // The NativeScript platform build.gradle has already added all four // ABIs by the time app.gradle is applied, and abiFilters is additive, diff --git a/PRIVACY b/PRIVACY index f906afdf..7b17a895 100644 --- a/PRIVACY +++ b/PRIVACY @@ -5,6 +5,8 @@ collects and shares information when you use an iOS TestFlight build, even when Faceclaw statistics are set to None. Information you voluntarily send us, such as feedback, may also identify you. This policy describes these separate channels and the third-party services you can choose to use. +On Android, Google ML Kit also collects SDK diagnostics separately from +Faceclaw statistics, as described below. ## Usage Statistics @@ -16,7 +18,8 @@ your choice at any time in Settings > Privacy > Faceclaw statistics. Until you choose, it is None. This setting controls only Faceclaw's own statistics. With None, Faceclaw sends and stores none of its own usage statistics. This -does not disable Apple's TestFlight reports or services you choose to use. +does not disable Apple's TestFlight reports, Google ML Kit diagnostics, or +services you choose to use. With Minimal, Faceclaw keeps counts on your phone and sends them about once a day to stats.faceclaw.org, a server run by Faceclaw's developers: @@ -48,6 +51,27 @@ phone, and stops all reports; turning them back on starts a new identifier. The statistics server doesn't record the IP addresses reports come from. +## Android and Google ML Kit + +Android translation and language identification use Google ML Kit. The +developer QR-code scanner uses Google's code scanner. Text and scanner +images are processed on-device, but the SDKs send Google diagnostic and +usage metrics over HTTPS: device/app details, installation identifiers, +timings, errors, feature events, input/output sizes, and detected or +configured languages. Translation also uses Firebase installation and +remote-configuration services. This reporting is separate from the +Faceclaw statistics setting; selecting None does not turn it off. Faceclaw +does not provide a switch to disable these SDK diagnostics. + +These metrics do not include the text being translated or scanned images. +Cloud transcription and assistant providers are separate, as described below. +For Google's handling of SDK metrics, see: + + https://developers.google.com/ml-kit/android-data-disclosure + https://developers.google.com/ml-kit/terms + https://policies.google.com/privacy + + ## iOS and TestFlight For TestFlight builds, Apple automatically collects crash reports and beta diff --git a/README.md b/README.md index 6952f2dc..fc17edc5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The instructions below build the Android app. If you want to customize faceclaw, the best way to do it is to download the source code and using a coding agent such as Codex or Claude Code. -To compile, you will need an Android SDK environment with SDK version 35 +To compile, you will need an Android SDK environment with SDK version 36 installed and licenses accepted, and the ANDROID_HOME pointing to the install. You will need Nativescript installed, and a JDK environment (v21), with the JAVA_HOME environment variable pointed at it. You will also need a reasonably diff --git a/app/analytics/privacy-disclosure.ts b/app/analytics/privacy-disclosure.ts index ede51f26..2ba2d915 100644 --- a/app/analytics/privacy-disclosure.ts +++ b/app/analytics/privacy-disclosure.ts @@ -4,3 +4,6 @@ */ export const IOS_PRIVACY_SUMMARY = "With TestFlight, crash/usage reports continue even with None. See Privacy policy for details."; + +export const ANDROID_PRIVACY_SUMMARY = + "Google ML Kit diagnostics for translation and QR scanning are separate from this setting. See Privacy policy for details."; diff --git a/app/apps/onboarding/data-collection-page.ts b/app/apps/onboarding/data-collection-page.ts index ad52e32b..3cce2c28 100644 --- a/app/apps/onboarding/data-collection-page.ts +++ b/app/apps/onboarding/data-collection-page.ts @@ -32,9 +32,9 @@ export class DataCollectionPage implements OnboardingPage { paint(image: GrayImage, focused: boolean): void { const top = drawPageHeading( image, - "Data Sharing", - (global.isIOS ? "If using TestFlight, crash/usage reports cannot be disabled here. " : "") + - "Choose how much data you want to share. Change later in Settings > Privacy.", + "Faceclaw Statistics", + (global.isIOS ? "TestFlight reports are separate. " : "Google ML Kit diagnostics are separate. ") + + "Choose Faceclaw statistics below. Details and controls: Settings > Privacy.", 3, ) + CONTENT_GAP; const body = onboardingFont("body"); diff --git a/app/ui/dashboard-settings.ts b/app/ui/dashboard-settings.ts index fdf914e0..292423e9 100644 --- a/app/ui/dashboard-settings.ts +++ b/app/ui/dashboard-settings.ts @@ -28,7 +28,7 @@ import { LIST_ROW_TEXT_INSET, lineStep } from "./metrics"; import { Layer, type LayerContext } from "./layers"; import { GrayImage } from "~/graphics/image"; import type { DataCollectionLevel } from "../analytics/analytics-store"; -import { IOS_PRIVACY_SUMMARY } from "../analytics/privacy-disclosure"; +import { ANDROID_PRIVACY_SUMMARY, IOS_PRIVACY_SUMMARY } from "../analytics/privacy-disclosure"; export type NightscoutSettings = { siteUrl: string; @@ -858,7 +858,7 @@ const DATA_COLLECTION_LABELS: Record = { // What each level collects is set out in app/analytics/analytics-store.ts and // the privacy policy (PRIVACY); keep these in step with both. const DATA_COLLECTION_SUMMARIES: Record = { - none: "Disable all data sharing", + none: "No Faceclaw statistics", minimal: "Version, devices, and connection reliability statistics", full: "More detailed usage data", }; @@ -877,7 +877,7 @@ export const dataCollectionSetting = new ConfigSettingEnum( values: ["none", "minimal", "full"], formatValue: (value) => DATA_COLLECTION_LABELS[value], description: - (global.isIOS ? IOS_PRIVACY_SUMMARY + " " : "") + + (global.isIOS ? IOS_PRIVACY_SUMMARY : ANDROID_PRIVACY_SUMMARY) + " " + "Optional statistics Faceclaw may send its developers once a day, to help fix problems and improve the " + "app. None: no Faceclaw statistics are stored or sent. Minimal: the app version, which devices are " + "paired and in use, and how reliable the connection to them is. Full: also settings chosen from fixed " + diff --git a/native/kotlin/shared/build.gradle.kts b/native/kotlin/shared/build.gradle.kts index a3df3c82..0d090087 100644 --- a/native/kotlin/shared/build.gradle.kts +++ b/native/kotlin/shared/build.gradle.kts @@ -16,7 +16,7 @@ kotlin { } android { namespace = "com.faceclaw.shared" - compileSdk = 35 + compileSdk = 36 minSdk = 24 compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } withHostTestBuilder {}.configure {} diff --git a/scripts/release.sh b/scripts/release.sh index 471ff59b..e74d58b2 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Build signed release APKs at dist/Faceclaw-.apk (phone) and -# dist/Faceclaw-Wear-.apk (watch), where comes from -# FACECLAW_VERSION in app/version.ts. Both are signed with the same key: +# Build signed release APKs and AABs at dist/Faceclaw-.{apk,aab} +# (phone) and dist/Faceclaw-Wear-.{apk,aab} (watch), where +# comes from FACECLAW_VERSION in app/version.ts. All use the same key: # the Wearable Data Layer only routes between apps with matching package # names and signing keys. # @@ -17,18 +17,20 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT" source scripts/before_build.sh -if [ ! -f "$ANDROID_KEYSTORE" ]; then - echo "Keystore not found: $ANDROID_KEYSTORE (set ANDROID_KEYSTORE in build_paths.sh)" >&2 +export FACECLAW_ANDROID_BUILD_REVISION="${FACECLAW_ANDROID_BUILD_REVISION:-0}" +case "$FACECLAW_ANDROID_BUILD_REVISION" in + [0-4]) ;; + *) echo "FACECLAW_ANDROID_BUILD_REVISION must be an integer from 0 to 4" >&2; exit 1 ;; +esac + +if [ ! -f "${ANDROID_KEYSTORE:-}" ]; then + echo "Keystore not found: ${ANDROID_KEYSTORE:-unset} (set ANDROID_KEYSTORE in build_paths.sh)" >&2 exit 1 fi -# build.sh is the machine-specific wrapper that exports JAVA_HOME/ANDROID_HOME. -# Pick up its exports so keytool and the build use the same JDK. -if [ -f build.sh ]; then - eval "$(grep '^export ' build.sh)" -fi +# before_build.sh loads JAVA_HOME/ANDROID_HOME from build_paths.sh. if ! command -v keytool >/dev/null; then - echo "keytool not found; set JAVA_HOME (usually via build.sh)" >&2 + echo "keytool not found; set JAVA_HOME and PATH in build_paths.sh" >&2 exit 1 fi @@ -52,44 +54,71 @@ if [ -z "$ALIAS" ]; then printf '%s\n' "$LISTING" >&2 exit 1 fi -echo "Signing as '$ALIAS', version $VERSION" +echo "Signing as '$ALIAS', version $VERSION, Android build revision $FACECLAW_ANDROID_BUILD_REVISION" read -r -s -p "Key passphrase for '$ALIAS' (empty = same as keystore): " KEY_PASS echo KEY_PASS="${KEY_PASS:-$STORE_PASS}" OUT="dist/Faceclaw-$VERSION.apk" +BUNDLE_OUT="dist/Faceclaw-$VERSION.aab" WEAR_OUT="dist/Faceclaw-Wear-$VERSION.apk" +WEAR_BUNDLE_OUT="dist/Faceclaw-Wear-$VERSION.aab" mkdir -p dist -rm -f "$OUT" "$WEAR_OUT" +# Keep existing release artifacts until every build and verification succeeds. +STAGING_DIR="$(mktemp -d "$ROOT/dist/.release-XXXXXX")" +trap 'rm -rf "$STAGING_DIR"' EXIT + +PHONE_SIGNING_ARGS=( + --key-store-path "$ANDROID_KEYSTORE" + --key-store-password "$STORE_PASS" + --key-store-alias "$ALIAS" + --key-store-alias-password "$KEY_PASS" +) echo "=== Building Android app ===" npx nativescript build android --release \ - --key-store-path "$ANDROID_KEYSTORE" \ - --key-store-password "$STORE_PASS" \ - --key-store-alias "$ALIAS" \ - --key-store-alias-password "$KEY_PASS" \ - --copy-to "$OUT" + "${PHONE_SIGNING_ARGS[@]}" --copy-to "$STAGING_DIR/phone.apk" + +echo "=== Building Android app bundle ===" +npx nativescript build android --release --aab \ + "${PHONE_SIGNING_ARGS[@]}" --copy-to "$STAGING_DIR/phone.aab" # Wear app: sign with the same key via AGP's injected signing properties, so # no signing config needs to live in the wear build files. echo "=== Building Wear app ===" -(cd wear && ./gradlew :app:assembleRelease \ +(cd wear && ./gradlew :app:assembleRelease :app:bundleRelease \ -Pandroid.injected.signing.store.file="$ANDROID_KEYSTORE" \ -Pandroid.injected.signing.store.password="$STORE_PASS" \ -Pandroid.injected.signing.key.alias="$ALIAS" \ -Pandroid.injected.signing.key.password="$KEY_PASS") -cp wear/app/build/outputs/apk/release/app-release.apk "$WEAR_OUT" - -echo -echo "Built $OUT" -echo "Built $WEAR_OUT" +cp wear/app/build/outputs/apk/release/app-release.apk "$STAGING_DIR/wear.apk" +cp wear/app/build/outputs/bundle/release/app-release.aab "$STAGING_DIR/wear.aab" if [ -n "${ANDROID_HOME:-}" ] && [ -d "$ANDROID_HOME/build-tools" ]; then APKSIGNER="$(printf '%s\n' "$ANDROID_HOME/build-tools"/*/apksigner | sort -V | tail -1)" if [ -x "$APKSIGNER" ]; then - for apk in "$OUT" "$WEAR_OUT"; do + for apk in "$STAGING_DIR/phone.apk" "$STAGING_DIR/wear.apk"; do echo "== $apk" - "$APKSIGNER" verify --print-certs "$apk" | head -5 + "$APKSIGNER" verify --print-certs "$apk" done fi fi + +# AABs use JAR signing, not APK signing. jarsigner can return success for an +# unsigned ZIP, so require its explicit verification result too. +for bundle in "$STAGING_DIR/phone.aab" "$STAGING_DIR/wear.aab"; do + echo "== $bundle" + if ! jarsigner -J-Duser.language=en -J-Duser.country=US -verify "$bundle" > "$STAGING_DIR/jarsigner.log" 2>&1 \ + || ! grep -q '^jar verified\.' "$STAGING_DIR/jarsigner.log"; then + cat "$STAGING_DIR/jarsigner.log" >&2 + echo "App bundle signature could not be verified: $bundle" >&2 + exit 1 + fi + echo "App bundle signature verified." +done + +mv "$STAGING_DIR/phone.apk" "$OUT" +mv "$STAGING_DIR/phone.aab" "$BUNDLE_OUT" +mv "$STAGING_DIR/wear.apk" "$WEAR_OUT" +mv "$STAGING_DIR/wear.aab" "$WEAR_BUNDLE_OUT" +printf '\nBuilt %s\n' "$OUT" "$BUNDLE_OUT" "$WEAR_OUT" "$WEAR_BUNDLE_OUT" diff --git a/wear/README.md b/wear/README.md index 1772f725..3cb5789c 100644 --- a/wear/README.md +++ b/wear/README.md @@ -102,7 +102,10 @@ Two things must match the phone app or the Data Layer silently won't route: building both on the same computer just works. For release builds, sign the watch APK with the same keystore as the phone APK. -There's no Play Store listing; sideload. +Run `npm run release` from the repository root to build signed phone and Wear +APKs for sideloading and AABs for Google Play. Both apps use the version in +`app/version.ts`, with distinct version codes for the phone and Wear tracks; +see [Android releases](../README.md#android-releases). ## Troubleshooting diff --git a/wear/app/build.gradle.kts b/wear/app/build.gradle.kts index 3af540f5..08881e5f 100644 --- a/wear/app/build.gradle.kts +++ b/wear/app/build.gradle.kts @@ -4,9 +4,21 @@ plugins { id("org.jetbrains.kotlin.plugin.compose") } +// Match the phone's marketing version, with a distinct Play upload code. +val faceclawVersionName = Regex("""FACECLAW_VERSION = "([^"]+)"""") + .find(rootProject.file("../app/version.ts").readText())?.groupValues?.get(1) + ?: error("Could not read FACECLAW_VERSION from app/version.ts") +val faceclawVersionParts = (faceclawVersionName.substringBefore('-').split('.') + listOf("0", "0")) + .take(3).map { it.toInt() } +val faceclawBuildRevision = System.getenv("FACECLAW_ANDROID_BUILD_REVISION") ?: "0" +require(faceclawBuildRevision.matches(Regex("[0-4]"))) { + "FACECLAW_ANDROID_BUILD_REVISION must be an integer from 0 to 4" +} +val faceclawVersionCode = (faceclawVersionParts[0] * 10000 + faceclawVersionParts[1] * 100 + faceclawVersionParts[2]) * 10 + faceclawBuildRevision.toInt() * 2 + 1 + android { namespace = "com.faceclaw.wear" - compileSdk = 35 + compileSdk = 36 defaultConfig { // Must equal the phone app's id (nativescript.config.ts): the Wearable @@ -14,9 +26,9 @@ android { // signing key. applicationId = "com.faceclaw.app" minSdk = 30 - targetSdk = 35 - versionCode = 1 - versionName = "1.0.0" + targetSdk = 36 + versionCode = faceclawVersionCode + versionName = faceclawVersionName } buildTypes { diff --git a/wear/build.gradle.kts b/wear/build.gradle.kts index 0fdc2bca..643b24e5 100644 --- a/wear/build.gradle.kts +++ b/wear/build.gradle.kts @@ -3,7 +3,7 @@ // (for release builds) the signing key, both of which the Wearable Data // Layer requires to match the phone app. plugins { - id("com.android.application") version "8.7.3" apply false + id("com.android.application") version "8.13.2" apply false id("org.jetbrains.kotlin.android") version "2.1.10" apply false id("org.jetbrains.kotlin.plugin.compose") version "2.1.10" apply false } diff --git a/website/privacy.html b/website/privacy.html index e07acb5a..a6ec2bab 100644 --- a/website/privacy.html +++ b/website/privacy.html @@ -27,10 +27,10 @@

Faceclaw Privacy Policy

-

Faceclaw's own usage statistics are off unless you opt in. Separately, Apple collects and shares information when you use an iOS TestFlight build, even when Faceclaw statistics are set to None. Information you voluntarily send us, such as feedback, may also identify you. This policy describes these separate channels and the third-party services you can choose to use.

+

Faceclaw's own usage statistics are off unless you opt in. Separately, Apple collects and shares information when you use an iOS TestFlight build, even when Faceclaw statistics are set to None. Information you voluntarily send us, such as feedback, may also identify you. This policy describes these separate channels and the third-party services you can choose to use. On Android, Google ML Kit also collects SDK diagnostics separately from Faceclaw statistics, as described below.

Usage Statistics

The first time you connect your glasses, Faceclaw asks whether to share usage statistics with its developers, to help them fix problems and improve the app. The choices are None, Minimal and Full, and you can change your choice at any time in Settings > Privacy > Faceclaw statistics. Until you choose, it is None. This setting controls only Faceclaw's own statistics.

-

With None, Faceclaw sends and stores none of its own usage statistics. This does not disable Apple's TestFlight reports or services you choose to use.

+

With None, Faceclaw sends and stores none of its own usage statistics. This does not disable Apple's TestFlight reports, Google ML Kit diagnostics, or services you choose to use.

With Minimal, Faceclaw keeps counts on your phone and sends them about once a day to stats.faceclaw.org, a server run by Faceclaw's developers:

Faceclaw's own statistics never include your name or contact details, your location, Bluetooth device addresses, anything you say or type, or what is shown on your glasses. Each report carries a random identifier, created when you turn statistics on, which links your reports to each other but not to you. Turning statistics off deletes that identifier and everything kept on the phone, and stops all reports; turning them back on starts a new identifier. The statistics server doesn't record the IP addresses reports come from.

+

Android and Google ML Kit

+

Android translation and language identification use Google ML Kit. The developer QR-code scanner uses Google's code scanner. Text and scanner images are processed on-device, but the SDKs send Google diagnostic and usage metrics over HTTPS: device/app details, installation identifiers, timings, errors, feature events, input/output sizes, and detected or configured languages. Translation also uses Firebase installation and remote-configuration services. This reporting is separate from the Faceclaw statistics setting; selecting None does not turn it off. Faceclaw does not provide a switch to disable these SDK diagnostics.

+

These metrics do not include the text being translated or scanned images. Cloud transcription and assistant providers are separate, as described below. For Google's handling of SDK metrics, see:

+

iOS and TestFlight

For TestFlight builds, Apple automatically collects crash reports and beta usage information and shares them with us. This includes installations, sessions, crashes, app/build and OS versions, device model and identifier, and language. It is separate from Faceclaw statistics, with no in-app opt-out.

Joining only through a public TestFlight link hides your name and email from us, not from Apple. Email invitations can identify you to us. Apple also collects your device's name (not shared with us) and may use your IP address to estimate your region for beta availability.