Skip to content

Commit 665b055

Browse files
authored
Fix device info comparison for Android devices (#45)
Fixed inconsistent Android device manufacturer and model matching. Some devices reported manufacturer and model information in non-lowercased form, which could cause device identification issues. Device information is now normalized to lowercase for consistent matching.
1 parent 88bec52 commit 665b055

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
__default__: prerelease
3+
---
4+
5+
Fixed inconsistent Android device manufacturer and model matching. Some devices reported manufacturer and model information in non-lowercased form, which could cause device identification issues. Device information is now normalized to lowercase for consistent matching.

packages/platform-android/src/adb-id.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,18 @@ export const getAdbId = async (
2323
}
2424
} else if (isAndroidDevicePhysical(device)) {
2525
const deviceInfo = await adb.getDeviceInfo(adbId);
26+
27+
if (!deviceInfo) {
28+
// This should never happen as we already checked if the device is physical.
29+
return null;
30+
}
31+
32+
const normalizedManufacturer = deviceInfo.manufacturer?.toLowerCase() ?? '';
33+
const normalizedModel = deviceInfo.model?.toLowerCase() ?? '';
34+
2635
if (
27-
deviceInfo?.manufacturer === device.manufacturer &&
28-
deviceInfo?.model === device.model
36+
normalizedManufacturer === device.manufacturer &&
37+
normalizedModel === device.model
2938
) {
3039
return adbId;
3140
}

0 commit comments

Comments
 (0)