Skip to content

Commit fc668ef

Browse files
committed
Backport - Improve device detection for Generic device: capture its device model instead of its Android version
(cherry picked from commit 6c6ff97)
1 parent 0543fb2 commit fc668ef

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/ua-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@
793793
], [[TYPE, TABLET]], [
794794
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
795795
], [[TYPE, MOBILE]], [
796-
/(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
796+
/droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device
797797
], [MODEL, [VENDOR, 'Generic']]
798798
],
799799

test/device-test.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5944,7 +5944,14 @@
59445944
"ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; i980 Build/MRA58K)",
59455945
"expect": {
59465946
"vendor": "Generic",
5947-
"model": "Android 6.0.1"
5947+
"model": "i980"
5948+
}
5949+
},{
5950+
"desc": "Generic Android Device",
5951+
"ua": "Dalvik/2.1.0 (Linux; U; Android 9; X96mini_RP Build/X96mini_RP)",
5952+
"expect": {
5953+
"vendor": "Generic",
5954+
"model": "X96mini_RP"
59485955
}
59495956
},
59505957
{

0 commit comments

Comments
 (0)