mirror of
https://github.com/anomalyco/hex.git
synced 2026-12-04 18:54:29 +08:00
detect meet calls in the aside browser (#2527)
This commit is contained in:
@@ -1288,8 +1288,8 @@ what is playing, so Hex hears the browsers through a private process tap
|
||||
(aggregate `anomaly.hex.browser-tap.<pid>`, apart from the meeting tap) and sends
|
||||
play only after it saw the browser go silent right after its own pause. The
|
||||
browsers are the ones [microphone_activity.rs](../../src/microphone_activity.rs)
|
||||
knows: Chrome, Brave, Safari, Firefox, Edge, Arc, Vivaldi, Helium, Ardia, and
|
||||
Zen, whose helpers count as their browser. The sequence checks in
|
||||
knows: Chrome, Brave, Safari, Firefox, Edge, Arc, Vivaldi, Helium, Ardia,
|
||||
Zen, and Aside, whose helpers count as their browser. The sequence checks in
|
||||
[audio/browser_media.rs](../../src/audio/browser_media.rs) run on fakes:
|
||||
`a_confirmed_pause_is_resumed`, `two_sounding_tabs_never_get_play`,
|
||||
`a_browser_already_playing_gets_no_play`, `a_call_is_never_paused`,
|
||||
@@ -1532,9 +1532,10 @@ other way. Check: `the_page_is_read_only_when_processing_uses_it` in
|
||||
browser. On macOS the front window's title is read only by meeting detection
|
||||
and while a script transformation is set up (`reads_window_title`). When
|
||||
something uses the page, macOS asks the front tab of Safari, Orion, Chrome,
|
||||
Brave, Edge, Arc, Vivaldi, Opera, Helium, and Chromium over AppleScript (one
|
||||
Automation prompt per browser; a refusal keeps the application context) and
|
||||
reads any other app's focused AXWebArea `AXURL` (Firefox, Zen, web views).
|
||||
Brave, Edge, Arc, Vivaldi, Opera, Helium, Chromium, and Aside over
|
||||
AppleScript (one Automation prompt per browser; a refusal keeps the
|
||||
application context) and reads any other app's focused AXWebArea `AXURL`
|
||||
(Firefox, Zen, web views).
|
||||
That AppleScript read is not part of the 500 ms foreground-context poll: the
|
||||
poll reads it once when a scriptable browser becomes the frontmost process
|
||||
(caching its address, or no address after a failed read, per pid), so
|
||||
|
||||
@@ -484,17 +484,21 @@ Brave's), Helium (`net.imput.helium`, helpers included; `helium` and
|
||||
(`com.ardia.browser`, its Chromium audio service reports
|
||||
`com.ardia.browser.helper`), Zen (`app.zen-browser.zen`; Firefox-based, so its
|
||||
helpers are `app.zen-browser.*` rather than `org.mozilla.*`, and on Linux the
|
||||
microphone's `zen` or `zen-bin` binary maps to it), and Vivaldi
|
||||
microphone's `zen` or `zen-bin` binary maps to it), Vivaldi
|
||||
(`com.vivaldi.Vivaldi`; `vivaldi-bin` and friends on Linux, `vivaldi.exe` on
|
||||
Windows). Arc was missing until #801, so its Meet calls were never detected;
|
||||
Vivaldi was missing until #1105, so its calls
|
||||
Windows), and Aside (`at.studio.AsideBrowser`, whose Chromium audio service
|
||||
reports `at.studio.AsideBrowser.helper`; tab titles end in ` - Aside`). Arc
|
||||
was missing until #801, so its Meet calls were never detected; Vivaldi was
|
||||
missing until #1105, so its calls
|
||||
(Teams in a Vivaldi web app included) were never offered; Ardia and Zen were
|
||||
missing until #1875, so their calls were never offered. Checks:
|
||||
missing until #1875, so their calls were never offered; Aside was missing
|
||||
until #2525, so its Meet calls were never detected. Checks:
|
||||
`a_google_meet_call_in_arc_records_after_about_two_seconds`,
|
||||
`a_google_meet_call_in_aside_records_after_about_two_seconds`,
|
||||
`vivaldi_on_the_microphone_is_a_browser_call`,
|
||||
`ardia_on_the_microphone_is_a_named_browser_call`, and
|
||||
`zen_on_the_microphone_is_a_named_browser_call`. Not observed on a real
|
||||
Vivaldi, Ardia, or Zen call.
|
||||
Vivaldi, Ardia, Zen, or Aside call.
|
||||
|
||||
Teams pages (`teams.microsoft.com`, `teams.cloud.microsoft`, and
|
||||
`teams.live.com`) are known call sites: a browser on one is a
|
||||
|
||||
@@ -624,6 +624,7 @@ macro_rules! browsers {
|
||||
|
||||
#[cfg(any(target_os = "macos", test))]
|
||||
const SCRIPTABLE_BROWSERS: &[ScriptableBrowser] = browsers![
|
||||
("at.studio.AsideBrowser", "Aside", Chromium),
|
||||
("com.apple.Safari", "Safari", Safari),
|
||||
(
|
||||
"com.apple.SafariTechnologyPreview",
|
||||
@@ -1080,6 +1081,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn scriptable_browsers_are_found_by_bundle_id() {
|
||||
assert_eq!(
|
||||
ScriptableBrowser::from_bundle_id("at.studio.AsideBrowser").map(|browser| browser.name),
|
||||
Some("Aside")
|
||||
);
|
||||
assert_eq!(
|
||||
ScriptableBrowser::from_bundle_id("com.google.Chrome").map(|browser| browser.name),
|
||||
Some("Google Chrome")
|
||||
|
||||
@@ -806,9 +806,10 @@ impl BrowserPageMemory {
|
||||
}
|
||||
|
||||
fn is_browser_application(application_lower: &str) -> bool {
|
||||
// Arc's and Zen's names are too short to match as a substring: `Citizen`
|
||||
// and `Zendesk` are not browsers.
|
||||
// Arc's, Aside's, and Zen's names are too short or too common to match as
|
||||
// a substring: `Citizen`, `Seaside`, and `Zendesk` are not browsers.
|
||||
application_lower == "arc"
|
||||
|| application_lower == "aside"
|
||||
|| application_lower == "zen"
|
||||
|| application_lower.starts_with("zen ")
|
||||
|| [
|
||||
@@ -837,6 +838,7 @@ fn context_matches_browser(
|
||||
"org.mozilla.firefox" => lower.contains("firefox"),
|
||||
"com.microsoft.edgemac" => lower.contains("edge"),
|
||||
"company.thebrowser.Browser" => lower == "arc",
|
||||
"at.studio.AsideBrowser" => lower == "aside",
|
||||
"com.vivaldi.Vivaldi" => lower.contains("vivaldi"),
|
||||
"net.imput.helium" => lower.contains("helium"),
|
||||
"com.ardia.browser" => lower.contains("ardia"),
|
||||
@@ -929,6 +931,7 @@ pub(crate) const BROWSER_TITLE_SUFFIXES: &[&str] = &[
|
||||
" - Microsoft Edge",
|
||||
" - Safari",
|
||||
" - Arc",
|
||||
" - Aside",
|
||||
" - Vivaldi",
|
||||
" - Helium",
|
||||
" - Ardia",
|
||||
@@ -1810,6 +1813,15 @@ mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(helium.title, "Weekly Architecture");
|
||||
assert!(helium.named);
|
||||
|
||||
let aside = candidate_from_context(&context(
|
||||
"Aside",
|
||||
Some("https://meet.google.com/abc-defg-hij"),
|
||||
"Meet – Weekly Architecture - Aside",
|
||||
))
|
||||
.unwrap();
|
||||
assert_eq!(aside.title, "Weekly Architecture");
|
||||
assert!(aside.named);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3218,6 +3230,39 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_google_meet_call_in_aside_records_after_about_two_seconds() {
|
||||
// Aside's Chromium audio service holds the microphone and reports
|
||||
// `at.studio.AsideBrowser.helper`; the main app is
|
||||
// `at.studio.AsideBrowser`.
|
||||
let aside_helper = ActiveMicrophoneApplication {
|
||||
pid: 5320,
|
||||
bundle_id: "at.studio.AsideBrowser.helper".into(),
|
||||
name: "Aside Helper".into(),
|
||||
};
|
||||
assert!(aside_helper.is_browser());
|
||||
let meet = candidate_from_microphone(
|
||||
&aside_helper,
|
||||
&context(
|
||||
"Aside",
|
||||
Some("https://meet.google.com/abc-defg-hij"),
|
||||
"Meet - Design sync - Aside",
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(meet.source, MeetingSource::GoogleMeet);
|
||||
assert_eq!(meet.application.as_deref(), Some("at.studio.AsideBrowser"));
|
||||
assert_eq!(meet.application_name.as_deref(), Some("Aside"));
|
||||
assert_eq!(meet.site.as_deref(), Some("meet.google.com"));
|
||||
let always = [choice("meet.google.com", MeetingPolicy::AlwaysRecord)];
|
||||
let mut watch = Watch::new();
|
||||
assert!(watch.run(Some(&meet), &always, 2_000).is_empty());
|
||||
assert_eq!(
|
||||
watch.run(Some(&meet), &always, 500),
|
||||
[(2_000, Detection::Record(meet))]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_google_meet_call_in_arc_without_its_address_is_known_by_its_title() {
|
||||
let arc_helper = ActiveMicrophoneApplication {
|
||||
|
||||
@@ -98,6 +98,7 @@ pub(crate) fn is_browser_id(canonical_bundle_id: Option<&str>) -> bool {
|
||||
| "net.imput.helium"
|
||||
| "com.ardia.browser"
|
||||
| "app.zen-browser.zen"
|
||||
| "at.studio.AsideBrowser"
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -391,6 +392,7 @@ pub(crate) fn canonical_bundle_id_for(bundle_id: &str, name: Option<&str>) -> Op
|
||||
("im.riot.app", "im.riot.app"),
|
||||
("com.apple.mobilephone", "com.apple.mobilephone"),
|
||||
("com.google.chrome", "com.google.Chrome"),
|
||||
("at.studio.asidebrowser", "at.studio.AsideBrowser"),
|
||||
("com.brave.browser", "com.brave.Browser"),
|
||||
("com.apple.safari", "com.apple.Safari"),
|
||||
("org.mozilla.firefox", "org.mozilla.firefox"),
|
||||
@@ -430,6 +432,7 @@ pub(crate) fn canonical_application_name(canonical_bundle_id: &str) -> Option<&'
|
||||
"com.webex.meetingmanager" => Some("Webex"),
|
||||
"im.riot.app" => Some("Element"),
|
||||
"com.apple.mobilephone" => Some("Phone"),
|
||||
"at.studio.AsideBrowser" => Some("Aside"),
|
||||
"com.google.Chrome" => Some("Google Chrome"),
|
||||
"com.brave.Browser" => Some("Brave Browser"),
|
||||
"com.apple.Safari" => Some("Safari"),
|
||||
@@ -1062,6 +1065,7 @@ mod tests {
|
||||
assert!(browser_bundle("com.google.Chrome.helper", None));
|
||||
assert!(browser_bundle("net.imput.helium.helper", None));
|
||||
assert!(browser_bundle("com.ardia.browser.helper", None));
|
||||
assert!(browser_bundle("at.studio.AsideBrowser.helper", None));
|
||||
assert!(browser_bundle("app.zen-browser.zen", None));
|
||||
assert!(browser_bundle("app.zen-browser.plugincontainer", None));
|
||||
assert!(browser_bundle(
|
||||
@@ -1136,6 +1140,18 @@ mod tests {
|
||||
true,
|
||||
),
|
||||
("company.thebrowser.dia", "Dia", None, false),
|
||||
(
|
||||
"at.studio.AsideBrowser",
|
||||
"Aside",
|
||||
Some("at.studio.AsideBrowser"),
|
||||
true,
|
||||
),
|
||||
(
|
||||
"at.studio.AsideBrowser.helper",
|
||||
"Aside Helper",
|
||||
Some("at.studio.AsideBrowser"),
|
||||
true,
|
||||
),
|
||||
("net.imput.helium", "Helium", Some("net.imput.helium"), true),
|
||||
(
|
||||
"net.imput.helium.helper",
|
||||
|
||||
Reference in New Issue
Block a user