Skip to content

Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.

Swap the tests' list copies for small fixtures

jesse-agent-2328bdc30b6cc74
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f62d145..0e7bb6c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -38,7 +38,7 @@ These lists live in tellyscope-devices too, next to the debloat lists, and the a
Which launchers may turn on an accessibility service is not on any list: it's `ACCESSIBILITY_LAUNCHERS` in [`Launchers.kt`](app/src/main/java/app/tellyscope/data/Launchers.kt), because an accessibility service can read the screen. Add one only for a launcher that keeps Home with its own accessibility service: check the APK's manifest for a service with `BIND_ACCESSIBILITY_SERVICE` and put the version you checked next to it. `LaunchersTest` names every such launcher on purpose, so add yours there too and a reviewer sees it.
-The tests read a copy of the lists from [`app/src/test/resources/lists/`](app/src/test/resources/lists/); the app itself bundles none.
+The tests use small fixtures in [`app/src/test/resources/fixtures/`](app/src/test/resources/fixtures/) that only check the code: change the real lists in tellyscope-devices, not there. The app itself bundles none.
## README screenshots
diff --git a/app/src/main/java/app/tellyscope/data/Launchers.kt b/app/src/main/java/app/tellyscope/data/Launchers.kt
index d0f9ddd..b3ff46a 100644
--- a/app/src/main/java/app/tellyscope/data/Launchers.kt
+++ b/app/src/main/java/app/tellyscope/data/Launchers.kt
@@ -77,7 +77,7 @@ data class Shared(
* The lists anyone can change without an app release, from the list source next to the debloat
* lists ([DeviceLists]): the last cached copy at launch, then the source's. A list the source
* can't give keeps what was there. The app bundles none, so before the first fetch they are empty;
- * a build with `lists/` among its Java resources (the tests) starts from those instead.
+ * a build with `fixtures/` among its Java resources (the tests) starts from those instead.
*/
object SharedLists {
private val _state = MutableStateFlow(seed())
@@ -114,9 +114,9 @@ object SharedLists {
}
private fun seed() = Shared(
- launchers = resource("/lists/launchers.json")?.let { parseLaunchers(it.decodeToString()) }.orEmpty(),
- labels = resource("/lists/labels.json")?.let { parseLabels(it.decodeToString()) }.orEmpty(),
- streaming = resource("/lists/streaming.json")?.let { parseStreaming(it.decodeToString()) }.orEmpty(),
+ launchers = resource("/fixtures/launchers.json")?.let { parseLaunchers(it.decodeToString()) }.orEmpty(),
+ labels = resource("/fixtures/labels.json")?.let { parseLabels(it.decodeToString()) }.orEmpty(),
+ streaming = resource("/fixtures/streaming.json")?.let { parseStreaming(it.decodeToString()) }.orEmpty(),
)
private fun resource(path: String): ByteArray? =
diff --git a/app/src/test/java/app/tellyscope/AppNamesTest.kt b/app/src/test/java/app/tellyscope/AppNamesTest.kt
index 8c94015..c2572bd 100644
--- a/app/src/test/java/app/tellyscope/AppNamesTest.kt
+++ b/app/src/test/java/app/tellyscope/AppNamesTest.kt
@@ -19,7 +19,7 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
-/** The fallback names come from the bundled `labels.json`, read with Android's org.json: Robolectric. */
+/** The fallback names come from the test fixture `labels.json`, read with Android's org.json: Robolectric. */
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [35])
class AppNamesTest {
@@ -68,7 +68,7 @@ class AppNamesTest {
val helper = Helper(fail = true)
val appNames = AppNames(tmp.root)
val names = appNames.names("SN1", listOf(netflix, odd), helper::describe)
- assertEquals("Netflix", names.getValue("com.netflix.ninja").label) // bundled table
+ assertEquals("Netflix", names.getValue("com.netflix.ninja").label) // fixture table
assertEquals("Example Weatherbox", names.getValue("com.example.weatherbox").label) // humanised id, maker kept
assertNull(names.getValue("com.netflix.ninja").icon) // letter avatar
// A refusal isn't retried on every open; the next app start tries again.
diff --git a/app/src/test/java/app/tellyscope/LaunchersTest.kt b/app/src/test/java/app/tellyscope/LaunchersTest.kt
index 69ac135..2e9b593 100644
--- a/app/src/test/java/app/tellyscope/LaunchersTest.kt
+++ b/app/src/test/java/app/tellyscope/LaunchersTest.kt
@@ -21,7 +21,7 @@ import java.io.File
@Config(sdk = [35])
class LaunchersTest {
@Test fun theListReadsWhole() {
- val text = File("src/test/resources/lists/launchers.json").readText()
+ val text = File("src/test/resources/fixtures/launchers.json").readText()
val launchers = parseLaunchers(text)
assertEquals(Regex("\"package\"").findAll(text).count(), launchers.size) // nothing dropped
assertEquals(launchers.size, launchers.map { it.pkg }.toSet().size)
@@ -38,7 +38,7 @@ class LaunchersTest {
}
@Test fun theLabelsReadWhole() {
- val text = File("src/test/resources/lists/labels.json").readText()
+ val text = File("src/test/resources/fixtures/labels.json").readText()
val labels = parseLabels(text)
// Every "key": "text" pair but the group names is a label: none dropped, none listed twice.
val pairs = Regex("\"[^\"]+\"\\s*:\\s*\"").findAll(text).count()
diff --git a/app/src/test/java/app/tellyscope/StreamingTest.kt b/app/src/test/java/app/tellyscope/StreamingTest.kt
index ed33c01..c2b86b5 100644
--- a/app/src/test/java/app/tellyscope/StreamingTest.kt
+++ b/app/src/test/java/app/tellyscope/StreamingTest.kt
@@ -25,7 +25,7 @@ class StreamingTest {
private val services = SharedLists.streaming
@Test fun theListReadsWhole() {
- val text = File("src/test/resources/lists/streaming.json").readText()
+ val text = File("src/test/resources/fixtures/streaming.json").readText()
val parsed = parseStreaming(text)
assertEquals(Regex("\"packages\"").findAll(text).count(), parsed.size) // nothing dropped
assertEquals(parsed.size, parsed.map { it.name }.toSet().size)
diff --git a/app/src/test/resources/fixtures/labels.json b/app/src/test/resources/fixtures/labels.json
new file mode 100644
index 0000000..b46bead
--- /dev/null
+++ b/app/src/test/resources/fixtures/labels.json
@@ -0,0 +1,29 @@
+{
+ "schema": 1,
+ "groups": [
+ {
+ "name": "Fixture",
+ "labels": {
+ "android": "Android System",
+ "com.android.systemui": "System UI",
+ "com.android.tv.settings": "Settings",
+ "com.android.vending": "Google Play Store",
+ "com.google.android.gms": "Google Play services",
+ "com.google.android.tvlauncher": "Android TV Home",
+ "com.google.android.apps.tv.launcherx": "Google TV Home",
+ "com.google.android.play.games": "Google Play Games",
+ "com.google.android.youtube.tv": "YouTube",
+ "com.google.android.youtube.tvkids": "YouTube Kids",
+ "com.netflix.ninja": "Netflix",
+ "com.amazon.amazonvideo.livingroom": "Prime Video",
+ "com.disney.disneyplus": "Disney+",
+ "com.spotify.tv.android": "Spotify",
+ "com.plexapp.android": "Plex",
+ "org.jellyfin.androidtv": "Jellyfin",
+ "org.xbmc.kodi": "Kodi",
+ "com.teamsmart.videomanager.tv": "SmartTube",
+ "com.spocky.projengmenu": "Projectivy Launcher"
+ }
+ }
+ ]
+}
diff --git a/app/src/test/resources/lists/launchers.json b/app/src/test/resources/fixtures/launchers.json
similarity index 50%
rename from app/src/test/resources/lists/launchers.json
rename to app/src/test/resources/fixtures/launchers.json
index 3f73905..200382e 100644
--- a/app/src/test/resources/lists/launchers.json
+++ b/app/src/test/resources/fixtures/launchers.json
@@ -2,12 +2,7 @@
"schema": 1,
"launchers": [
{ "package": "com.spocky.projengmenu", "name": "Projectivy Launcher", "about": "The most popular. Rows, wallpapers and icons you can change." },
- { "package": "com.overdevs.at4k", "name": "AT4K Launcher" },
- { "package": "com.spauldhaliwal.dispatch", "name": "Dispatch" },
{ "package": "me.efesser.flauncher", "name": "FLauncher", "about": "Simple: your apps in rows, nothing else." },
- { "package": "com.wolf.firelauncher", "name": "Wolf Launcher" },
- { "package": "ca.dstudio.atvlauncher.free", "name": "ATV Launcher" },
- { "package": "net.i.akihiro.halauncher", "name": "HALauncher" },
- { "package": "eu.chainfire.tv.sideloadlauncher", "name": "Sideload Launcher" }
+ { "package": "com.wolf.firelauncher", "name": "Wolf Launcher" }
]
}
diff --git a/app/src/test/resources/fixtures/streaming.json b/app/src/test/resources/fixtures/streaming.json
new file mode 100644
index 0000000..8a4048c
--- /dev/null
+++ b/app/src/test/resources/fixtures/streaming.json
@@ -0,0 +1,20 @@
+{
+ "schema": 1,
+ "groups": [
+ {
+ "name": "Fixture",
+ "services": [
+ { "name": "Netflix", "packages": ["com.netflix.ninja"], "color": "#000000", "logo": "netflix", "dark": "#E50914" },
+ { "name": "YouTube", "packages": ["com.google.android.youtube.tv"], "color": "#FFFFFF", "logo": "youtube" },
+ { "name": "Prime Video", "packages": ["com.amazon.amazonvideo.livingroom", "com.amazon.amazonvideo.livingroom.nvidia"], "color": "#0F171E", "logo": "primevideo", "dark": "#00A8E1" },
+ { "name": "Spotify", "packages": ["com.spotify.tv.android"], "color": "#000000", "logo": "spotify", "dark": "#1ED760" },
+ { "name": "Disney+", "packages": ["com.disney.disneyplus"], "color": "#0B1446", "logo": "disney", "dark": "#00B4FF" },
+ { "name": "HBO Max", "packages": ["com.wbd.stream", "com.hbo.hbonow"], "color": "#000000", "logo": "hbomax" },
+ { "name": "Plex", "packages": ["com.plexapp.android"], "color": "#E5A00D", "logo": "plex" },
+ { "name": "Jellyfin", "packages": ["org.jellyfin.androidtv"], "color": "#AA5CC3", "color2": "#00A4DC", "logo": "jellyfin" },
+ { "name": "Emby", "packages": ["tv.emby.embyatv"], "color": "#52B54B", "logo": "emby" },
+ { "name": "Kodi", "packages": ["org.xbmc.kodi"], "color": "#1C2B3A", "logo": "kodi", "dark": "#17B2E7" }
+ ]
+ }
+ ]
+}
diff --git a/app/src/test/resources/lists/labels.json b/app/src/test/resources/lists/labels.json
deleted file mode 100644
index d593d3b..0000000
--- a/app/src/test/resources/lists/labels.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "schema": 1,
- "groups": [
- {
- "name": "Android and Google TV system apps",
- "labels": {
- "android": "Android System",
- "com.android.systemui": "System UI",
- "com.android.tv.settings": "Settings",
- "com.android.vending": "Google Play Store",
- "com.android.chrome": "Chrome",
- "com.android.bluetooth": "Bluetooth",
- "com.android.shell": "Shell",
- "com.android.providers.downloads": "Download Manager",
- "com.android.packageinstaller": "Package installer",
- "com.google.android.packageinstaller": "Package installer",
- "com.google.android.gms": "Google Play services",
- "com.google.android.gsf": "Google Services Framework",
- "com.google.android.tvlauncher": "Android TV Home",
- "com.google.android.apps.tv.launcherx": "Google TV Home",
- "com.google.android.apps.mediashell": "Chromecast built-in",
- "com.google.android.tv.remote.service": "Android TV Remote Service",
- "com.google.android.inputmethod.latin": "Gboard",
- "com.google.android.tts": "Speech Services by Google",
- "com.google.android.play.games": "Google Play Games",
- "com.google.android.youtube.tv": "YouTube",
- "com.google.android.youtube.tvmusic": "YouTube Music",
- "com.google.android.youtube.tvkids": "YouTube Kids"
- }
- },
- {
- "name": "Streaming and media apps",
- "labels": {
- "com.netflix.ninja": "Netflix",
- "com.amazon.amazonvideo.livingroom": "Prime Video",
- "com.disney.disneyplus": "Disney+",
- "com.apple.atve.androidtv.appletv": "Apple TV",
- "com.spotify.tv.android": "Spotify",
- "com.plexapp.android": "Plex",
- "org.jellyfin.androidtv": "Jellyfin",
- "org.xbmc.kodi": "Kodi",
- "org.videolan.vlc": "VLC",
- "tv.twitch.android.app": "Twitch",
- "com.crunchyroll.crunchyroid": "Crunchyroll",
- "com.teamsmart.videomanager.tv": "SmartTube"
- }
- },
- {
- "name": "Launchers",
- "labels": {
- "com.spocky.projengmenu": "Projectivy Launcher"
- }
- }
- ]
-}
diff --git a/app/src/test/resources/lists/streaming.json b/app/src/test/resources/lists/streaming.json
deleted file mode 100644
index f830a3e..0000000
--- a/app/src/test/resources/lists/streaming.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "schema": 1,
- "groups": [
- {
- "name": "Global",
- "services": [
- { "name": "Netflix", "packages": ["com.netflix.ninja"], "color": "#000000", "logo": "netflix", "dark": "#E50914" },
- { "name": "YouTube", "packages": ["com.google.android.youtube.tv"], "color": "#FFFFFF", "logo": "youtube" },
- { "name": "Prime Video", "packages": ["com.amazon.amazonvideo.livingroom", "com.amazon.amazonvideo.livingroom.nvidia"], "color": "#0F171E", "logo": "primevideo", "dark": "#00A8E1" },
- { "name": "Spotify", "packages": ["com.spotify.tv.android"], "color": "#000000", "logo": "spotify", "dark": "#1ED760" },
- { "name": "Disney+", "packages": ["com.disney.disneyplus"], "color": "#0B1446", "logo": "disney", "dark": "#00B4FF" },
- { "name": "HBO Max", "packages": ["com.wbd.stream", "com.hbo.hbonow"], "color": "#000000", "logo": "hbomax" },
- { "name": "Apple TV", "packages": ["com.apple.atve.androidtv.appletv"], "color": "#000000", "logo": "appletv" },
- { "name": "Paramount+", "packages": ["com.cbs.ott"], "color": "#0064FF", "logo": "paramount" },
- { "name": "Crunchyroll", "packages": ["com.crunchyroll.crunchyroid"], "color": "#F47521", "logo": "crunchyroll" },
- { "name": "Twitch", "packages": ["tv.twitch.android.app"], "color": "#9146FF", "logo": "twitch" }
- ]
- },
- {
- "name": "US",
- "services": [
- { "name": "Hulu", "packages": ["com.hulu.livingroomplus"], "color": "#1CE783", "logo": "hulu" },
- { "name": "Peacock", "packages": ["com.peacocktv.peacockandroid"], "color": "#000000", "logo": "peacock", "dark": "#FFDC23" },
- { "name": "Tubi", "packages": ["com.tubitv", "com.tubitv.ott"], "color": "#5B1EB8", "logo": "tubi", "dark": "#FFFF13" },
- { "name": "Pluto TV", "packages": ["tv.pluto.android"], "color": "#000000", "logo": "plutotv", "dark": "#FFDE2B" }
- ]
- },
- {
- "name": "India",
- "services": [
- { "name": "JioHotstar", "packages": ["in.startv.hotstar"], "color": "#0F1F7A", "logo": "jiohotstar" },
- { "name": "Zee5", "packages": ["com.graymatrix.did"], "color": "#3B0A5C", "logo": "zee5", "dark": "#EC2B8D" },
- { "name": "SonyLIV", "packages": ["com.sonyliv"], "color": "#000000", "logo": "sonyliv" }
- ]
- },
- {
- "name": "Sports",
- "services": [
- { "name": "DAZN", "packages": ["com.dazn"], "color": "#000000", "logo": "dazn" }
- ]
- },
- {
- "name": "Self-hosted",
- "services": [
- { "name": "Plex", "packages": ["com.plexapp.android"], "color": "#E5A00D", "logo": "plex" },
- { "name": "Jellyfin", "packages": ["org.jellyfin.androidtv"], "color": "#AA5CC3", "color2": "#00A4DC", "logo": "jellyfin" },
- { "name": "Wholphin", "packages": ["com.github.damontecres.wholphin"], "color": "#000B25", "logo": "wholphin", "dark": "#3C73AB" },
- { "name": "Kodi", "packages": ["org.xbmc.kodi"], "color": "#1C2B3A", "logo": "kodi", "dark": "#17B2E7" },
- { "name": "Emby", "packages": ["tv.emby.embyatv"], "color": "#52B54B", "logo": "emby" }
- ]
- }
- ]
-}