Commit daad98ce authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Make macOS OS version numbers consistent

The "IsOS/IsAtLeastOS/IsAtMostOS" functions are driven from the Darwin
version number, which is always accurate. Adjust the
SysInfo::OperatingSystemVersionNumbers() function to return accurate
version numbers (or the best we can deduce) so that all version
numbers returned by helper functions are accurate and consistent.

Bug: 1101439
Bug: 1108832
Change-Id: I2ca92478d76bf572cc55875cba443f4978482d10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315490Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791491}
parent 228e165e
...@@ -61,6 +61,19 @@ void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version, ...@@ -61,6 +61,19 @@ void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
*major_version = version.majorVersion; *major_version = version.majorVersion;
*minor_version = version.minorVersion; *minor_version = version.minorVersion;
*bugfix_version = version.patchVersion; *bugfix_version = version.patchVersion;
// TODO(https://crbug.com/1108832): If an app is built against a pre-macOS
// 11.0 SDK, macOS will lie as to what version it is, saying that it is macOS
// "10.16" rather than "11.0". The problem is that the "IsOS/IsAtLeastOS/
// IsAtMostOS" functions are driven from the Darwin version number, which
// isn't lied about, and therefore the values returned by this function and
// those functions are inconsistent. Therefore, unlie about these values.
if (*major_version == 10 && *minor_version >= 16) {
*major_version = *minor_version - 5;
*minor_version = *bugfix_version;
*bugfix_version = 0;
}
} }
// static // static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment