From 5853bd038f5a2e155ee98857b94ab12313480d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bram=20Bonn=C3=A9?= Date: Mon, 6 May 2019 14:31:09 +0200 Subject: [PATCH] Documentation update for MAC access restrictions. With change ag/7340724, the device's P2P MAC adress will only be available to callers holding the LOCAL_MAC_ADDRESS permission, and will be anonymized otherwise. This CL updates the documentation in WifiP2pManager to reflect that. Bug: 132055766 Test: atest tests/src/android/net/wifi/ Change-Id: I9c2b5ce2cb2c2d2d6766fd34f3451ad4f22a5698 --- wifi/java/android/net/wifi/p2p/WifiP2pManager.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java index a7793785fb9b7..cd659e2a934aa 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java @@ -93,7 +93,9 @@ import java.util.Map; * {@link WifiP2pInfo} contains the address of the group owner * {@link WifiP2pInfo#groupOwnerAddress} and a flag {@link WifiP2pInfo#isGroupOwner} to indicate * if the current device is a p2p group owner. A p2p client can thus communicate with - * the p2p group owner through a socket connection. + * the p2p group owner through a socket connection. If the current device is the p2p group owner, + * {@link WifiP2pInfo#groupOwnerAddress} is anonymized unless the caller holds the + * {@code android.Manifest.permission#LOCAL_MAC_ADDRESS} permission. * *

With peer discovery using {@link #discoverPeers}, an application discovers the neighboring * peers, but has no good way to figure out which peer to establish a connection with. For example, @@ -300,6 +302,11 @@ public class WifiP2pManager { * To get information notifications on P2P getting enabled refers * {@link #WIFI_P2P_STATE_ENABLED}. * + *

The {@link #EXTRA_WIFI_P2P_DEVICE} extra contains an anonymized version of the device's + * MAC address. Callers holding the {@code android.Manifest.permission#LOCAL_MAC_ADDRESS} + * permission can use {@link #requestDeviceInfo} to obtain the actual MAC address of this + * device. + * * All of these permissions are required to receive this broadcast: * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and * {@link android.Manifest.permission#ACCESS_WIFI_STATE} @@ -1881,6 +1888,10 @@ public class WifiP2pManager { *

This {@link android.net.wifi.p2p.WifiP2pDevice} is returned using the * {@link DeviceInfoListener} listener. * + *

{@link android.net.wifi.p2p.WifiP2pDevice#deviceAddress} is only available if the caller + * holds the {@code android.Manifest.permission#LOCAL_MAC_ADDRESS} permission, and holds the + * anonymized MAC address (02:00:00:00:00:00) otherwise. + * *

This information is also included in the {@link #WIFI_P2P_THIS_DEVICE_CHANGED_ACTION} * broadcast event with extra {@link #EXTRA_WIFI_P2P_DEVICE}. *