summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2020-08-03 15:01:08 -0700
committerDavid Su <dysu@google.com>2020-08-03 22:19:46 +0000
commitaa3941598e26f7645d22e4715469967695919a45 (patch)
tree1531baa78ee541d7861ee9b950ef732a6112aae7 /service
parentb64129c61416da5a3817d328a7adb166485254ea (diff)
WifiP2pServiceImpl: check for null group owner
Bug: 162705230 Test: atest FrameworksWifiTests Change-Id: I1d46ee06ebc6879b1f3924a74e81bd5b107b8691
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
index 61e6c16bc..219da3884 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -114,6 +114,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
/**
* WifiP2pService includes a state machine to perform Wi-Fi p2p operations. Applications
@@ -240,7 +241,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
private final boolean mP2pSupported;
- private WifiP2pDevice mThisDevice = new WifiP2pDevice();
+ private final WifiP2pDevice mThisDevice = new WifiP2pDevice();
// When a group has been explicitly created by an app, we persist the group
// even after all clients have been disconnected until an explicit remove
@@ -3323,7 +3324,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
/**
* This method unifies the persisent group list, cleans up unused
* networks and if required, updates corresponding broadcast receivers
- * @param boolean if true, reload the group list from scratch
+ * @param reload if true, reload the group list from scratch
* and send broadcast message with fresh list
*/
private void updatePersistentNetworks(boolean reload) {
@@ -3333,7 +3334,11 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
// no network has been found.
if (mWifiNative.p2pListNetworks(mGroups) || reload) {
for (WifiP2pGroup group : mGroups.getGroupList()) {
- if (mThisDevice.deviceAddress.equals(group.getOwner().deviceAddress)) {
+ if (group.getOwner() == null) {
+ Log.d(TAG, "group.getOwner() null");
+ continue;
+ }
+ if (Objects.equals(mThisDevice.deviceAddress, group.getOwner().deviceAddress)) {
group.setOwner(mThisDevice);
}
}