Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 228cf200 authored by govenliu's avatar govenliu
Browse files

[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
parent 774e25e7
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2364,8 +2364,10 @@
    <string name="wifi_advanced_titlebar">Advanced Wi\u2011Fi</string>
    <!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's SSID. [CHAR LIMIT=20] -->
    <string name="wifi_advanced_ssid_title">SSID</string>
    <!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's MAC address. -->
    <string name="wifi_advanced_mac_address_title">MAC address</string>
    <!-- Wi-Fi settings screen, advanced, title of the item to show the factory's Wi-Fi MAC address. [CHAR LIMIT=30] -->
    <string name="wifi_advanced_factory_mac_address_title">Factory MAC address</string>
    <!-- Wi-Fi settings screen, advanced, title of the item to show the randomized Wi-Fi MAC address. [CHAR LIMIT=30] -->
    <string name="wifi_advanced_randomized_mac_address_title">Randomized MAC address</string>
    <!-- Title of the screen to adjust IP settings -->
    <!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's current IP address. -->
    <string name="wifi_advanced_ip_address_title">IP address</string>
@@ -3131,6 +3133,8 @@
    <string name="storage_settings_summary" product="default">Unmount SD card, view available storage</string>
    <!-- About phone screen, title for IMEI for multi-sim devices -->
    <string name="imei_multi_sim">IMEI (sim slot %1$d)</string>
    <!-- About phone screen, summary of the MAC address [CHAR LIMIT=80] -->
    <string name="view_saved_network">To view, choose saved network</string>
    <!-- Do not translate. About phone, status item title -->
    <string name="status_imei">IMEI</string>
    <!-- Do not translate. About phone, status item title -->
@@ -3189,6 +3193,8 @@
    <string name="status_operator">Network</string>
    <!-- About phone, status item title.  The MAC address of the Wi-Fi network adapter. -->
    <string name="status_wifi_mac_address">Wi\u2011Fi MAC address</string>
    <!-- About phone, status item title.  The Factory MAC address of the Wi-Fi network adapter. [CHAR LIMIT=30] -->
    <string name="status_factory_wifi_mac_address">Factory Wi\u2011Fi MAC address</string>
    <!-- About phone, status item title.  The bluetooth adapter's hardware address-->
    <string name="status_bt_address">Bluetooth address</string>
    <!-- About phone, status item title.  The hardware serial number. [CHAR LIMIT=30]-->
+12 −3
Original line number Diff line number Diff line
@@ -139,9 +139,18 @@

    <!-- Wi-Fi MAC address -->
    <Preference
        android:key="wifi_mac_address"
        android:key="saved_accesspoints_wifi_mac_address"
        android:order="45"
        android:title="@string/status_wifi_mac_address"
        android:summary="@string/view_saved_network"
        android:fragment="com.android.settings.wifi.savedaccesspoints.SavedAccessPointsWifiSettings"
        settings:enableCopying="false"/>

    <!-- Factory Wi-Fi MAC address -->
    <Preference
        android:key="wifi_mac_address"
        android:order="46"
        android:title="@string/status_factory_wifi_mac_address"
        android:summary="@string/summary_placeholder"
        android:selectable="false"
        settings:enableCopying="true"/>
@@ -149,7 +158,7 @@
    <!-- Bluetooth address -->
    <Preference
        android:key="bt_address"
        android:order="46"
        android:order="47"
        android:title="@string/status_bt_address"
        android:summary="@string/summary_placeholder"
        android:selectable="false"
@@ -158,7 +167,7 @@
    <!-- Device up time -->
    <Preference
        android:key="up_time"
        android:order="47"
        android:order="48"
        android:title="@string/status_up_time"
        android:summary="@string/summary_placeholder"
        android:selectable="false"/>
+0 −8
Original line number Diff line number Diff line
@@ -69,12 +69,4 @@
        android:title="@string/wifi_menu_p2p"
        android:fragment="com.android.settings.wifi.p2p.WifiP2pSettings" />

    <Preference
        android:key="mac_address"
        android:title="@string/wifi_advanced_mac_address_title" />

    <Preference
        android:key="current_ip_address"
        android:title="@string/wifi_advanced_ip_address_title" />

</PreferenceScreen>
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@
                settings:enableCopying="true"/>
        <Preference
                android:key="mac_address"
                android:title="@string/wifi_advanced_mac_address_title"
                android:title="@string/wifi_advanced_randomized_mac_address_title"
                android:selectable="false"
                settings:enableCopying="true"/>
        <Preference
+0 −23
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import static android.content.Context.WIFI_SERVICE;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;

import com.android.settings.R;
@@ -39,7 +37,6 @@ public class ConfigureWifiSettings extends DashboardFragment {

    private static final String TAG = "ConfigureWifiSettings";

    public static final String KEY_IP_ADDRESS = "current_ip_address";
    public static final int WIFI_WAKEUP_REQUEST_CODE = 600;

    private WifiWakeupPreferenceController mWifiWakeupPreferenceController;
@@ -73,8 +70,6 @@ public class ConfigureWifiSettings extends DashboardFragment {
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
        final WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        controllers.add(new WifiInfoPreferenceController(context, getSettingsLifecycle(),
                wifiManager));
        controllers.add(new WifiP2pPreferenceController(context, getSettingsLifecycle(),
                wifiManager));
        return controllers;
@@ -107,24 +102,6 @@ public class ConfigureWifiSettings extends DashboardFragment {

    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
            new BaseSearchIndexProvider(R.xml.wifi_configure_settings) {

                @Override
                public List<String> getNonIndexableKeys(Context context) {
                    List<String> keys = super.getNonIndexableKeys(context);

                    // If connected to WiFi, this IP address will be the same as the Status IP.
                    // Or, if there is no connection they will say unavailable.
                    ConnectivityManager cm = (ConnectivityManager)
                            context.getSystemService(Context.CONNECTIVITY_SERVICE);
                    NetworkInfo info = cm.getActiveNetworkInfo();
                    if (info == null
                            || info.getType() == ConnectivityManager.TYPE_WIFI) {
                        keys.add(KEY_IP_ADDRESS);
                    }

                    return keys;
                }

                protected boolean isPageSearchEnabled(Context context) {
                    return context.getResources()
                            .getBoolean(R.bool.config_show_wifi_settings);
Loading