public void improveOperatingSystem(MutableUserAgent userAgent, ClientHints clientHints) {
        // Improve the OS info.
        // https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform
        // The Sec-CH-UA-Platform request header field gives a server information about the platform on which
        // a given user agent is executing. It is a Structured Header whose value MUST be a string [RFC8941].
        // Its value SHOULD match one of the following common platform values:
        // - "Android"
        // - "Chrome OS"
        // - "iOS"
        // - "Linux"
        // - "macOS"
        // - "Windows"
        // - "Unknown"
        String platform = clientHints.getPlatform();
        String platformVersion = clientHints.getPlatformVersion();
        if (platform != null && platformVersion != null && !platform.trim().isEmpty() && !platformVersion.trim().isEmpty()) {
//            MutableAgentField osName    = (MutableAgentField) userAgent.get(UserAgent.OPERATING_SYSTEM_NAME);
            String majorVersion = VersionSplitter.getInstance().getSingleSplit(platformVersion, 1);

            switch (platform) {
                case "macOS":
                case "Mac OS X":
                    overrideValue(userAgent.get(DEVICE_BRAND), "Apple");
                    overrideValue(userAgent.get(DEVICE_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(OPERATING_SYSTEM_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(LAYOUT_ENGINE_CLASS), "Browser");
                    overrideValue(userAgent.get(AGENT_CLASS), "Browser");
                    break;

                case "iOS":
                    overrideValue(userAgent.get(DEVICE_CLASS), MOBILE.getValue());
                    overrideValue(userAgent.get(DEVICE_BRAND), "Apple");
                    break;

                case "Android":
                case "Fuchsia":
                    overrideValue(userAgent.get(DEVICE_CLASS), MOBILE.getValue());
                    overrideValue(userAgent.get(DEVICE_BRAND), NULL_VALUE);
                    break;

                case "Linux":
                    overrideValue(userAgent.get(DEVICE_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(DEVICE_NAME), "Linux Desktop");
                    overrideValue(userAgent.get(DEVICE_BRAND), NULL_VALUE);
                    overrideValue(userAgent.get(DEVICE_VERSION), NULL_VALUE);
                    overrideValue(userAgent.get(DEVICE_FIRMWARE_VERSION), NULL_VALUE);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(LAYOUT_ENGINE_CLASS), "Browser");
                    overrideValue(userAgent.get(AGENT_CLASS), "Browser");
                    break;

                case "Chrome OS":
                case "Windows":
                    overrideValue(userAgent.get(DEVICE_NAME), DESKTOP.getValue());
                    overrideValue(userAgent.get(DEVICE_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(DEVICE_BRAND), NULL_VALUE);
                    overrideValue(userAgent.get(LAYOUT_ENGINE_CLASS), "Browser");
                    overrideValue(userAgent.get(OPERATING_SYSTEM_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(AGENT_CLASS), "Browser");
                    break;

                case "Unknown":
                default:
                    overrideValue(userAgent.get(DEVICE_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(DEVICE_BRAND), NULL_VALUE);
                    overrideValue(userAgent.get(LAYOUT_ENGINE_CLASS), "Browser");
                    overrideValue(userAgent.get(OPERATING_SYSTEM_CLASS), DESKTOP.getValue());
                    overrideValue(userAgent.get(AGENT_CLASS), "Browser");
                    break;
            }

            switch (platform) {
                case "macOS":
                case "Mac OS X":
                    platform = "Mac OS";
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME),               platform);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION),            platformVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION_MAJOR),      majorVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION),       platform + " " + platformVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION_MAJOR), platform + " " + majorVersion);
                    break;

                case "Android":
                case "Fuchsia":
                case "Chrome OS":
                case "iOS":
                case "Linux":
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME),               platform);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION),            platformVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION_MAJOR),      majorVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION),       platform + " " + platformVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION_MAJOR), platform + " " + majorVersion);
                    break;

                case "Windows":
                    OSFields betterOsVersion = WINDOWS_VERSION_MAPPING.getLongestMatch(platformVersion);
                    if (betterOsVersion != null) {
                        overrideValue(userAgent.get(DEVICE_CLASS),                        DESKTOP.getValue());
                        overrideValue(userAgent.get(DEVICE_BRAND),                        NULL_VALUE);
                        overrideValue(userAgent.get(OPERATING_SYSTEM_NAME),               betterOsVersion.getName());
                        overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION),            betterOsVersion.getVersion());
                        overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION_MAJOR),      betterOsVersion.getVersionMajor());
                        overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION),       betterOsVersion.getNameVersion());
                        overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION_MAJOR), betterOsVersion.getNameVersionMajor());
                    }
                    break;

                case "Unknown":
                default:
                    platform = userAgent.getValue(OPERATING_SYSTEM_NAME);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION), platformVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_VERSION_MAJOR), majorVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION), platform + " " + platformVersion);
                    overrideValue(userAgent.get(OPERATING_SYSTEM_NAME_VERSION_MAJOR), platform + " " + majorVersion);
                    break;
            }
        }
    }
Some device names are "Generic" and thus must be overwritten if a Client hint is available.
analyzer/src/main/java/nl/basjes/parse/useragent/clienthints/ClientHintsAnalyzer.java