@@ -359,8 +359,8 @@ private class P2pStateMachine extends StateMachine {
359359 private WifiNative mWifiNative = new WifiNative (mInterface );
360360 private WifiMonitor mWifiMonitor = new WifiMonitor (this , mWifiNative );
361361
362- private WifiP2pDeviceList mPeers = new WifiP2pDeviceList ();
363- private WifiP2pGroupList mGroups = new WifiP2pGroupList (
362+ private final WifiP2pDeviceList mPeers = new WifiP2pDeviceList ();
363+ private final WifiP2pGroupList mGroups = new WifiP2pGroupList (null ,
364364 new GroupDeleteListener () {
365365 @ Override
366366 public void onDeleteGroup (int netId ) {
@@ -370,7 +370,7 @@ public void onDeleteGroup(int netId) {
370370 sendP2pPersistentGroupsChangedBroadcast ();
371371 }
372372 });
373- private WifiP2pInfo mWifiP2pInfo = new WifiP2pInfo ();
373+ private final WifiP2pInfo mWifiP2pInfo = new WifiP2pInfo ();
374374 private WifiP2pGroup mGroup ;
375375
376376 // Saved WifiP2pConfig for a peer connection
@@ -501,17 +501,20 @@ public boolean processMessage(Message message) {
501501 WifiP2pManager .BUSY );
502502 break ;
503503 case WifiP2pManager .REQUEST_PEERS :
504- replyToMessage (message , WifiP2pManager .RESPONSE_PEERS , mPeers );
504+ replyToMessage (message , WifiP2pManager .RESPONSE_PEERS ,
505+ new WifiP2pDeviceList (mPeers ));
505506 break ;
506507 case WifiP2pManager .REQUEST_CONNECTION_INFO :
507- replyToMessage (message , WifiP2pManager .RESPONSE_CONNECTION_INFO , mWifiP2pInfo );
508+ replyToMessage (message , WifiP2pManager .RESPONSE_CONNECTION_INFO ,
509+ new WifiP2pInfo (mWifiP2pInfo ));
508510 break ;
509511 case WifiP2pManager .REQUEST_GROUP_INFO :
510- replyToMessage (message , WifiP2pManager .RESPONSE_GROUP_INFO , mGroup );
512+ replyToMessage (message , WifiP2pManager .RESPONSE_GROUP_INFO ,
513+ mGroup != null ? new WifiP2pGroup (mGroup ) : null );
511514 break ;
512515 case WifiP2pManager .REQUEST_PERSISTENT_GROUP_INFO :
513516 replyToMessage (message , WifiP2pManager .RESPONSE_PERSISTENT_GROUP_INFO ,
514- mGroups );
517+ new WifiP2pGroupList ( mGroups , null ) );
515518 break ;
516519 case WifiP2pManager .SET_DIALOG_LISTENER :
517520 String appPkgName = (String )message .getData ().getString (
0 commit comments