Return anonymized MAC for apps targeting SDK < 30

Prevent apps targeting older API levels from receiving a null MAC
address by returning 02:00:00:00:00:00 for these cases instead.

Non-system apps are no longer able to access the MAC address of the
network interface, regardless of target API level. This change prevents
apps expecting a non-null MAC address (and not perform a null check) from
crashing. Non-system apps targeting API level >= 30 continue to see null
as the interface's MAC address.

This is the third attempt at landing these changes, after:
- Fixing InterfaceParamsTest (r.android.com/1498525)
- Creating an allowlist to exempt apps temporarily
  (r.android.com/1516639)
- Deferring hard SELinux restrictions (hence apps still
  being able to directly send RTM_GETLINK messages)

Bug: 170188668
Test: atest NetworkInterfaceTest
Test: Call NetworkInterface#getNetworkInterfaces() from within an app
Change-Id: I9461f287e1210b402b71c2faef4fa1ca9d040041
1 file changed