[Wi-Fi] Wrong MAC address shown in Settings.

The MAC addresses in "About phone" and "Saved networks" may be different
because of new Randomized MAC mechanism.

1.Add new UIs to guide users to saved network and use different titles to
show different conditions.
2.Remove MAC address and IP fields in WifiPreference by new design.

Bug: 133466540
Test: add test case to check if the title changed according to the
privacy level.

Change-Id: Idb5972dc2565f6fe58a83f6aa7124abbc035888f
This commit is contained in:
govenliu
2019-10-02 10:10:48 +08:00
parent 774e25e72f
commit 228cf200ae
11 changed files with 78 additions and 452 deletions

View File

@@ -2,14 +2,9 @@ package com.android.settings.wifi;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.android.settings.testutils.XmlTestUtils;
@@ -54,41 +49,4 @@ public class ConfigureWifiSettingsTest {
assertThat(keys).isNotNull();
assertThat(niks).containsAllIn(keys);
}
@Test
public void testNonIndexableKeys_noConnection_blocksIP() {
ConnectivityManager manager = mock(ConnectivityManager.class);
when(manager.getActiveNetworkInfo()).thenReturn(null);
doReturn(manager).when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
final List<String> niks =
ConfigureWifiSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
assertThat(niks).contains(ConfigureWifiSettings.KEY_IP_ADDRESS);
}
@Test
public void testNonIndexableKeys_wifiConnection_blocksIP() {
ConnectivityManager manager = mock(ConnectivityManager.class);
NetworkInfo info = mock(NetworkInfo.class);
when(info.getType()).thenReturn(ConnectivityManager.TYPE_WIFI);
when(manager.getActiveNetworkInfo()).thenReturn(info);
doReturn(manager).when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
final List<String> niks =
ConfigureWifiSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
assertThat(niks).contains(ConfigureWifiSettings.KEY_IP_ADDRESS);
}
@Test
public void testNonIndexableKeys_mobileConnection_blocksIP() {
ConnectivityManager manager = mock(ConnectivityManager.class);
NetworkInfo info = mock(NetworkInfo.class);
when(info.getType()).thenReturn(ConnectivityManager.TYPE_MOBILE);
when(manager.getActiveNetworkInfo()).thenReturn(info);
doReturn(manager).when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
final List<String> niks =
ConfigureWifiSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
assertThat(niks).doesNotContain(ConfigureWifiSettings.KEY_IP_ADDRESS);
}
}