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

Commit 834c3011 authored by Goven Liu's avatar Goven Liu Committed by Android (Google) Code Review
Browse files

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

parents 08d00412 228cf200
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2370,8 +2370,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>
@@ -3137,6 +3139,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 -->
@@ -3195,6 +3199,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