Include IPv6 DNS servers in wifi details

Test: as follows
    - built
    - flashed
    - booted
    - export ROBOTEST_FILTER=WifiDetailPreferenceControllerTest \
          make -j RunSettingsRoboTests
      RunSettingsRoboTests:
      RunSettingsRoboTests: Time: 19.821
      RunSettingsRoboTests:
      RunSettingsRoboTests: OK (37 tests)
      RunSettingsRoboTests:
    - make -j RunSettingsRoboTests
      RunSettingsRoboTests: ...........................
      RunSettingsRoboTests: Time: 424.847
      RunSettingsRoboTests:
      RunSettingsRoboTests: OK (2250 tests)
      RunSettingsRoboTests:

Bug: 65037256
Bug: 65467586

Change-Id: Icd3d09aa35c04101c41e2521b48e64f28f69ae29
This commit is contained in:
Erik Kline
2017-09-06 18:05:48 +09:00
parent 5b017f7b05
commit 9adc588749
2 changed files with 9 additions and 4 deletions

View File

@@ -431,9 +431,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
} }
} }
// Find IPv4 DNS addresses. // Find all (IPv4 and IPv6) DNS addresses.
String dnsServers = mLinkProperties.getDnsServers().stream() String dnsServers = mLinkProperties.getDnsServers().stream()
.filter(Inet4Address.class::isInstance)
.map(InetAddress::getHostAddress) .map(InetAddress::getHostAddress)
.collect(Collectors.joining("\n")); .collect(Collectors.joining("\n"));

View File

@@ -437,10 +437,14 @@ public class WifiDetailPreferenceControllerTest {
public void dnsServersPref_shouldHaveDetailTextSet() throws UnknownHostException { public void dnsServersPref_shouldHaveDetailTextSet() throws UnknownHostException {
mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,4,4})); mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,4,4}));
mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,8,8})); mLinkProperties.addDnsServer(InetAddress.getByAddress(new byte[]{8,8,8,8}));
mLinkProperties.addDnsServer(Constants.IPV6_DNS);
displayAndResume(); displayAndResume();
verify(mockDnsPref).setDetailText("8.8.4.4\n8.8.8.8"); verify(mockDnsPref).setDetailText(
"8.8.4.4\n" +
"8.8.8.8\n" +
Constants.IPV6_DNS.getHostAddress());
} }
@Test @Test
@@ -546,12 +550,14 @@ public class WifiDetailPreferenceControllerTest {
lp.addDnsServer(Constants.IPV6_DNS); lp.addDnsServer(Constants.IPV6_DNS);
updateLinkProperties(lp); updateLinkProperties(lp);
inOrder.verify(mockDnsPref, never()).setVisible(true); inOrder.verify(mockDnsPref).setDetailText(Constants.IPV6_DNS.getHostAddress());
inOrder.verify(mockDnsPref).setVisible(true);
lp.addDnsServer(Constants.IPV4_DNS1); lp.addDnsServer(Constants.IPV4_DNS1);
lp.addDnsServer(Constants.IPV4_DNS2); lp.addDnsServer(Constants.IPV4_DNS2);
updateLinkProperties(lp); updateLinkProperties(lp);
inOrder.verify(mockDnsPref).setDetailText( inOrder.verify(mockDnsPref).setDetailText(
Constants.IPV6_DNS.getHostAddress() + "\n" +
Constants.IPV4_DNS1.getHostAddress() + "\n" + Constants.IPV4_DNS1.getHostAddress() + "\n" +
Constants.IPV4_DNS2.getHostAddress()); Constants.IPV4_DNS2.getHostAddress());
inOrder.verify(mockDnsPref).setVisible(true); inOrder.verify(mockDnsPref).setVisible(true);