title: Wifi-Direct always disconnects after thirty minutes
body: <p>I am creating a <code>WifiP2pGroup</code> with <code>WifiP2pManager.connect()</code>. This works fine but the group is always disbanded after thirty minutes, no matter whether data is being transferred or not. Does anyone know why this happens, or if it can be prevented?</p>
  
  <p>I have tried sending data continuously between the devices and keeping the screens on the entire time with a wake lock but it makes no difference. I have made sure wifi is set not to sleep, and also obtained a wifilock, and turned off battery optimization for the app and for wifi direct, but these don't help either. After thirty minutes (or to be specific, 29m 18s - it's very consistent) I get the <code>CONNECTION_STATE_CHANGE</code> broadcast and the devices are no longer paired.</p>
  
  <p>The devices are a <code>Nexus 7</code> running <code>Android 7 (LineageOS)</code> and a <code>Samsung Galaxy A5</code> running <code>Android 6</code>.</p>
  
  <p>Thanks!</p>
  
  <p>Edit: I have tried running with mobile data off and wifi not connected. The app is not being paused or destroyed and no other apps have permission to change the wifi state. In the wifi logs on one of the devices I found this event around the time of the disconnection:</p>
  
  <pre><code>E/DhcpStateMachine: DHCP renew failed on p2p-wlan0-0: Timed out waiting for DHCP Renew to finish
  D/WifiP2pService: GroupCreatedState{ what=196613 }
  E/WifiP2pService: DHCP failed
  </code></pre>
  
  <p>On the other device I found this at the beginning of the disconnect process:</p>
  
  <pre><code>552-813/system_process V/WifiHAL: event received NL80211_CMD_DEL_STATION
  552-846/system_process D/WifiMonitor: Event [IFNAME=p2p-p2p0-11 AP-STA-DISCONNECTED b6:22:8b:b1:df:0f p2p_dev_addr=f2:62:6f:d1:5f:0c]
  552-846/system_process D/WifiMonitor: p2p0 cnt=6442 dispatchEvent: AP-STA-DISCONNECTED b6:22:8b:b1:df:0f p2p_dev_addr=f2:62:6f:d1:5f:0c
  552-629/system_process D/WifiP2pService: Client list empty, remove non-persistent p2p group
  </code></pre>