Galaxy Note 5: Density Reduced Automatically
Asked Answered
M

2

5

I created an app that relies on some screen metrics to function. It works great on all devices, except for the Galaxy Note 5. On the note 5 it reports the screen size of 1080x1920 while the screen is actually 1440x2560. I also see the following message in logcat:

"ActivityThread﹕ Switching default density from 560 to 420"

I'm finding the screen size by calling getWindowVisibleDisplayFrame in the following code:

Rect usable_rect = new Rect();
Window window = activity.getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(usable_rect);

One other odd observation, if I use a package name other then my released app's package name the correct metrics are returned. Please help!

Midcourse answered 16/9, 2015 at 23:28 Comment(3)
"if I use a package name other then my released app's package name the correct metrics are returned" -- what do you mean? Do you mean if you change applicationId in build.gradle? Looking at the ActivityThread source, you may be able to disable this change by setting android:anyDensity="false" in <supports-screens> in the manifest, though they advise against that.Sowell
Correct, changing the applicationId in build.grade will cause the correct screen size to be returned from getWindowVisibleDisplayFrame. Setting android:anyDensity="false" didn't change what was returned by getWindowVisibleDisplayFrame. It did cause the logcat message to go away and changed the DisplayMetrics's density to 0.75 (very wrong).Midcourse
"Correct, changing the applicationId in build.grade will cause the correct screen size to be returned from getWindowVisibleDisplayFrame" -- that is rather bizarre. The only reason I can think of that would have an impact here is if you are updating the original app in place, and something about that app (maybe in an earlier manifest?) is triggering the behavior. Have you tried a full uninstall/reinstall of the app with its original applicationId?Sowell
M
2

We finally found the answer to the Note 5 reducing the usable space for our app/game. It turned out Samsung is doing some optimization on the usable screen size for battery performance. The only way we found to use the true screen size of the display is by downloading Samsung's Game Tuner app and setting the mode to "Maximum Quality". It appears that without the Game Tuner app installed the default "Balanced Quality" is used, which results in the 1080p usable area.

https://play.google.com/store/apps/details?id=com.samsung.android.gametuner.thin&hl=en

Midcourse answered 8/7, 2016 at 16:26 Comment(0)
B
0

Try this

Point size = new Point();
WindowManager w = getWindowManager();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
    w.getDefaultDisplay().getSize(size);

    mWindowWidth = size.x;
    mWindowHeight = size.y;
} else {
    Display d = w.getDefaultDisplay();
    mWindowWidth = d.getWidth();
    mWindowHeight = d.getHeight();
}
Broida answered 15/1, 2016 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.