Skip to content

[Android] Filter legacy time zones without unversioned tzlookup.xml - #132401

Draft
davidnguyen-tech wants to merge 5 commits into
dotnet:mainfrom
davidnguyen-tech:davidnguyen-tech-fix-android-timezone-duplicates
Draft

[Android] Filter legacy time zones without unversioned tzlookup.xml#132401
davidnguyen-tech wants to merge 5 commits into
dotnet:mainfrom
davidnguyen-tech:davidnguyen-tech-fix-android-timezone-duplicates

Conversation

@davidnguyen-tech

Copy link
Copy Markdown
Member

Summary

  • use Android's versioned time zone data directory when available, preserving the matching tzlookup.xml metadata
  • fall back to ICU canonical-location IDs when tzlookup.xml is missing or unreadable
  • register the native fallback for statically linked CoreCLR and provide the Apple-mobile placeholder
  • re-enable the Android time zone regression tests

This removes legacy aliases from TimeZoneInfo.GetSystemTimeZones() without changing direct lookup through FindSystemTimeZoneById.

Fixes #90269
Fixes #117731

Validation

  • Android arm64 CoreCLR + libraries Release build
  • full System.Runtime.Tests on a physical Android 16 / API 36 arm64 device: 77,575 run, 0 failed
  • iOS simulator arm64 native libraries build
  • checked desktop native/CoreLib build and both targeted time zone tests

Note

This pull request was prepared with GitHub Copilot.

Prefer Android's versioned tzlookup metadata and fall back to ICU canonical location IDs when that metadata is unavailable.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4da39873-ad89-41cf-a5dd-9753c3ab7f91
Copilot AI lite review requested due to automatic review settings August 17, 2026 11:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Android time zone enumeration so TimeZoneInfo.GetSystemTimeZones() can filter legacy/backward aliases more reliably by preferring Android’s versioned tzdata directories when present and falling back when tzlookup.xml isn’t available, while re-enabling related regression tests.

Changes:

  • Prefer the APEX versioned tzdata directory (etc/tz/versioned/<format-major>) when available, with fallback directory probing.
  • Add an ICU-based native/managed fallback path to obtain canonical-location time zone IDs when tzlookup.xml is missing/unreadable.
  • Re-enable Android time zone regression tests by removing ActiveIssue gating.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/native/libs/System.Globalization.Native/pal_timeZoneInfo.h Declares a new native export for enumerating canonical-location zone IDs.
src/native/libs/System.Globalization.Native/pal_timeZoneInfo.c Implements ICU-backed enumeration of canonical-location time zone IDs.
src/native/libs/System.Globalization.Native/pal_placeholders.c Adds a placeholder stub for the new native export on unsupported platforms.
src/native/libs/System.Globalization.Native/entrypoints.c Registers the new export in the globalization native entrypoint table (non-wasm).
src/libraries/Common/src/Interop/Interop.TimeZoneInfo.cs Adds LibraryImport for the new native canonical-location IDs export.
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs Uses versioned tzdata directory when available and falls back to ICU canonical-location IDs when tzlookup.xml is missing/unreadable.
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.cs Re-enables Android time zone regression tests by removing ActiveIssue exclusions.

Comment thread src/native/libs/System.Globalization.Native/pal_placeholders.c
@davidnguyen-tech

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

Note

This pipeline trigger was posted by GitHub Copilot at the user's request.

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

Resolve the versioned tzlookup path from the module's tz_version file instead of maintaining an Android API mapping.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4da39873-ad89-41cf-a5dd-9753c3ab7f91
Parse only the length returned by the second enumeration call and keep the Apple placeholder's failure sentinel consistent with the native contract.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4da39873-ad89-41cf-a5dd-9753c3ab7f91
Keep the new link-time placeholder's neutral return value consistent with the existing globalization placeholders.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4da39873-ad89-41cf-a5dd-9753c3ab7f91
Return -1 from every failure path because managed callers only distinguish success lengths from failure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4da39873-ad89-41cf-a5dd-9753c3ab7f91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants