Skip to content

Commit

Permalink
Update low FD count hardcoded hardware Bitmap blacklist.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 337968955
  • Loading branch information
sjudd authored and glide-copybara-robot committed Oct 20, 2020
1 parent 90a657b commit ddb3934
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,38 @@ private static boolean isHardwareConfigDisallowedByB147430447() {
}

private static boolean isHardwareConfigDisallowedByB112551574() {
if (Build.MODEL == null || Build.MODEL.length() < 7) {
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.O) {
return false;
}
switch (Build.MODEL.substring(0, 7)) {
case "SM-N935":
// Fall through
case "SM-J720":
// Fall through
case "SM-G960":
// Fall through
case "SM-G965":
// Fall through
case "SM-G935":
// Fall through
case "SM-G930":
// Fall through
case "SM-A520":
// Fall through
return Build.VERSION.SDK_INT == Build.VERSION_CODES.O;
default:
return false;
// This method will only be called once, so simple iteration is reasonable.
for (String prefixOrModelName :
// This is sadly a list of prefixes, not models. We no longer have the data that shows us
// all the explicit models, so we have to live with the prefixes.
Arrays.asList(
// Samsung
"SC-04J",
"SM-N935",
"SM-J720",
"SM-G570F",
"SM-G570M",
"SM-G960",
"SM-G965",
"SM-G935",
"SM-G930",
"SM-A520",
"SM-A720F",
// Moto
"moto e5",
"moto e5 play",
"moto e5 plus",
"moto e5 cruise",
"moto g(6) forge",
"moto g(6) play")) {
if (Build.MODEL.startsWith(prefixOrModelName)) {
return true;
}
}
return false;
}

private int getMaxFdCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,8 @@ public void setHardwareConfigIfAllowed_withDisallowedSamsungDevices_OMR1_returns

@Config(sdk = Build.VERSION_CODES.O)
@Test
public void setHardwareConfigIfAllowed_withShortEmptyOrNullModelNames_returnsTrue() {
for (String model :
new String[] {null, ".", "-", "", "S", "SM", "SM-", "SM-G", "SM-G9.", "SM-G93"}) {
public void setHardwareConfigIfAllowed_withShortOrEmptyModelNames_returnsTrue() {
for (String model : new String[] {".", "-", "", "S", "SM", "SM-", "SM-G", "SM-G9.", "SM-G93"}) {
ShadowBuild.setModel(model);
HardwareConfigState state = new HardwareConfigState();
state.unblockHardwareBitmaps();
Expand Down

0 comments on commit ddb3934

Please sign in to comment.