material-components / material-components/material-components-android

[Internal] WindowUtils assumes that apps are not in multi-window or using free-form windows

Open
#3,386 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** `WindowUtils` is using `Display.getRealSize` on API 29 - API 17, which won't return the application window bounds when the app is in multi-window mode or is in a free-form window. `WindowMetricsCalculatorCompat` from `androidx.window` has a full backport of querying for the current window size.

**Source code:**
https://github.com/material-components/material-components-android/blob/7ccf6708b0299317c3757c4d86a47827839c9ef7/lib/java/com/google/android/material/internal/WindowUtils.java#L75

**Android API version:** API 29 and below

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/java/com/google/android/material/internal/WindowUtils.java at the referenced getRealSize call, then read androidx.window's WindowMetricsCalculatorCompat backport. Verify how current window bounds are obtained on API 29 and below, including multi-window and free-form modes. Done means WindowUtils reports application window bounds in those modes rather than display-wide real size.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.