Skip to content

Commit d0356a1

Browse files
author
Dianne Hackborn
committed
Fix launcher icon size for tvdpi.
We didn't have a case for tvdpi, so ended up in the default scaling. This resulting in us using 319 instead of 320. Fixed the default case to round, and added explicit cases for tvdpi since this is a standard density. Change-Id: I752b924e1556af94682428c8c0ed7c75d15ac4a4
1 parent 16fb5d4 commit d0356a1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/java/android/app/ActivityManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,8 @@ public int getLauncherLargeIconDensity() {
16871687
return DisplayMetrics.DENSITY_MEDIUM;
16881688
case DisplayMetrics.DENSITY_MEDIUM:
16891689
return DisplayMetrics.DENSITY_HIGH;
1690+
case DisplayMetrics.DENSITY_TV:
1691+
return DisplayMetrics.DENSITY_XHIGH;
16901692
case DisplayMetrics.DENSITY_HIGH:
16911693
return DisplayMetrics.DENSITY_XHIGH;
16921694
case DisplayMetrics.DENSITY_XHIGH:
@@ -1696,7 +1698,7 @@ public int getLauncherLargeIconDensity() {
16961698
default:
16971699
// The density is some abnormal value. Return some other
16981700
// abnormal value that is a reasonable scaling of it.
1699-
return (int)(density*1.5f);
1701+
return (int)((density*1.5f)+.5f);
17001702
}
17011703
}
17021704

@@ -1723,6 +1725,8 @@ public int getLauncherLargeIconSize() {
17231725
return (size * DisplayMetrics.DENSITY_MEDIUM) / DisplayMetrics.DENSITY_LOW;
17241726
case DisplayMetrics.DENSITY_MEDIUM:
17251727
return (size * DisplayMetrics.DENSITY_HIGH) / DisplayMetrics.DENSITY_MEDIUM;
1728+
case DisplayMetrics.DENSITY_TV:
1729+
return (size * DisplayMetrics.DENSITY_XHIGH) / DisplayMetrics.DENSITY_HIGH;
17261730
case DisplayMetrics.DENSITY_HIGH:
17271731
return (size * DisplayMetrics.DENSITY_XHIGH) / DisplayMetrics.DENSITY_HIGH;
17281732
case DisplayMetrics.DENSITY_XHIGH:
@@ -1732,7 +1736,7 @@ public int getLauncherLargeIconSize() {
17321736
default:
17331737
// The density is some abnormal value. Return some other
17341738
// abnormal value that is a reasonable scaling of it.
1735-
return (int)(size*1.5f);
1739+
return (int)((size*1.5f) + .5f);
17361740
}
17371741
}
17381742

0 commit comments

Comments
 (0)