Search in sources :

Example 11 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project android_packages_apps_Settings by omnirom.

the class WifiP2pSettings method onPersistentGroupInfoAvailable.

@Override
public void onPersistentGroupInfoAvailable(WifiP2pGroupList groups) {
    mPersistentCategoryController.removeAllChildren();
    for (WifiP2pGroup group : groups.getGroupList()) {
        if (DBG)
            Log.d(TAG, " group " + group);
        WifiP2pPersistentGroup wppg = new WifiP2pPersistentGroup(getPrefContext(), group);
        mPersistentCategoryController.addChild(wppg);
        if (wppg.getGroupName().equals(mSelectedGroupName)) {
            if (DBG)
                Log.d(TAG, "Selecting group " + wppg.getGroupName());
            mSelectedGroup = wppg;
            mSelectedGroupName = null;
        }
    }
    if (mSelectedGroupName != null) {
        // Looks like there's a dialog pending getting user confirmation to delete the
        // selected group. When user hits OK on that dialog, we won't do anything; but we
        // shouldn't be in this situation in first place, because these groups are persistent
        // groups and they shouldn't just get deleted!
        Log.w(TAG, " Selected group " + mSelectedGroupName + " disappered on next query ");
    }
}
Also used : WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup)

Example 12 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project android_packages_apps_Settings by omnirom.

the class WifiP2pSettingsTest method persistentController_withNoGroup_shouldBeUnavailable.

@Test
public void persistentController_withNoGroup_shouldBeUnavailable() {
    final WifiP2pGroupList wifiP2pGroupList = mock(WifiP2pGroupList.class);
    final List<WifiP2pGroup> groupList = new ArrayList<>();
    doReturn(groupList).when(wifiP2pGroupList).getGroupList();
    mFragment.onPersistentGroupInfoAvailable(wifiP2pGroupList);
    assertThat(mFragment.mPersistentCategoryController.isAvailable()).isFalse();
}
Also used : WifiP2pGroupList(android.net.wifi.p2p.WifiP2pGroupList) WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

WifiP2pGroup (android.net.wifi.p2p.WifiP2pGroup)12 Test (org.junit.Test)4 WifiP2pGroupList (android.net.wifi.p2p.WifiP2pGroupList)2 ArrayList (java.util.ArrayList)2 ProgressDialog (android.app.ProgressDialog)1 DialogInterface (android.content.DialogInterface)1 OnCancelListener (android.content.DialogInterface.OnCancelListener)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 WifiP2pConfig (android.net.wifi.p2p.WifiP2pConfig)1 WifiP2pInfo (android.net.wifi.p2p.WifiP2pInfo)1 WifiP2pManager (android.net.wifi.p2p.WifiP2pManager)1 ActionListener (android.net.wifi.p2p.WifiP2pManager.ActionListener)1 Bundle (android.os.Bundle)1