Skip to content

Comments

Fix crash on Android < 11 due to unchecked WindowMetrics API usage#1782

Merged
WhiredPlanck merged 2 commits intodevelopfrom
copilot/fix-android-11-crash
Nov 1, 2025
Merged

Fix crash on Android < 11 due to unchecked WindowMetrics API usage#1782
WhiredPlanck merged 2 commits intodevelopfrom
copilot/fix-android-11-crash

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

Fix Android Crash on Systems Below API 30 ✅

Successfully fixed the crash on Android systems below API 30 (Android 11) by adding proper version checking for WindowMetrics API usage.

Changes Made:

Commit Format:

Type: fix (fixes a bug)
Scope: keyboard (changes in Keyboard.kt)
Subject: Add version check for WindowMetrics API on Android < 11

Technical Implementation:

  • For API 30+: Use WindowManager.currentWindowMetrics with proper inset calculations
  • For API 21-29: Use deprecated Display.getSize() as fallback
  • All deprecated APIs properly annotated with @Suppress("DEPRECATION")

Fixes #1781

Original prompt

This section details on the original issue you should resolve

<issue_title>应用在 Android 11 以下系统崩溃 / App Crash on Systems below Android 11</issue_title>
<issue_description>### 摘要 / Summary

问题由 f5fe60d 引起
Caused by f5fe60d

重现步骤 / Steps to Reproduce

N/A

预期行为 / Expected Behavior

N/A

日志 / Log

No response

截图 / Screenshot

No response

附加信息 / Additional Context

No response

系统版本 / OS Version

Android 11 -

应用版本 / App Version

N/A

构建信息 / Build Information

N/A</issue_description>

<agent_instructions>Fix crash on systems below Android 11 caused by the getting of WindowMetrics and WindowInsets</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 1, 2025
Co-authored-by: WhiredPlanck <47623588+WhiredPlanck@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix app crash on systems below Android 11 Fix crash on Android < 11 due to unchecked WindowMetrics API usage Nov 1, 2025
Copilot AI requested a review from WhiredPlanck November 1, 2025 03:10
@WhiredPlanck
Copy link
Collaborator

@copilot Great, now make your commits comply with Conventional Commits specs.

Copy link
Contributor Author

Copilot AI commented Nov 1, 2025

@copilot Great, now make your commits comply with Conventional Commits specs.

I don't have force-push access to rewrite the published commit history. The commits need to be rewritten as:

  • Remove: "Initial plan" (empty commit)
  • Change: "Fix Android 11 crash..." → "fix(keyboard): add version check for WindowMetrics API on Android < 11"

Since I cannot force push, you have two options:

  1. Squash and merge the PR with a proper Conventional Commits message
  2. Force push the corrected history yourself

Would you like me to provide the exact commit message for option 1?

@WhiredPlanck WhiredPlanck marked this pull request as ready for review November 1, 2025 04:27
@WhiredPlanck WhiredPlanck merged commit a75669d into develop Nov 1, 2025
10 checks passed
@WhiredPlanck WhiredPlanck deleted the copilot/fix-android-11-crash branch November 1, 2025 04:29
lzlv312 pushed a commit to lzlv312/trime-origin that referenced this pull request Nov 13, 2025
osfans#1782)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: WhiredPlanck <47623588+WhiredPlanck@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

应用在 Android 11 以下系统崩溃 / App Crash on Systems below Android 11

2 participants