From 31e4cafde901aa96ca78ac14e666281c275e1fbf Mon Sep 17 00:00:00 2001 From: Liviu-Mihail Concioiu Date: Sat, 28 Dec 2024 18:23:27 +0100 Subject: [PATCH] Improves detection for feature phones --- DeviceDetector.php | 9 ++- Tests/fixtures/feature_phone.yml | 126 +++++++++++++++++++++++++++++++ Tests/fixtures/podcasting.yml | 6 +- Tests/fixtures/smartphone-29.yml | 18 ----- Tests/fixtures/smartphone-3.yml | 18 ----- Tests/fixtures/smartphone-40.yml | 18 ----- Tests/fixtures/smartphone-8.yml | 54 ------------- Tests/fixtures/smartphone-9.yml | 18 ----- 8 files changed, 137 insertions(+), 130 deletions(-) diff --git a/DeviceDetector.php b/DeviceDetector.php index 89eec3f351..86478cdc83 100644 --- a/DeviceDetector.php +++ b/DeviceDetector.php @@ -1017,12 +1017,19 @@ protected function parseDevice(): void } /** - * All unknown devices under running Java ME are more likely a features phones + * All unknown devices under running Java ME are more likely features phones */ if ('Java ME' === $osName && null === $this->device) { $this->device = AbstractDeviceParser::DEVICE_TYPE_FEATURE_PHONE; } + /** + * All smartphones running KaiOS are more likely features phones + */ + if ('KaiOS' === $osName && AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE === $this->device) { + $this->device = AbstractDeviceParser::DEVICE_TYPE_FEATURE_PHONE; + } + /** * According to http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx * Internet Explorer 10 introduces the "Touch" UA string token. If this token is present at the end of the diff --git a/Tests/fixtures/feature_phone.yml b/Tests/fixtures/feature_phone.yml index bdda14cce4..4ad2a39f7a 100644 --- a/Tests/fixtures/feature_phone.yml +++ b/Tests/fixtures/feature_phone.yml @@ -1822,3 +1822,129 @@ model: Core-S4 os_family: Firefox OS browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; ALCATEL4044T; rv:37.0) Gecko/37.0 Firefox/37.0 KaiOS/1.0 + os: + name: KaiOS + version: "1.0" + platform: "" + client: + type: browser + name: Firefox Mobile + version: "37.0" + engine: Gecko + engine_version: "37.0" + device: + type: feature phone + brand: Alcatel + model: Go Flip + os_family: Firefox OS + browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; LYF/LF-2403N/LYF-LF2403N-000-01-38-151217;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.0 + os: + name: KaiOS + version: "2.0" + platform: "" + client: + type: browser + name: Firefox Mobile + version: "48.0" + engine: Gecko + engine_version: "48.0" + device: + type: feature phone + brand: LYF + model: LF-2403N + os_family: Firefox OS + browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; LYF/F90M/LYF-F90M-000-02-28-130318; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.0 + os: + name: KaiOS + version: "2.0" + platform: "" + client: + type: browser + name: Firefox Mobile + version: "48.0" + engine: Gecko + engine_version: "48.0" + device: + type: feature phone + brand: LYF + model: F90M + os_family: Firefox OS + browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; LYF/F30C/LYF_F30C-000-09-10-140318; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.0 + os: + name: KaiOS + version: "2.0" + platform: "" + client: + type: browser + name: Firefox Mobile + version: "48.0" + engine: Gecko + engine_version: "48.0" + device: + type: feature phone + brand: LYF + model: F30C + os_family: Firefox OS + browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; IPRO_K2_3G; rv:48.0; CAEN) Gecko/48.0 Firefox/48.0 KAIOS/2.5.1.2 + os: + name: KaiOS + version: 2.5.1.2 + platform: "" + client: + type: browser + name: Firefox Mobile + version: "48.0" + engine: Gecko + engine_version: "48.0" + device: + type: feature phone + brand: iPro + model: K2 3G + os_family: Firefox OS + browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; CAT B35; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5.1 + os: + name: KaiOS + version: 2.5.1 + platform: "" + client: + type: browser + name: Firefox Mobile + version: "48.0" + engine: Gecko + engine_version: "48.0" + device: + type: feature phone + brand: Cat + model: B35 + os_family: Firefox OS + browser_family: Firefox +- + user_agent: Mozilla/5.0 (Mobile; LYF/F120B/LYF-F120B-001-02-05-011118_audio_patch-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5 + os: + name: KaiOS + version: "2.5" + platform: "" + client: + type: browser + name: Firefox Mobile + version: "48.0" + engine: Gecko + engine_version: "48.0" + device: + type: feature phone + brand: LYF + model: F120B + os_family: Firefox OS + browser_family: Firefox diff --git a/Tests/fixtures/podcasting.yml b/Tests/fixtures/podcasting.yml index 609532d9bc..a6b8f37382 100644 --- a/Tests/fixtures/podcasting.yml +++ b/Tests/fixtures/podcasting.yml @@ -5988,7 +5988,7 @@ name: PodKast version: "" device: - type: smartphone + type: feature phone brand: Safaricom model: Kimem Kerefa 4G os_family: Firefox OS @@ -6036,7 +6036,7 @@ name: PodLP version: 1.3.2.0 device: - type: smartphone + type: feature phone brand: LYF model: F271i os_family: Firefox OS @@ -6052,7 +6052,7 @@ name: PodLP version: 2.2.1 device: - type: smartphone + type: feature phone brand: Nokia model: 2720 Flip os_family: Firefox OS diff --git a/Tests/fixtures/smartphone-29.yml b/Tests/fixtures/smartphone-29.yml index a3abdda500..afff69ac03 100644 --- a/Tests/fixtures/smartphone-29.yml +++ b/Tests/fixtures/smartphone-29.yml @@ -6311,24 +6311,6 @@ model: A46 os_family: Android browser_family: Chrome -- - user_agent: Mozilla/5.0 (Mobile; LYF/F120B/LYF-F120B-001-02-05-011118_audio_patch-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5 - os: - name: KaiOS - version: "2.5" - platform: "" - client: - type: browser - name: Firefox Mobile - version: "48.0" - engine: Gecko - engine_version: "48.0" - device: - type: smartphone - brand: LYF - model: F120B - os_family: Firefox OS - browser_family: Firefox - user_agent: Mozilla/5.0 (Linux; Android 10; beryllium) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36 os: diff --git a/Tests/fixtures/smartphone-3.yml b/Tests/fixtures/smartphone-3.yml index 82a73ee210..916fb8f457 100644 --- a/Tests/fixtures/smartphone-3.yml +++ b/Tests/fixtures/smartphone-3.yml @@ -5211,24 +5211,6 @@ model: B15Q os_family: Android browser_family: Chrome -- - user_agent: Mozilla/5.0 (Mobile; CAT B35; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5.1 - os: - name: KaiOS - version: 2.5.1 - platform: "" - client: - type: browser - name: Firefox Mobile - version: "48.0" - engine: Gecko - engine_version: "48.0" - device: - type: smartphone - brand: Cat - model: B35 - os_family: Firefox OS - browser_family: Firefox - user_agent: Mozilla/5.0 (Linux; Android 8.1.0; CUBOT A5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36 os: diff --git a/Tests/fixtures/smartphone-40.yml b/Tests/fixtures/smartphone-40.yml index 6fee609d8b..77b7e2a582 100644 --- a/Tests/fixtures/smartphone-40.yml +++ b/Tests/fixtures/smartphone-40.yml @@ -3273,24 +3273,6 @@ model: A3 Pro 5G os_family: Android browser_family: Unknown -- - user_agent: Mozilla/5.0 (Mobile; IPRO_K2_3G; rv:48.0; CAEN) Gecko/48.0 Firefox/48.0 KAIOS/2.5.1.2 - os: - name: KaiOS - version: 2.5.1.2 - platform: "" - client: - type: browser - name: Firefox Mobile - version: "48.0" - engine: Gecko - engine_version: "48.0" - device: - type: smartphone - brand: iPro - model: K2 3G - os_family: Firefox OS - browser_family: Firefox - user_agent: Mozilla/5.0 (Linux; Android 6.0.0; DOOV L525) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36 os: diff --git a/Tests/fixtures/smartphone-8.yml b/Tests/fixtures/smartphone-8.yml index 9391c82c3a..be13b12247 100644 --- a/Tests/fixtures/smartphone-8.yml +++ b/Tests/fixtures/smartphone-8.yml @@ -8821,42 +8821,6 @@ model: Earth 2 os_family: Android browser_family: Chrome -- - user_agent: Mozilla/5.0 (Mobile; LYF/F30C/LYF_F30C-000-09-10-140318; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.0 - os: - name: KaiOS - version: "2.0" - platform: "" - client: - type: browser - name: Firefox Mobile - version: "48.0" - engine: Gecko - engine_version: "48.0" - device: - type: smartphone - brand: LYF - model: F30C - os_family: Firefox OS - browser_family: Firefox -- - user_agent: Mozilla/5.0 (Mobile; LYF/F90M/LYF-F90M-000-02-28-130318; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.0 - os: - name: KaiOS - version: "2.0" - platform: "" - client: - type: browser - name: Firefox Mobile - version: "48.0" - engine: Gecko - engine_version: "48.0" - device: - type: smartphone - brand: LYF - model: F90M - os_family: Firefox OS - browser_family: Firefox - user_agent: Mozilla/5.0 (Linux; Android 5.1; LS-4004 Build/LMY47D; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36 os: @@ -9019,24 +8983,6 @@ model: Next os_family: Android browser_family: Opera -- - user_agent: Mozilla/5.0 (Mobile; ALCATEL4044T; rv:37.0) Gecko/37.0 Firefox/37.0 KaiOS/1.0 - os: - name: KaiOS - version: "1.0" - platform: "" - client: - type: browser - name: Firefox Mobile - version: "37.0" - engine: Gecko - engine_version: "37.0" - device: - type: smartphone - brand: Alcatel - model: Go Flip - os_family: Firefox OS - browser_family: Firefox - user_agent: Dalvik/2.1.0 (Linux; U; Android 6.0; Dash G Build/MRA58K) os: diff --git a/Tests/fixtures/smartphone-9.yml b/Tests/fixtures/smartphone-9.yml index ba30dab786..d111be6a14 100644 --- a/Tests/fixtures/smartphone-9.yml +++ b/Tests/fixtures/smartphone-9.yml @@ -89,24 +89,6 @@ model: Flame LS-4503 os_family: Android browser_family: Chrome -- - user_agent: Mozilla/5.0 (Mobile; LYF/LF-2403N/LYF-LF2403N-000-01-38-151217;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.0 - os: - name: KaiOS - version: "2.0" - platform: "" - client: - type: browser - name: Firefox Mobile - version: "48.0" - engine: Gecko - engine_version: "48.0" - device: - type: smartphone - brand: LYF - model: LF-2403N - os_family: Firefox OS - browser_family: Firefox - user_agent: Mozilla/5.0 (Linux; Android 5.1.1; LS-5002 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36 os: