New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 906124 link

Starred by 9 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 6
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Invalid display metrics (dpi) after desktop/tablet mode switch and rotation.

Reported by olivier....@myscript.com, Nov 16

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Platform: 11021.56.0 (Official Build) stable-channel caroline

Steps to reproduce the problem:
1. In desktop mode launch an Android app relying on DPI (provided by DisplayMetrics)
2. switch to tablet mode
3. rotate screen

What is the expected behavior?
The DPI are stable among tablet/desktop mode and rotation.
xdpi=234.46153
ydpi=234.9133

What went wrong?
The DPI value is not stable and broken.
xdpi=156.3077
ydpi=352.36993

Did this work before? Yes ChromeOS 69

Chrome version: 70.0.3538.76  Channel: stable
OS Version: 11021.56.0
Flash Version: 

You can visualize the problem with this simple Android View:

```
    @Override
    protected void onDraw(Canvas canvas) {
        DisplayMetrics dm = getResources().getDisplayMetrics();
        float widthInches = dm.widthPixels / dm.xdpi;
        float heightInches = dm.heightPixels / dm.ydpi;
        float widthCentimeters = widthInches * 2.54f;
        float heightCentimeters = heightInches * 2.54f;
        float widthOneCentimeterInPixels = dm.widthPixels / widthCentimeters;
        float heightOneCentimeterInPixels = dm.heightPixels / heightCentimeters;
        Paint paint = new Paint();
        paint.setColor(Color.BLACK);

        canvas.drawColor(Color.WHITE);
        canvas.drawLine(100f, 100f, 100f + widthOneCentimeterInPixels, 100f, paint);
        canvas.drawLine(100f, 100f, 100f, 100f + heightOneCentimeterInPixels, paint);
    }
```
 
1cm square correct.png
5.0 KB View Download
1cm square broken.png
5.0 KB View Download
Components: Platform>Apps>ARC
Owner: skuhne@chromium.org
Cc: shihuis@google.com
Cc: phshah@chromium.org skuhne@chromium.org
Owner: osh...@chromium.org
This is a dupe of the buganizer issue which I have created this morning.
Owner: mukai@chromium.org
mukai@, I think this is related to your work that fixes the native pixel size.
Can you point me where could be an issue? Then I can work with Ricardo to fix it.
It is 70682973 of the buganizer issue.
Owner: ricardoq@chromium.org
Status: Fixed (was: Unconfirmed)
ricardoq@ landed the fix (crrev.com/c/1364078)
Hello, first of all, thanks for the fix!
Do you have any idea in which version of Chrome OS this fix will land? Thanks.
olivier: m72 was branched on dec 03, and this fix landed on dec 05. so this fix should be in m73.

Sign in to add a comment