[AWARE] Change PeerHandle internal ID to device-wide unique
Change the PeerHandle internal ID to be device-wide unique as opposed
to only session-wide unique.
Helps in debugging and reducing probability/impact of wrong usage (i.e.
wrong usage will be clearer).
Bug: 76033682
Test: unit tests pass
Test: MessageTest integration tests
Change-Id: I0bafb326ddb8ba454024501bef4b81b85cdac329
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
index 18b9177..67d9855 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
@@ -41,7 +41,7 @@
private static final boolean VDBG = false; // STOPSHIP if true
/* package */ boolean mDbg = false;
- private int mNextPeerIdToBeAllocated = 100; // used to create a unique peer ID
+ private static int sNextPeerIdToBeAllocated = 100; // used to create a unique peer ID
private final WifiAwareNativeApi mWifiAwareNativeApi;
private int mSessionId;
@@ -298,7 +298,7 @@
}
}
- int newPeerId = mNextPeerIdToBeAllocated++;
+ int newPeerId = sNextPeerIdToBeAllocated++;
PeerInfo newPeerInfo = new PeerInfo(requestorInstanceId, peerMac);
mPeerInfoByRequestorInstanceId.put(newPeerId, newPeerInfo);