From 080aa3f1236a5d4a8a88185ae609a3590eeb46f3 Mon Sep 17 00:00:00 2001 From: SilverMira <66930495+SilverMira@users.noreply.github.com> Date: Sun, 24 Nov 2024 01:19:58 +0800 Subject: [PATCH 1/4] fix: android Session::connect failure from TryAnotherAP It appears that a combination of `Platform::PLATFORM_ANDROID_ARM` and connecting with `Credentials::with_access_token` causes all AP to error TryAnotherAP --- core/src/connection/handshake.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/connection/handshake.rs b/core/src/connection/handshake.rs index 03b355985..c94b1fb7a 100644 --- a/core/src/connection/handshake.rs +++ b/core/src/connection/handshake.rs @@ -111,7 +111,6 @@ where thread_rng().fill_bytes(&mut client_nonce); let platform = match crate::config::OS { - "android" => Platform::PLATFORM_ANDROID_ARM, "freebsd" | "netbsd" | "openbsd" => match ARCH { "x86_64" => Platform::PLATFORM_FREEBSD_X86_64, _ => Platform::PLATFORM_FREEBSD_X86, @@ -120,7 +119,12 @@ where "aarch64" => Platform::PLATFORM_IPHONE_ARM64, _ => Platform::PLATFORM_IPHONE_ARM, }, - "linux" => match ARCH { + // Rather than sending `Platform::PLATFORM_ANDROID_ARM` for "android", + // we are spoofing "android" as "linux", as otherwise during Session::connect + // all APs will reject the client with TryAnotherAP, no matter the credentials + // used was obtained via OAuth using KEYMASTER or ANDROID's client ID or + // Login5Manager::login + "linux" | "android" => match ARCH { "arm" | "aarch64" => Platform::PLATFORM_LINUX_ARM, "blackfin" => Platform::PLATFORM_LINUX_BLACKFIN, "mips" => Platform::PLATFORM_LINUX_MIPS, From b488b8f2fb4796ae254bea8ef0110d80d0bff549 Mon Sep 17 00:00:00 2001 From: SilverMira <66930495+SilverMira@users.noreply.github.com> Date: Sun, 24 Nov 2024 01:21:21 +0800 Subject: [PATCH 2/4] fix: getting api access token should respect client id If we are trying to get an access token from login5 using stored credentials, ie: from oauth flow, we should use the oauth's client ID, this matches with the semantics as described in `Login5Manager::auth_token` --- core/src/login5.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/login5.rs b/core/src/login5.rs index dca8f27ea..75f739a12 100644 --- a/core/src/login5.rs +++ b/core/src/login5.rs @@ -75,6 +75,11 @@ impl Login5Manager { async fn login5_request(&self, login: Login_method) -> Result { let client_id = match OS { "macos" | "windows" => self.session().client_id(), + // StoredCredential is used to get an access_token from Session credentials. + // Using the session client_id allows user to use Keymaster on Android/IOS + // if their Credentials::with_access_token was obtained there, assuming + // they have overriden the SessionConfig::client_id with the Keymaster's. + _ if matches!(login, Login_method::StoredCredential(_)) => self.session().client_id(), _ => SessionConfig::default().client_id, }; From 62c1eba00b83e7c8bf9b42738161b52c9741e32f Mon Sep 17 00:00:00 2001 From: SilverMira <66930495+SilverMira@users.noreply.github.com> Date: Sun, 24 Nov 2024 17:41:25 +0800 Subject: [PATCH 3/4] fix: cpu_family arm64 should be aarch64 --- core/src/connection/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 2e9bbdb43..6f2c7d440 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -101,7 +101,7 @@ pub async fn authenticate( let cpu_family = match std::env::consts::ARCH { "blackfin" => CpuFamily::CPU_BLACKFIN, - "arm" | "arm64" => CpuFamily::CPU_ARM, + "arm" | "aarch64" => CpuFamily::CPU_ARM, "ia64" => CpuFamily::CPU_IA64, "mips" => CpuFamily::CPU_MIPS, "ppc" => CpuFamily::CPU_PPC, From d73b9e08df3623646fbb645d782ced06161d1d49 Mon Sep 17 00:00:00 2001 From: SilverMira <66930495+SilverMira@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:27:18 +0800 Subject: [PATCH 4/4] Fix audio streaming on Android platform (#1399) --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82bfb094a..5bfc6c6e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- [core] Fix all APs rejecting with "TryAnotherAP" when connecting session + on Android platform. +- [core] Fix "Invalid Credentials" when using a Keymaster access token and + client ID on Android platform. + ### Removed ## [0.6.0] - 2024-10-30