OSDN Git Service

MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator
authorJong Wook Kim <jongwook@google.com>
Thu, 1 Feb 2018 03:03:19 +0000 (19:03 -0800)
committerJong Wook Kim <jongwook@google.com>
Wed, 7 Feb 2018 01:28:46 +0000 (01:28 +0000)
commitf0a55cc9eda84f90ad8b96784c4afa9a25e82801
treef0bd1ba01080a24da20469dae3f748402f650d98
parent9193014ee63b3ad007f74eb2b2f2fd741c6b6388
MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator

Use SecureRandom instead of Random since Random is time based and can
increase the chance of generating same MAC address across multiple
devices.

createRandomUnicastAddress should randomize all bits of the address,
except for locally assigned bit and unicast bit. The previous method
that only randomizes NIC and use Google Base OUI is renamed to
createRandomUnicastAddressWithGoogleBase.

Bug: 72450936
Test: runtest frameworks-net
Change-Id: Icda650638c2c1c9fd90d509a87e86347c0e05f2d
core/java/android/net/MacAddress.java
tests/net/java/android/net/MacAddressTest.java