OSDN Git Service

Documentation update for MAC access restrictions.
authorBram Bonné <brambonne@google.com>
Mon, 6 May 2019 12:31:09 +0000 (14:31 +0200)
committerBram Bonné <brambonne@google.com>
Tue, 7 May 2019 10:16:20 +0000 (10:16 +0000)
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

index a779378..cd659e2 100644 (file)
@@ -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.
  *
  * <p> 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}.
      *
+     * <p> 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 {
      * <p> This {@link android.net.wifi.p2p.WifiP2pDevice} is returned using the
      * {@link DeviceInfoListener} listener.
      *
+     * <p> {@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.
+     *
      * <p> This information is also included in the {@link #WIFI_P2P_THIS_DEVICE_CHANGED_ACTION}
      * broadcast event with extra {@link #EXTRA_WIFI_P2P_DEVICE}.
      *