Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Stop recording glass layers nothing is looking at

Lelonio91c5983e2752
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index dea6ea0..72a7f00 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -141,7 +141,18 @@
"Bash(./gradlew :app:compileDebugKotlin -q)",
"Bash(./gradlew :app:assembleDebug -q)",
"Bash(git commit -q -m ' *)",
- "Bash(./gradlew :app:assembleRelease -q)"
+ "Bash(./gradlew :app:assembleRelease -q)",
+ "Bash(sh /private/tmp/claude-501/-Users-emanuele-Progetto-Spotify/f8b439da-53e4-49c2-8d23-91a1d07d3cdc/scratchpad/bench.sh)",
+ "Bash(md5 /private/tmp/claude-501/-Users-emanuele-Progetto-Spotify/f8b439da-53e4-49c2-8d23-91a1d07d3cdc/scratchpad/base.apk /private/tmp/claude-501/-Users-emanuele-Progetto-Spotify/f8b439da-53e4-49c2-8d23-91a1d07d3cdc/scratchpad/opt.apk)",
+ "Bash(sh /private/tmp/claude-501/-Users-emanuele-Progetto-Spotify/f8b439da-53e4-49c2-8d23-91a1d07d3cdc/scratchpad/ab.sh)",
+ "Bash(awk '/^0,/{n++; t=\\($14-$5\\)/1e6; d=\\($8-$7\\)/1e6; sync=\\($10-$9\\)/1e6; iss=\\($12-$11\\)/1e6; sum+=t; sd+=d; ss+=sync; si+=iss} END{printf \"frames=%d total=%.1fms draw=%.1f sync=%.1f issue=%.1f\\\\n\", n, sum/n, sd/n, ss/n, si/n}')",
+ "Bash(awk -F, '/^0,/{n++; tot+=\\($14-$2\\)/1e6; inp+=\\($8-$6\\)/1e6; trav+=\\($9-$8\\)/1e6; rec+=\\($11-$9\\)/1e6; iss+=\\($13-$12\\)/1e6} END{printf \"frames=%d total=%.1f input+anim=%.1f measure/layout=%.1f record=%.1f issue=%.1f\\\\n\",n,tot/n,inp/n,trav/n,rec/n,iss/n}')",
+ "Bash(awk -F, '{print NF}')",
+ "Bash(awk -F, '/^0,/{n++; inp+=\\($8-$6\\)/1e6; trav+=\\($9-$8\\)/1e6; rec+=\\($15-$9\\)/1e6; sync+=\\($16-$15\\)/1e6; iss+=\\($17-$16\\)/1e6; gpu+=\\($21-$17\\)/1e6; tot+=\\($18-$3\\)/1e6} END{printf \"frames=%d total=%.1f anim=%.1f measure+layout=%.1f record=%.1f sync=%.1f issue=%.1f gpu=%.1f\\\\n\",n,tot/n,inp/n,trav/n,rec/n,sync/n,iss/n,gpu/n}')",
+ "Bash(unzip -o -q classes.jar -d cls)",
+ "Bash(javap -classpath cls com.kyant.backdrop.backdrops.CanvasBackdropKt com.kyant.backdrop.backdrops.LayerBackdropKt com.kyant.backdrop.backdrops.BackdropKt)",
+ "Bash(sed -i '' 's/ if \\(sheetsOpen\\) Modifier.layerBackdrop\\(overlayBackdrop\\)/ if \\(sheetsOpen || sheetsRecording\\) Modifier.layerBackdrop\\(overlayBackdrop\\)/' app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt)",
+ "Bash(./gradlew :app:assembleRelease :app:assembleDebug -q)"
]
}
}
diff --git a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
index 0fdd496..2eda7a2 100644
--- a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logc
a
_/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ��߈�3`
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ɜ���3  ��߈�3`
^
-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json  �����3� ��߈�3e
+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json  ɜ���3� ��߈�3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json  �����3� ��߈�3R
+a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json  ɜ���3� ��߈�3R
P
-N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja  �����3� ��߈�3V
+N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja  ʜ���3� ��߈�3V
T
-R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt  �����3[
+R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt  ʜ���3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt  �����3 @ ��߈�3\
+W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt  ʜ���3 @ ��߈�3\
Z
-X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json  �����3֚ ��߈�3`
+X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json  ʜ���3֚ ��߈�3`
^
-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin  �����3 �" ��߈�3f
+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin  ʜ���3 �" ��߈�3f
d
-b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt  �����3
+b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt  ʜ���3
� ��߈�3Y
W
-U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json  �����3  ( ��߈�3^
+U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json  ʜ���3  ( ��߈�3^
\
-Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt  �����3  Y ��߈�3D
+Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt  ˜���3  Y ��߈�3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  ˜���3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index ef71470..a403867 100644
--- a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logl
j
h/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ����3  ����3i
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �ݚ��3  ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  ����3� ����3n
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �ݚ��3� ����3n
l
-j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  ����3� �����3[
+j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �ݚ��3� �����3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  ����3�� ����3_
+W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �ݚ��3�� ����3_
]
-[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  ����3d
+[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �ݚ��3d
b
-`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  ����3 @ ����3e
+`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �ݚ��3 @ ����3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  ����3�� ����3i
+a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �ݚ��3�� ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  ����3 �" ����3o
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �ݚ��3 �" ����3o
m
-k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  ����3
+k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �ݚ��3
� ����3b
`
-^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  ����3  ( ����3g
+^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �ݚ��3  ( ����3g
e
-c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  ����3  b ����3D
+c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �ݚ��3  b ����3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  ����3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �ݚ��3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
index 28434fc..35d5ede 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/SpotApp.kt
@@ -29,6 +29,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -320,11 +321,48 @@ fun SpotApp(
// actually beneath them, so they looked like frosted panels
// rather than like glass: nothing of the list underneath ever
// showed through.
- Box(Modifier.fillMaxSize().layerBackdrop(overlayBackdrop)) {
+ // Recorded only while something samples it.
+ //
+ // A layer backdrop is not free to keep: the subtree draws into
+ // an offscreen buffer the size of the window and that buffer is
+ // then composited, every frame, whether or not anyone reads it.
+ // The sheets that read this one are shut most of the time, so
+ // the whole app was paying for a full-screen copy of itself for
+ // nothing.
+ val sheetsOpen = trackMenu != null || addToPlaylist.open
+ // Kept on a little past the close, or the layer would stop
+ // being recorded while the sheet is still fading out over it
+ // and the panel would go black on the way down.
+ var sheetsRecording by remember { mutableStateOf(false) }
+ LaunchedEffect(sheetsOpen) {
+ if (sheetsOpen) sheetsRecording = true
+ else {
+ kotlinx.coroutines.delay(400)
+ sheetsRecording = false
+ }
+ }
+ Box(
+ Modifier
+ .fillMaxSize()
+ .then(
+ if (sheetsOpen || sheetsRecording) Modifier.layerBackdrop(overlayBackdrop)
+ else Modifier,
+ ),
+ ) {
+ // Same trade for the page layer: the only things that read it
+ // are the tab bar and the mini player, and a fully open player
+ // covers both. Derived so it flips once at the end of the
+ // animation rather than recomposing on every frame of it.
+ val barsVisible by remember {
+ derivedStateOf { expand.value < 0.999f }
+ }
Box(
Modifier
.fillMaxSize()
- .layerBackdrop(pageBackdrop),
+ .then(
+ if (barsVisible) Modifier.layerBackdrop(pageBackdrop)
+ else Modifier,
+ ),
) {
Box(
Modifier
diff --git a/app/src/main/java/dev/emanuele/spot/ui/glass/LiquidBottomTabs.kt b/app/src/main/java/dev/emanuele/spot/ui/glass/LiquidBottomTabs.kt
index ab5c269..95bff7d 100644
--- a/app/src/main/java/dev/emanuele/spot/ui/glass/LiquidBottomTabs.kt
+++ b/app/src/main/java/dev/emanuele/spot/ui/glass/LiquidBottomTabs.kt
@@ -223,14 +223,25 @@ fun LiquidBottomTabs(
.drawBackdrop(
backdrop = backdrop,
shape = { Capsule() },
+ // LOCAL CHANGE: only while pressed.
+ //
+ // This copy of the row is drawn at alpha 0 and exists to
+ // feed the indicator; its glass is visible only through
+ // the indicator, which is itself only lit while a finger
+ // is down. Upstream blurs and refracts it on every frame
+ // regardless, which is a second full pass over the bar
+ // for something nobody can see — about a millisecond of
+ // GPU per frame, spent while scrolling a list.
effects = {
val progress = dampedDragAnimation.pressProgress
- vibrancy()
- blur(8f.dp.toPx())
- lens(
- lensDepth.toPx() * progress,
- lensDepth.toPx() * progress
- )
+ if (progress > 0f) {
+ vibrancy()
+ blur(8f.dp.toPx())
+ lens(
+ lensDepth.toPx() * progress,
+ lensDepth.toPx() * progress
+ )
+ }
},
highlight = {
val progress = dampedDragAnimation.pressProgress
@@ -261,13 +272,18 @@ fun LiquidBottomTabs(
.drawBackdrop(
backdrop = rememberCombinedBackdrop(backdrop, tabsBackdrop),
shape = { Capsule() },
+ // LOCAL CHANGE: same reason as the row above. At rest the
+ // refraction amount is zero, so the shader was running over
+ // the indicator to displace nothing.
effects = {
val progress = dampedDragAnimation.pressProgress
- lens(
- 10f.dp.toPx() * progress,
- 14f.dp.toPx() * progress,
- chromaticAberration = true
- )
+ if (progress > 0f) {
+ lens(
+ 10f.dp.toPx() * progress,
+ 14f.dp.toPx() * progress,
+ chromaticAberration = true
+ )
+ }
},
highlight = {
val progress = dampedDragAnimation.pressProgress