Fix an infinite loop

If the top bit is set, then >>= propagates it. That means
|bitmask| is never 0, and this is an infinite loop.

A followup will move this method to frameworks/libs/net
and add tests for it.

Test: FrameworksNetTests
Change-Id: I28a0a74be41f6f29b796b1c76e404ecc21f810c6
This commit is contained in:
Chalard Jean 2022-10-12 16:15:13 +09:00
commit 1e4afe071d

View file

@ -2308,7 +2308,7 @@ public final class NetworkCapabilities implements Parcelable {
}
sb.append(nameFetcher.nameOf(bitPos));
}
bitMask >>= 1;
bitMask >>>= 1;
++bitPos;
}
}