Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.

Commit 3b0e113

Browse files
author
kikuchi kakeru
committed
Fix detection of Linux ARM-based Android
Signed-off-by: Kakeru Kikuchi <[email protected]>
1 parent 07df220 commit 3b0e113

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Not yet published
44

55
- Fix detection of Firefox on iPad.
6+
- Fix detection of Linux ARM-based Android.
67

78
## 0.5.2
89

all_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,18 @@ var uastrings = []struct {
624624
ua: "[FBAN/FB4A;FBAV/16.0.0.20.15;FBBV/4061184;FBDM/{density=1.5,width=540,height=960};FBLC/en_US;FB_FW/2;FBCR/MY CELCOM;FBPN/com.facebook.katana;FBDV/Lenovo A850+;FBSV/4.2.2;FBOP/1;FBCA/armeabi-v7a:armeabi;]",
625625
expected: "Bot:false Mobile:false",
626626
},
627+
628+
// arm_64
629+
{
630+
title: "Samsung S7 Edge - YaBrowser",
631+
ua: "Mozilla/5.0 (Linux; arm_64; Android 8.0.0; SM-G935F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 YaBrowser/19.12.3.101.00 Mobile Safari/537.36",
632+
expected: "Mozilla:5.0 Platform:Linux OS:Android 8.0.0 Localization:SM-G935F Browser:YaBrowser-19.12.3.101.00 Engine:AppleWebKit-537.36 Bot:false Mobile:true",
633+
},
634+
{
635+
title: "HUAWEI P20 lite - YaBrowser",
636+
ua: "Mozilla/5.0 (Linux; arm_64; Android 9; ANE-LX2J) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.136 YaBrowser/20.2.6.114.00 Mobile Safari/537.36",
637+
expected: "Mozilla:5.0 Platform:Linux OS:Android 9 Localization:ANE-LX2J Browser:YaBrowser-20.2.6.114.00 Engine:AppleWebKit-537.36 Bot:false Mobile:true",
638+
},
627639
}
628640

629641
// Internal: beautify the UserAgent reference into a string so it can be

operating_systems.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func webkit(p *UserAgent, comment []string) {
7878
p.browser.Name = "Android"
7979
}
8080
if len(comment) > 1 {
81-
if comment[1] == "U" {
81+
if comment[1] == "U" || comment[1] == "arm_64" {
8282
if len(comment) > 2 {
8383
p.os = comment[2]
8484
} else {
@@ -131,7 +131,7 @@ func webkit(p *UserAgent, comment []string) {
131131
// argument is a slice of strings containing the comment.
132132
func gecko(p *UserAgent, comment []string) {
133133
if len(comment) > 1 {
134-
if comment[1] == "U" {
134+
if comment[1] == "U" || comment[1] == "arm_64" {
135135
if len(comment) > 2 {
136136
p.os = normalizeOS(comment[2])
137137
} else {

0 commit comments

Comments
 (0)