Improve HarmonyOS Detection Code#59
Draft
victorbash400 wants to merge 2 commits into
Draft
Conversation
Existing code relied on `uname` accurately identifying itself as HarmonyOS, but Huawei's official emulators are still running the Linux kernel (unlike physical devices). This change adds support for identifying HarmonyOS 5+ and retrieving system parameters including version, build ID, and security patch date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imported from upstream pull request fastfetch-cli/fastfetch pull request 2162: fastfetch-cli#2162
Original author: cyberMilosz
Original state: OPEN
Original labels: none
Original assignees: none
Summary
Current HarmonyOS detection code assumes that
unamewill accurately identify the OS. However, this is not the case on more recent emulators (as they seem to just use the Linux kernel):Real hardware still identifies itself correctly:
Instead of
uname, we should rely onparamoutput - we can get the OS name, version, API version, and security patch like so:Emulator:
Real hardware (note
param get const.product.software.version.nameappears to be a recent addition, so it's missing here):Tested on multiple Huawei emulators [6.0.1(21), 5.1.1(19), 5.1.0(18)] and a Huawei MatePad 11.5 running HarmonyOS 5.1.0.151
Example output from a current emulator:
Changes
paramoutput, falling back to existingunamelogic as a last resort.Checklist