Skip to content

Commit 9ac735a

Browse files
adinauerclaude
andcommitted
docs(android): Explain timezone Calendar fallback
Document why Android 13+ locales with Unicode timezone extensions keep using Calendar while normal locales use the default timezone directly for performance. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2bcedec commit 9ac735a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ private void setDeviceIO(
257257
@SuppressWarnings("NewApi")
258258
@NotNull
259259
private TimeZone getTimeZone() {
260+
// Only use the costly Calendar API on Android 13+ (API Level 33+) when the locale contains a
261+
// Unicode timezone extension (for example "en-US-u-tz-usnyc"), because Calendar honors that
262+
// extension. For all other cases, use the process default timezone directly for performance.
260263
if (buildInfoProvider.getSdkInfoVersion() >= Build.VERSION_CODES.TIRAMISU) {
261264
LocaleList locales = context.getResources().getConfiguration().getLocales();
262265
if (!locales.isEmpty()) {

0 commit comments

Comments
 (0)