diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index cf19e109..5462e2c1 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -2,6 +2,8 @@ plugins {
id("com.android.application")
id("org.jetbrains.kotlin.plugin.compose")
}
+/** The release's build number: versionCode is this x 10 plus the edition's channel. */
+val ORBIT_BUILD = 40
android {
namespace = "tv.orbit.classic"
compileSdk = 36
@@ -9,16 +11,25 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
- versionCode = 323
- versionName = "0.126.0-noserver"
+ versionName = "0.127.0"
+ }
+ // Two editions of the same app (Paul, 10 November 2026): the household build, which updates itself between rooms, and the
+ // Play build, which only Google Play updates. Both are tv.orbit.classic, so a TV can move between them keeping its data.
+ // One version-code counter for both: build x 10 + channel (0 household, 2 Play, 9 a recovery build of that build), so the
+ // Play build of a release is just above the household one and the next release is above both. Build 40 is the first:
+ // every earlier code, the reserved 390 recovery build among them, is below it (tools/check_version_codes.py).
+ flavorDimensions += "edition"
+ productFlavors {
+ create("household") { dimension = "edition"; versionCode = ORBIT_BUILD * 10 + 0 }
+ create("play") { dimension = "edition"; versionCode = ORBIT_BUILD * 10 + 2; versionNameSuffix = "-play" }
}
buildFeatures { compose = true }
// The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so
- // Android compiles it fully; signed with the same key as the test builds, so it installs over them keeping everything.
+ // Android compiles it fully. Unsigned (Paul, 10 November 2026): nothing is signed until he approves the new signing key.
buildTypes {
release {
isMinifyEnabled = false
- signingConfig = signingConfigs.getByName("debug")
+ signingConfig = null
}
// The playback test build (Paul, 9 November 2026): a separate app, tv.orbit.classic.playtest, with its own data, so it
// can never touch the household's schedules, Taste or Continue watching. Its adb-only test player lives in
@@ -34,6 +45,8 @@ android {
testOptions { unitTests.isReturnDefaultValues = true }
compileOptions { sourceCompatibility = JavaVersion.VERSION_17; targetCompatibility = JavaVersion.VERSION_17 }
}
+// The playback test build is household only: there's no Play test build.
+androidComponents { beforeVariants { v -> if (v.buildType == "playtest" && v.productFlavors.any { it.second == "play" }) v.enable = false } }
dependencies {
implementation(platform("androidx.compose:compose-bom:2025.08.01"))
implementation("androidx.activity:activity-compose:1.10.1")
diff --git a/android/app/src/household/AndroidManifest.xml b/android/app/src/household/AndroidManifest.xml
new file mode 100644
index 00000000..ed0f48f4
--- /dev/null
+++ b/android/app/src/household/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/household/java/tv/orbit/classic/Edition.kt b/android/app/src/household/java/tv/orbit/classic/Edition.kt
new file mode 100644
index 00000000..da66a5de
--- /dev/null
+++ b/android/app/src/household/java/tv/orbit/classic/Edition.kt
@@ -0,0 +1,66 @@
+package tv.orbit.classic
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import androidx.compose.runtime.Composable
+import org.json.JSONObject
+import java.io.OutputStream
+
+/**
+ * The household edition (Paul, 10 November 2026): Orbit as the TVs at home run it. It shares itself with other rooms and
+ * installs a newer copy from one (RoomUpdates: same app, newer, signed exactly as installed, and Android asks the viewer),
+ * and it answers the adb-only requests: the install check, the provider and player switches, the shadow comparison and the
+ * hand-run playback test. None of this is in the Play edition.
+ */
+internal object Edition {
+ const val NAME = "household"
+
+ /** The adb-only requests, read at start and when adb sends them to an Orbit already open. */
+ fun readAdbRequests(activity: Activity, intent: Intent?) {
+ if (intent?.getBooleanExtra("orbit_intro_test", false) == true) IntroTrial.nextTune = true
+ intent?.getStringExtra("orbit_inspect_series")?.take(120)?.let { SeriesInspection.title = it }
+ if (intent?.getBooleanExtra("orbit_read_evidence", false) == true) EvidenceRequest.pending = true
+ // Provider contract, step 3: the catalogue switch and the read-only shadow comparison.
+ when (intent?.getStringExtra("orbit_provider_catalogue")) { "on" -> ProviderSwitches.setCatalogue(activity, true); "off" -> ProviderSwitches.setCatalogue(activity, false) }
+ // Player improvements (9 November 2026): frame-rate matching and AVI, each off until switched on.
+ when (intent?.getStringExtra("orbit_frame_rate")) { "on" -> PlayerSwitches.setFrameRate(activity, true); "off" -> PlayerSwitches.setFrameRate(activity, false) }
+ intent?.getStringExtra("orbit_even_volume")?.let { PlayerSwitches.setEvenVolume(activity, it) }
+ when (intent?.getStringExtra("orbit_avi")) { "on" -> PlayerSwitches.setAvi(activity, true); "off" -> PlayerSwitches.setAvi(activity, false) }
+ if (intent?.getBooleanExtra("orbit_shadow_catalogue_stop", false) == true) CatalogueShadow.cancel = true
+ if (intent?.hasExtra("orbit_shadow_from") == true) CatalogueShadow.from = intent.getLongExtra("orbit_shadow_from", 0L).coerceAtLeast(0L)
+ if (intent?.getBooleanExtra("orbit_shadow_resume", false) == true) CatalogueShadow.resume = true
+ if (intent?.hasExtra("orbit_shadow_catalogue") == true) CatalogueShadow.pending = intent.getIntExtra("orbit_shadow_catalogue", 5)
+ }
+
+ /** The hand-run playback test opens over Orbit, which stops in the background as it would for any other app, and comes back when it ends. */
+ fun openPlaybackTest(activity: Activity, intent: Intent?) {
+ intent?.getStringExtra("orbit_play_test")?.takeIf(EmbyClient::validId)?.let { item ->
+ activity.startActivity(Intent(activity, PlaybackTestActivity::class.java).putExtra(PlaybackTestActivity.ITEM, item))
+ }
+ }
+
+ suspend fun lookForUpdate(context: Context) = RoomUpdates.look(context)
+
+ fun sharedBuild(context: Context): SharedBuild? = RoomUpdates.shared(context)
+
+ @Composable fun UpdateCard() = RoomUpdateCard()
+
+ /** The two update routes on the room link: this Orbit's version, and its installed copy. True when [path] was one of them. */
+ fun serveUpdate(path: String, method: String, out: OutputStream, shared: SharedBuild?, json: (Int, JSONObject) -> Unit): Boolean {
+ if (path == "/room/version" && method == "GET") {
+ val build = shared ?: return true.also { json(404, JSONObject()) }
+ json(200, JSONObject().put("code", build.code).put("name", build.name).put("room", Rooms.name)); return true
+ }
+ if (path == "/room/orbit.apk" && method == "GET") {
+ // The installed copy, streamed: another room checks it's newer and signed as it is before Android installs it.
+ val build = shared?.takeIf { it.file.isFile } ?: return true.also { json(404, JSONObject()) }
+ val head = listOf("HTTP/1.1 200 OK", "Content-Type: application/vnd.android.package-archive", "Content-Length: ${build.file.length()}", "Cache-Control: no-store",
+ "X-Content-Type-Options: nosniff", "Connection: close").joinToString("\r\n") + "\r\n\r\n"
+ out.write(head.toByteArray(Charsets.ISO_8859_1)); build.file.inputStream().use { it.copyTo(out, 64 * 1024) }; out.flush()
+ android.util.Log.i("OrbitRooms", "update shared bytes=${build.file.length()}")
+ return true
+ }
+ return false
+ }
+}
diff --git a/android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt b/android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt
similarity index 97%
rename from android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt
rename to android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt
index fd81b29e..cbc86550 100644
--- a/android/app/src/main/java/tv/orbit/classic/InstallSnapshot.kt
+++ b/android/app/src/household/java/tv/orbit/classic/InstallSnapshot.kt
@@ -28,7 +28,7 @@ class InstallSnapshotReceiver : BroadcastReceiver() {
// adb can't make folders in Orbit's shared folder on Android 14, only put files in one Orbit made.
File(context.getExternalFilesDir(null), "install-restore").run { deleteRecursively(); mkdirs(); "ready" }
} else if (intent.getStringExtra("do") == "restore") {
- if (InstallSnapshot.screenOpen) "refused: Orbit is open; force-stop it first"
+ if (OrbitScreen.open) "refused: Orbit is open; force-stop it first"
else File(context.getExternalFilesDir(null), "install-restore").let { folder ->
// The pushed copy goes once it's been used, restored or refused.
try { InstallRestore.apply(context.filesDir.parentFile!!, folder, intent.getStringExtra("confirm"), System.currentTimeMillis()) }
@@ -49,8 +49,6 @@ class InstallSnapshotReceiver : BroadcastReceiver() {
}
internal object InstallSnapshot {
- /** Orbit's screen is open in this process (set by MainActivity); a restore waits until it isn't. */
- @Volatile var screenOpen = false
// A plain version, or one with a short suffix (0.110.7-arcade1), so a trial build's name doesn't refuse the rollback copy.
private val versionShape = Regex("""\d+\.\d+\.\d+(-[a-z0-9]+(-[a-z0-9]+)*)?""")
diff --git a/android/app/src/main/java/tv/orbit/classic/PlaybackTestActivity.kt b/android/app/src/household/java/tv/orbit/classic/PlaybackTestActivity.kt
similarity index 100%
rename from android/app/src/main/java/tv/orbit/classic/PlaybackTestActivity.kt
rename to android/app/src/household/java/tv/orbit/classic/PlaybackTestActivity.kt
diff --git a/android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt b/android/app/src/household/java/tv/orbit/classic/RoomUpdates.kt
similarity index 99%
rename from android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt
rename to android/app/src/household/java/tv/orbit/classic/RoomUpdates.kt
index bc3c77dc..f258fed6 100644
--- a/android/app/src/main/java/tv/orbit/classic/RoomUpdates.kt
+++ b/android/app/src/household/java/tv/orbit/classic/RoomUpdates.kt
@@ -41,7 +41,6 @@ import java.net.URL
* - Before installing, this room's schedules are copied aside (schedule-rollback-), as every install does.
* - Only on the home network, through the phone link, and only while the other Orbit is open.
*/
-internal class SharedBuild(val code: Long, val name: String, val file: File)
internal class UpdateOffer(val room: String, val address: String, val code: Long, val name: String)
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 490b9858..c1926292 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,5 @@
-
-
@@ -10,11 +8,5 @@
-
-
-
-
-
-
diff --git a/android/app/src/main/java/tv/orbit/classic/CatalogueShadow.kt b/android/app/src/main/java/tv/orbit/classic/CatalogueShadow.kt
index 9ff5f568..7000033f 100644
--- a/android/app/src/main/java/tv/orbit/classic/CatalogueShadow.kt
+++ b/android/app/src/main/java/tv/orbit/classic/CatalogueShadow.kt
@@ -95,7 +95,7 @@ internal object CatalogueShadow {
shouldStop = {
when {
cancel -> "cancelled"
- !InstallSnapshot.screenOpen -> "Orbit closed"
+ !OrbitScreen.open -> "Orbit closed"
PlaybackHealth.stalls - stallsAtStart >= MAX_STALLS -> "playback stalled $MAX_STALLS times"
runtime.totalMemory() - runtime.freeMemory() > runtime.maxMemory() * 8 / 10 -> "memory above 80%"
else -> null
diff --git a/android/app/src/main/java/tv/orbit/classic/Edition.kt b/android/app/src/main/java/tv/orbit/classic/Edition.kt
new file mode 100644
index 00000000..933fd212
--- /dev/null
+++ b/android/app/src/main/java/tv/orbit/classic/Edition.kt
@@ -0,0 +1,13 @@
+package tv.orbit.classic
+
+import java.io.File
+
+/**
+ * What the two editions share (Paul, 10 November 2026). Each edition has its own `Edition` object in its source set:
+ * src/household (updates between rooms, the adb install check and test hooks) and src/play (none of those; Google Play
+ * updates it). Everything else, Rooms, profiles, Taste, Continue Watching, the Arcade and sync, is the same code in both.
+ */
+internal class SharedBuild(val code: Long, val name: String, val file: File)
+
+/** Orbit's screen is open in this process (set by MainActivity): a restore waits until it isn't, and the shadow comparison stops. */
+internal object OrbitScreen { @Volatile var open = false }
diff --git a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt
index 54a3027e..1c95e571 100644
--- a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt
+++ b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt
@@ -53,35 +53,21 @@ class MainActivity : ComponentActivity() {
if (Onboarding.done(this)) {
RoomBeacon.on(this)
// Updates shared between rooms: a newer Orbit in another room is offered, with Install? and Not now.
- lifecycleScope.launch { runCatching { RoomUpdates.look(this@MainActivity) } }
+ lifecycleScope.launch { runCatching { Edition.lookForUpdate(this@MainActivity) } }
}
}
// Phones stay connected while Orbit is in the background (Paul, 8 November 2026: the web app couldn't connect while the TV
// was in another app), and paired rooms keep syncing; the phone says Orbit isn't on screen instead of failing to load.
- override fun onDestroy() { InstallSnapshot.screenOpen = false; super.onDestroy() }
+ override fun onDestroy() { OrbitScreen.open = false; super.onDestroy() }
override fun onStop() { WatchCheck.stopped(); OrbitCompanion.onTv = false; PhoneLink.offerRoom(null); if (PhoneLink.phones.isEmpty() && RoomLinks.links.none { it.on }) { RoomBeacon.off(this); PhoneLink.stop() }; super.onStop() }
/**
* The adb-only requests (inspection, evidence, the provider switch and shadow comparison). Read at start and, since Orbit
* opens as one copy (singleTask, 8 November 2026), also when adb sends them to an Orbit already open.
*/
- private fun readAdbRequests(intent: android.content.Intent?) {
- if (intent?.getBooleanExtra("orbit_intro_test", false) == true) IntroTrial.nextTune = true
- intent?.getStringExtra("orbit_inspect_series")?.take(120)?.let { SeriesInspection.title = it }
- if (intent?.getBooleanExtra("orbit_read_evidence", false) == true) EvidenceRequest.pending = true
- // Provider contract, step 3: the catalogue switch and the read-only shadow comparison.
- when (intent?.getStringExtra("orbit_provider_catalogue")) { "on" -> ProviderSwitches.setCatalogue(this, true); "off" -> ProviderSwitches.setCatalogue(this, false) }
- // Player improvements (9 November 2026): frame-rate matching and AVI, each off until switched on.
- when (intent?.getStringExtra("orbit_frame_rate")) { "on" -> PlayerSwitches.setFrameRate(this, true); "off" -> PlayerSwitches.setFrameRate(this, false) }
- intent?.getStringExtra("orbit_even_volume")?.let { PlayerSwitches.setEvenVolume(this, it) }
- when (intent?.getStringExtra("orbit_avi")) { "on" -> PlayerSwitches.setAvi(this, true); "off" -> PlayerSwitches.setAvi(this, false) }
- if (intent?.getBooleanExtra("orbit_shadow_catalogue_stop", false) == true) CatalogueShadow.cancel = true
- if (intent?.hasExtra("orbit_shadow_from") == true) CatalogueShadow.from = intent.getLongExtra("orbit_shadow_from", 0L).coerceAtLeast(0L)
- if (intent?.getBooleanExtra("orbit_shadow_resume", false) == true) CatalogueShadow.resume = true
- if (intent?.hasExtra("orbit_shadow_catalogue") == true) CatalogueShadow.pending = intent.getIntExtra("orbit_shadow_catalogue", 5)
- }
+ private fun readAdbRequests(intent: android.content.Intent?) = Edition.readAdbRequests(this, intent)
override fun onNewIntent(intent: android.content.Intent) { super.onNewIntent(intent); setIntent(intent); readAdbRequests(intent) }
override fun onCreate(savedInstanceState: Bundle?) {
- InstallSnapshot.screenOpen = true
+ OrbitScreen.open = true
OrbitCompanion.activity = java.lang.ref.WeakReference(this)
super.onCreate(savedInstanceState)
tv.orbit.classic.ArcadeProgress.init(this)
@@ -92,10 +78,7 @@ class MainActivity : ComponentActivity() {
ProviderSwitches.load(this)
PlayerSwitches.load(this)
readAdbRequests(intent)
- // The hand-run playback test opens over Orbit, which stops in the background as it would for any other app, and comes back when it ends.
- intent?.getStringExtra("orbit_play_test")?.takeIf(EmbyClient::validId)?.let { item ->
- startActivity(android.content.Intent(this, PlaybackTestActivity::class.java).putExtra(PlaybackTestActivity.ITEM, item))
- }
+ Edition.openPlaybackTest(this, intent)
// Before anything is drawn, so a locked After Dark never shows for a moment.
AfterDarkLock.load(this)
// Opening the saved sign-in takes seconds on the box: start it now, while the first screen is drawn.
@@ -266,7 +249,7 @@ private fun OrbitApp() {
if (SleepTimer.goodnight && !FullScreen.active) LunaGoodnight()
// A new TV joining (Multiroom auto-scan), over everything else; and a newer Orbit from another room.
RoomKnockOverlay()
- RoomUpdateCard()
+ Edition.UpdateCard()
// Settings › Character cameos › Show one.
CameoPreviewOverlay()
}
diff --git a/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt b/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt
index 012efbb6..7178b634 100644
--- a/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt
+++ b/android/app/src/main/java/tv/orbit/classic/PhoneLink.kt
@@ -213,19 +213,8 @@ internal object PhoneLink {
val input = BufferedInputStream(socket.getInputStream()); val out = socket.getOutputStream()
val r = readRequest(input) ?: return
if (!hostIsAnAddress(r.headers["host"])) return respond(out, 400, "text/plain", "Use the TV's address.".toByteArray())
- if (r.path == "/room/version" && r.method == "GET") {
- val build = shared ?: return json(out, 404, JSONObject())
- return json(out, 200, JSONObject().put("code", build.code).put("name", build.name).put("room", Rooms.name))
- }
- if (r.path == "/room/orbit.apk" && r.method == "GET") {
- // The installed copy, streamed: another room checks it's newer and signed as it is before Android installs it.
- val build = shared?.takeIf { it.file.isFile } ?: return json(out, 404, JSONObject())
- val head = listOf("HTTP/1.1 200 OK", "Content-Type: application/vnd.android.package-archive", "Content-Length: ${build.file.length()}", "Cache-Control: no-store",
- "X-Content-Type-Options: nosniff", "Connection: close").joinToString("\r\n") + "\r\n\r\n"
- out.write(head.toByteArray(Charsets.ISO_8859_1)); build.file.inputStream().use { it.copyTo(out, 64 * 1024) }; out.flush()
- android.util.Log.i("OrbitRooms", "update shared bytes=${build.file.length()}")
- return
- }
+ // Updates between rooms: the household edition answers these; the Play edition never shares itself.
+ if (Edition.serveUpdate(r.path, r.method, out, shared) { status, body -> json(out, status, body) }) return
if (r.path == "/room/knock" && r.method == "POST") {
// A new TV asks to join: this one shows a code, or the one it's already showing. One knock every 20 seconds.
roomOffer?.takeIf { it.state == RoomOffer.State.Waiting && System.currentTimeMillis() < it.untilMs }?.let { return json(out, 200, JSONObject().put("room", Rooms.name)) }
diff --git a/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt b/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt
index c2f2c409..c5ae5bec 100644
--- a/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt
+++ b/android/app/src/main/java/tv/orbit/classic/RoomsUi.kt
@@ -84,7 +84,7 @@ internal object RoomBeacon {
if (registration != null) return
val app = context.applicationContext
PhoneLink.knock = { joining -> RoomOffer(RoomCrypto.code(), System.currentTimeMillis() + OFFER_MS, Rooms.name, knocked = true) { RoomBundle.collect(app, Workspaces.current(app), Rooms.name) }.also { it.joining = joining } }
- PhoneLink.shared = RoomUpdates.shared(app)
+ PhoneLink.shared = Edition.sharedBuild(app)
PhoneLink.listening = true
val nsd = app.getSystemService(Context.NSD_SERVICE) as? NsdManager ?: return
registration = object : NsdManager.RegistrationListener {
diff --git a/android/app/src/play/java/tv/orbit/classic/Edition.kt b/android/app/src/play/java/tv/orbit/classic/Edition.kt
new file mode 100644
index 00000000..21ae1fd9
--- /dev/null
+++ b/android/app/src/play/java/tv/orbit/classic/Edition.kt
@@ -0,0 +1,24 @@
+package tv.orbit.classic
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import androidx.compose.runtime.Composable
+import org.json.JSONObject
+import java.io.OutputStream
+
+/**
+ * The Play edition (Paul, 10 November 2026): only Google Play updates it (Play's Device and Network Abuse policy), so it
+ * never offers, fetches, shares or installs a copy of Orbit, and it holds no install permission. adb's test requests and the
+ * install check aren't in it. Rooms, profiles, Taste, Continue Watching, the Arcade and sync are the same as at home.
+ */
+internal object Edition {
+ const val NAME = "play"
+ fun readAdbRequests(activity: Activity, intent: Intent?) {}
+ fun openPlaybackTest(activity: Activity, intent: Intent?) {}
+ suspend fun lookForUpdate(context: Context) {}
+ fun sharedBuild(context: Context): SharedBuild? = null
+ @Composable fun UpdateCard() {}
+ /** Never answers the update routes: another room asking gets the usual "not found". */
+ fun serveUpdate(path: String, method: String, out: OutputStream, shared: SharedBuild?, json: (Int, JSONObject) -> Unit): Boolean = false
+}
diff --git a/android/app/src/test/java/tv/orbit/classic/InstallRestoreTest.kt b/android/app/src/testHousehold/java/tv/orbit/classic/InstallRestoreTest.kt
similarity index 100%
rename from android/app/src/test/java/tv/orbit/classic/InstallRestoreTest.kt
rename to android/app/src/testHousehold/java/tv/orbit/classic/InstallRestoreTest.kt
diff --git a/android/app/src/test/java/tv/orbit/classic/PlaybackTestTest.kt b/android/app/src/testHousehold/java/tv/orbit/classic/PlaybackTestTest.kt
similarity index 100%
rename from android/app/src/test/java/tv/orbit/classic/PlaybackTestTest.kt
rename to android/app/src/testHousehold/java/tv/orbit/classic/PlaybackTestTest.kt
diff --git a/android/app/src/test/java/tv/orbit/classic/RoomUpdatesTest.kt b/android/app/src/testHousehold/java/tv/orbit/classic/RoomUpdatesTest.kt
similarity index 100%
rename from android/app/src/test/java/tv/orbit/classic/RoomUpdatesTest.kt
rename to android/app/src/testHousehold/java/tv/orbit/classic/RoomUpdatesTest.kt
diff --git a/tools/check_editions.py b/tools/check_editions.py
new file mode 100644
index 00000000..3f555da4
--- /dev/null
+++ b/tools/check_editions.py
@@ -0,0 +1,96 @@
+#!/usr/bin/env python3
+"""
+The editions check in the release gate (Paul, 10 November 2026). Reads what was actually built, never the source:
+ - the household APK, the Play APK, and the Play bundle (.aab), whose manifest is converted with aapt2 and read the same way;
+ - both editions are tv.orbit.classic, with versionCode = build x 10 + 0 (household) and + 2 (Play), above every code in
+ tools/known-version-codes.txt (and in ORBIT_APKS when that folder is there), the reserved 390 recovery build included;
+ - the Play APK and bundle hold no install permission, no PackageInstaller, no room-update or test hooks, no server address;
+ - the household APK still has its updater, install permission and install check;
+ - nothing is signed: no v1 signature files and no APK signing block.
+ check_editions.py
+"""
+import os, re, subprocess, sys, tempfile, zipfile
+
+household_apk, play_apk, play_aab, aapt2 = sys.argv[1:5]
+here = os.path.dirname(os.path.abspath(__file__))
+problems = []
+
+def badging(apk):
+ out = subprocess.run([aapt2, "dump", "badging", apk], capture_output=True, text=True, check=True).stdout
+ m = re.search(r"package: name='([^']*)' versionCode='(\d+)' versionName='([^']*)'", out)
+ return m[1], int(m[2]), m[3], sorted(set(re.findall(r"uses-permission: name='([^']*)'", out)))
+
+def aab_as_apk(aab, into):
+ """The bundle's base module, as aapt2 reads it: its proto manifest and resources converted to an ordinary APK."""
+ proto = os.path.join(into, "proto.apk"); binary = os.path.join(into, "binary.apk")
+ with zipfile.ZipFile(aab) as z, zipfile.ZipFile(proto, "w") as out:
+ for n in z.namelist():
+ if not n.startswith("base/"): continue
+ rest = n[len("base/"):]
+ if rest == "manifest/AndroidManifest.xml": out.writestr("AndroidManifest.xml", z.read(n))
+ elif rest == "resources.pb" or rest.startswith("res/"): out.writestr(rest, z.read(n))
+ subprocess.run([aapt2, "convert", "--output-format", "binary", "-o", binary, proto], check=True, capture_output=True)
+ return binary
+
+def dex(path):
+ with zipfile.ZipFile(path) as z:
+ return b"".join(z.read(n) for n in z.namelist() if re.search(r"(^|/)classes\d*\.dex$", n) or n.startswith(("assets/", "base/assets/")))
+
+def signed(path):
+ with zipfile.ZipFile(path) as z:
+ if any(re.match(r"META-INF/.*\.(RSA|DSA|EC|SF)$", n) for n in z.namelist()): return True
+ return b"APK Sig Block 42" in open(path, "rb").read()
+
+known = []
+for line in open(os.path.join(here, "known-version-codes.txt")):
+ if line.strip() and not line.startswith("#"):
+ code, package, name = line.split()[:3]; known.append((int(code), package, name))
+apks = os.environ.get("ORBIT_APKS", "/home/pauljd/Documents/OrbitTV/apks")
+if os.path.isdir(apks):
+ for root, _, files in os.walk(apks):
+ for f in files:
+ if f.endswith(".apk"):
+ try: p, c, n, _ = badging(os.path.join(root, f)); known.append((c, p, n))
+ except Exception: pass
+highest = max(c for c, p, _ in known if p.startswith("tv.orbit.classic"))
+
+with tempfile.TemporaryDirectory() as tmp:
+ editions = {"household APK": badging(household_apk), "Play APK": badging(play_apk), "Play bundle": badging(aab_as_apk(play_aab, tmp))}
+for label, (package, code, name, perms) in editions.items():
+ print(f"{label}: {package} versionCode {code} versionName {name}")
+ if package != "tv.orbit.classic": problems.append(f"{label} is {package}, not tv.orbit.classic")
+hh, pa, bu = (editions[k][1] for k in ("household APK", "Play APK", "Play bundle"))
+build = hh // 10
+if hh % 10 != 0: problems.append(f"household code {hh} doesn't end in 0")
+if pa != build * 10 + 2 or bu != pa: problems.append(f"Play codes {pa}/{bu} aren't {build * 10 + 2}")
+if hh <= highest: problems.append(f"household code {hh} isn't above the highest code built so far, {highest}")
+recovery = build * 10 + 9
+if any(c == recovery for c, _, _ in known): problems.append(f"this build's recovery code {recovery} is already used")
+print(f"highest earlier code {highest} (reserved recovery 390 included); this build {build}: household {hh}, Play {pa}, recovery slot {recovery}")
+
+for label in ("Play APK", "Play bundle"):
+ if "android.permission.REQUEST_INSTALL_PACKAGES" in editions[label][3]: problems.append(f"{label} asks for REQUEST_INSTALL_PACKAGES")
+if "android.permission.REQUEST_INSTALL_PACKAGES" not in editions["household APK"][3]: problems.append("household APK lost REQUEST_INSTALL_PACKAGES")
+
+forbidden = [b"android/content/pm/PackageInstaller", b"RoomUpdates", b"ROOM_UPDATE", b"/room/orbit.apk", b"InstallSnapshotReceiver",
+ b"INSTALL_SNAPSHOT", b"PlaybackTestActivity", b"orbit_play_test", b"orbit_shadow_catalogue", b"orbit_provider_catalogue",
+ b"orbit_frame_rate", b"orbit_avi", b"PlaytestFileActivity", b"playtest-approved", b"appboxmanager"]
+for label, path in (("Play APK", play_apk), ("Play bundle", play_aab)):
+ found = [f.decode() for f in forbidden if f in dex(path)]
+ if found: problems.append(f"{label} contains: {', '.join(found)}")
+required = [b"android/content/pm/PackageInstaller", b"RoomUpdates", b"InstallSnapshotReceiver", b"orbit_shadow_catalogue"]
+missing = [r.decode() for r in required if r not in dex(household_apk)]
+if missing: problems.append(f"household APK is missing: {', '.join(missing)}")
+for bad in (b"PlaytestFileActivity", b"playtest-approved", b"appboxmanager"):
+ if bad in dex(household_apk): problems.append(f"household APK contains {bad.decode()}")
+# Shared features are in both: Rooms, profiles, Taste, Continue Watching, the Arcade.
+for need in (b"RoomSync", b"Profiles", b"TasteEvent", b"ContinueWatching", b"tv/orbit/classic/arcade"):
+ for label, path in (("household APK", household_apk), ("Play APK", play_apk), ("Play bundle", play_aab)):
+ if need not in dex(path): problems.append(f"{label} is missing shared {need.decode()}")
+
+for label, path in (("household APK", household_apk), ("Play APK", play_apk), ("Play bundle", play_aab)):
+ if signed(path): problems.append(f"{label} is signed")
+
+if problems:
+ print("Editions check FAILED:"); [print(" - " + p) for p in problems]; sys.exit(1)
+print("Editions check passed: same app id, codes in order, Play isolated, household intact, all unsigned.")
diff --git a/tools/known-version-codes.txt b/tools/known-version-codes.txt
new file mode 100644
index 00000000..5804d2c8
--- /dev/null
+++ b/tools/known-version-codes.txt
@@ -0,0 +1,39 @@
+# Every Orbit version code built so far (10 November 2026), from /home/pauljd/Documents/OrbitTV/apks: code package name.
+# 390 is the reserved fix-forward recovery build (0.122.1's code). New codes must stay above all of these.
+279 tv.orbit.classic 0.110.4-sunday-edition
+280 tv.orbit.classic 0.110.5-orbi-fax-trial
+281 tv.orbit.classic 0.110.5-arcade-stage-c
+290 tv.orbit.classic 0.110.7-arcade1
+291 tv.orbit.classic 0.110.8-arcade1
+292 tv.orbit.classic 0.110.9-combined
+293 tv.orbit.classic 0.110.10-household
+295 tv.orbit.classic 0.110.12-story-p1000
+296 tv.orbit.classic 0.110.13-story-p1000
+297 tv.orbit.classic 0.110.14-chaos
+298 tv.orbit.classic 0.110.15-smartsetup
+299 tv.orbit.classic 0.110.16-chaos-smartsetup
+300 tv.orbit.classic 0.110.17-chaos-smartsetup
+301 tv.orbit.classic 0.111.0-classics-family
+302 tv.orbit.classic 0.112.0-signal-run
+303 tv.orbit.classic 0.113.0-classic-challenges
+304 tv.orbit.classic 0.114.0-classic-modes
+305 tv.orbit.classic 0.115.0-night-shift
+306 tv.orbit.classic 0.116.0-orbiteroids
+307 tv.orbit.classic 0.116.1-orbiteroids
+308 tv.orbit.classic 0.117.0-quiz-night
+309 tv.orbit.classic 0.118.0-new-originals
+310 tv.orbit.classic 0.119.0-orbit-rush
+311 tv.orbit.classic 0.120.0-sound-kit
+312 tv.orbit.classic 0.121.0-house-scores
+313 tv.orbit.classic 0.122.0-orbit-rush
+314 tv.orbit.classic 0.122.1-smooth-row
+315 tv.orbit.classic 0.123.0-player
+316 tv.orbit.classic 0.123.1-player
+317 tv.orbit.classic 0.124.0-improvements
+318 tv.orbit.classic 0.124.1-guide
+319 tv.orbit.classic 0.124.2-guide
+320 tv.orbit.classic 0.124.3-follow
+321 tv.orbit.classic 0.124.4-follow
+322 tv.orbit.classic 0.125.0-taste2
+323 tv.orbit.classic 0.126.0-noserver
+390 tv.orbit.classic 0.122.1-fixforward
diff --git a/tools/verify.sh b/tools/verify.sh
index acb91b7a..7f976b65 100755
--- a/tools/verify.sh
+++ b/tools/verify.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
# Orbit's release gate (8 November 2026): the same checks for every change and every provider, before anything reaches a TV.
-# Builds the release APK, runs every unit test (the shared provider contract suite included) and lint, and fails on any
-# failure, any lint error, or a missing contract suite. Prints the APK's SHA-256 for the install record.
+# Builds both editions (household APK, Play APK and Play bundle, all unsigned), runs every unit test for both (the shared
+# provider contract suite included) and lint, and fails on any failure, any lint error, a missing contract suite, or an
+# editions check that fails (tools/check_editions.py). Prints the SHA-256s for the install record.
# tools/verify.sh (uses Orbit's offline .tooling cache when it's there)
set -euo pipefail
ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -13,21 +14,27 @@ python3 "$ROOT/tools/test_compare_snapshots.py" 2>&1 | tail -1 # the install c
cd "$ROOT/android"
# A clean build every time (9 November 2026): incremental builds left stale Compose stability checks in the APK.
./gradlew --no-daemon "${OFFLINE[@]}" -q clean
-./gradlew --no-daemon "${OFFLINE[@]}" -q :app:assembleRelease :app:testDebugUnitTest --rerun :app:lintRelease
+./gradlew --no-daemon "${OFFLINE[@]}" -q :app:assembleHouseholdRelease :app:assemblePlayRelease :app:bundlePlayRelease \
+ :app:testHouseholdDebugUnitTest :app:testPlayDebugUnitTest --rerun :app:lintHouseholdRelease :app:lintPlayRelease
python3 - <<'PY'
import glob, re, sys
-tests = fails = 0; contract = False
-for p in glob.glob('app/build/test-results/testDebugUnitTest/*.xml'):
- s = open(p).read(); m = re.search(r'tests="(\d+)".*?failures="(\d+)".*?errors="(\d+)"', s)
- tests += int(m[1]); fails += int(m[2]) + int(m[3])
- if 'ContractTest' in p and 'MediaProviderContract' not in p: contract = True
-lint = len(re.findall(r'severity="(Error|Fatal)"', open('app/build/reports/lint-results-release.xml').read()))
-print(f"tests {tests}, failures {fails}, lint errors {lint}, contract suite {'present' if contract else 'MISSING'}")
-sys.exit(0 if fails == 0 and lint == 0 and contract and tests > 0 else 1)
+ok = True
+for edition in ("Household", "Play"):
+ tests = fails = 0; contract = False
+ for p in glob.glob(f'app/build/test-results/test{edition}DebugUnitTest/*.xml'):
+ s = open(p).read(); m = re.search(r'tests="(\d+)".*?failures="(\d+)".*?errors="(\d+)"', s)
+ tests += int(m[1]); fails += int(m[2]) + int(m[3])
+ if 'ContractTest' in p and 'MediaProviderContract' not in p: contract = True
+ lint = len(re.findall(r'severity="(Error|Fatal)"', open(f'app/build/reports/lint-results-{edition.lower()}Release.xml').read()))
+ print(f"{edition.lower()}: tests {tests}, failures {fails}, lint errors {lint}, contract suite {'present' if contract else 'MISSING'}")
+ ok = ok and fails == 0 and lint == 0 and contract and tests > 0
+sys.exit(0 if ok else 1)
PY
-# The playback test hook is only ever in the playtest build (Paul, 9 November 2026): never in the release APK.
-if unzip -l app/build/outputs/apk/release/app-release.apk | grep -q playtest-approved || \
- unzip -p app/build/outputs/apk/release/app-release.apk 'classes*.dex' | grep -aq PlaytestFileActivity; then echo "Release APK contains the playback test hook."; exit 1; fi
-if unzip -p app/build/outputs/apk/release/app-release.apk 'classes*.dex' 'assets/*' | grep -aq appboxmanager; then echo "Release APK contains a built-in server address."; exit 1; fi
-sha256sum app/build/outputs/apk/release/app-release.apk | cut -c1-64
+HOUSEHOLD=app/build/outputs/apk/household/release/app-household-release-unsigned.apk
+PLAY=app/build/outputs/apk/play/release/app-play-release-unsigned.apk
+BUNDLE=app/build/outputs/bundle/playRelease/app-play-release.aab
+# Both editions as built (Paul, 10 November 2026): ids, version codes, Play isolation, household intact, nothing signed.
+# The playback test hook and any server address are refused in every edition there too.
+python3 "$ROOT/tools/check_editions.py" "$HOUSEHOLD" "$PLAY" "$BUNDLE" "$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)/aapt2"
+sha256sum "$HOUSEHOLD" "$PLAY" "$BUNDLE" | sed "s#app/build/outputs/##"
echo "Release gate passed."