Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: streaming on Android devices #1403

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions core/src/connection/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions core/src/login5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ impl Login5Manager {
async fn login5_request(&self, login: Login_method) -> Result<LoginOk, Error> {
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,
};

Expand Down