Skip to content

Commit

Permalink
fix: fallback to model for device name (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Jun 6, 2023
1 parent 5d8e985 commit 4f3e4d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/android-no-bt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-mobile": "patch"
---

Fix `cargo android run` crashing because it can't detect device name using bluetooth_manager for devices without bluetooth like geneymotion.
4 changes: 2 additions & 2 deletions src/android/adb/device_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ pub fn device_list(env: &Env) -> Result<BTreeSet<Device<'static>>, Error> {
.vars(env.explicit_env())
.stdout_capture();

super::check_authorized(cmd.start()?.wait()?)
super::check_authorized(&cmd.run()?)
.map(|raw_list| {
regex_multi_line!(ADB_DEVICE_REGEX)
.captures_iter(&raw_list)
.map(|caps| {
assert_eq!(caps.len(), 2);
let serial_no = caps.get(1).unwrap().as_str().to_owned();
let name = device_name(env, &serial_no).map_err(Error::NameFailed)?;
let model = get_prop(env, &serial_no, "ro.product.model")
.map_err(Error::ModelFailed)?;
let name = device_name(env, &serial_no).unwrap_or_else(|_| model.clone());
let abi = get_prop(env, &serial_no, "ro.product.cpu.abi")
.map_err(Error::AbiFailed)?;
let target =
Expand Down

0 comments on commit 4f3e4d7

Please sign in to comment.