Pick several audio sources at once, with the apps' own icons

The phone had no way to choose which apps a stream carries: the
studio's audio picker added one source and closed, and Android's app
list had names only. The picker now marks what is mixed in already
(stream.audio_sources) and switches a source on or off with a tap, so
several apps (and the microphone, desktop audio, test tones) are picked
in one go; Done closes it. Android's launchable apps come with their
icons: Kotlin draws each app's icon once per installed version into a
96 px PNG in the cache and hands over its path (AudioApp::icon), which
the picker shows. The shared window's audio is not offered on Android,
which shares the whole screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 18:30:04 +03:00
1 parent 1eabbb4704
commit ecb0e11668
7 files changed
+144 -47

No files matched your search

+11 -8
View File
@@ -181,8 +181,9 @@ pub fn stop_audio_input(id: u64) -> Result<()> {
})
}
/// Launchable apps other than ours, as `(label, package)`, sorted by label.
pub fn launchable_apps() -> Result<Vec<(String, String)>> {
/// Launchable apps other than ours, as `(label, package, icon)`, sorted by
/// label; `icon` is the path of a PNG in the app's cache, or empty.
pub fn launchable_apps() -> Result<Vec<(String, String, String)>> {
let lines = with_bridge(|env, class| {
let value = env
.call_static_method(
@@ -201,15 +202,17 @@ pub fn launchable_apps() -> Result<Vec<(String, String)>> {
Ok(parse_apps(&lines))
}
/// `label<TAB>package` lines.
fn parse_apps(lines: &str) -> Vec<(String, String)> {
/// `label<TAB>package<TAB>icon` lines (the icon may be missing).
fn parse_apps(lines: &str) -> Vec<(String, String, String)> {
lines
.lines()
.filter_map(|line| {
let (label, package) = line.split_once('\t')?;
let package = package.trim();
let label = if label.trim().is_empty() { package } else { label.trim() };
(!package.is_empty()).then(|| (label.to_owned(), package.to_owned()))
let mut parts = line.split('\t');
let label = parts.next()?.trim();
let package = parts.next()?.trim();
let icon = parts.next().unwrap_or_default().trim();
let label = if label.is_empty() { package } else { label };
(!package.is_empty()).then(|| (label.to_owned(), package.to_owned(), icon.to_owned()))
})
.collect()
}
+2 -1
View File
@@ -196,9 +196,10 @@ impl AudioProvider for PlaybackAudio {
match bridge::launchable_apps() {
Ok(apps) => apps
.into_iter()
.map(|(name, package)| AudioApp {
.map(|(name, package, icon)| AudioApp {
name,
binary: Some(package),
icon: (!icon.is_empty()).then_some(icon),
..AudioApp::default()
})
.collect(),