Image

Ajouter Ethernet Rom Android 11

1. Fichiers à modifier ou à ajouter :

Aller dans le dossier de la Rom créée (ex : Android).

/packages/apps/Settings/res/layout/static_ip_dialog.xml
Code static_ip_dialog.xml
  • <?xml version="1.0" encoding="utf-8"?>
    <!--
         Copyright (C) 2010 The Android Open Source Project

         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at

              http://www.apache.org/licenses/LICENSE-2.0

         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
    -->

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fadeScrollbars="false" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingBottom="8dip" >

            <LinearLayout
                android:id="@+id/wifi_advanced_fields"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <LinearLayout
                    android:id="@+id/proxy_fields"
                    style="@style/wifi_section"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" >

                    <LinearLayout
                        android:id="@+id/staticip"
                        style="@style/wifi_section"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" >

                        <LinearLayout
                            style="@style/wifi_item"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" >

                            <TextView
                                style="@style/wifi_item_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/wifi_ip_address" />

                            <EditText
                                android:id="@+id/ipaddress"
                                style="@style/wifi_item_edit_content"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:hint="@string/wifi_ip_address_hint"
                                android:inputType="textNoSuggestions"
                                android:singleLine="true" />
                        </LinearLayout>

                        <LinearLayout
                            style="@style/wifi_item"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" >

                            <TextView
                                style="@style/wifi_item_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/wifi_gateway" />

                            <EditText
                                android:id="@+id/gateway"
                                style="@style/wifi_item_edit_content"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:hint="@string/wifi_gateway_hint"
                                android:inputType="textNoSuggestions"
                                android:singleLine="true" />
                        </LinearLayout>

                        <LinearLayout
                            style="@style/wifi_item"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" >

                            <TextView
                                style="@style/wifi_item_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/ethernet_netmask" />

                            <EditText
                                android:id="@+id/network_prefix_length"
                                style="@style/wifi_item_edit_content"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:hint="@string/ethernet_netmask_hint"
                                android:inputType="textNoSuggestions"
                                android:singleLine="true" />
                        </LinearLayout>

                        <LinearLayout
                            style="@style/wifi_item"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" >

                            <TextView
                                style="@style/wifi_item_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/wifi_dns1" />

                            <EditText
                                android:id="@+id/dns1"
                                style="@style/wifi_item_edit_content"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:hint="@string/wifi_dns1_hint"
                                android:inputType="textNoSuggestions"
                                android:singleLine="true" />
                        </LinearLayout>

                        <LinearLayout
                            style="@style/wifi_item"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content" >

                            <TextView
                                style="@style/wifi_item_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/wifi_dns2" />

                            <EditText
                                android:id="@+id/dns2"
                                style="@style/wifi_item_edit_content"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:hint="@string/wifi_dns2_hint"
                                android:inputType="textNoSuggestions"
                                android:singleLine="true" />
                        </LinearLayout>
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>

    </ScrollView>


/packages/apps/Settings/res/xml/network_and_internet.xml
network_and_internet.xml
  • <?xml version="1.0" encoding="utf-8"?>
    <!-- Copyright (C) 2018 The Android Open Source Project

         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at

              http://www.apache.org/licenses/LICENSE-2.0

         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
    -->

    <PreferenceScreen
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:settings="http://schemas.android.com/apk/res-auto"
        android:key="network_and_internet_screen"
        android:title="@string/network_dashboard_title"
        settings:initialExpandedChildrenCount="8">

        <PreferenceCategory
            android:key="multi_network_header"
            android:title="@string/summary_placeholder"
            android:layout="@layout/preference_category_no_label"
            settings:allowDividerBelow="true"
            android:order="-40"
            settings:controller="com.android.settings.network.MultiNetworkHeaderController"/>

        <com.android.settings.widget.MasterSwitchPreference
            android:fragment="com.android.settings.wifi.WifiSettings"
            android:key="main_toggle_wifi"
            android:title="@string/wifi_settings"
            android:summary="@string/summary_placeholder"
            android:icon="@drawable/ic_settings_wireless"
            android:order="-30"
            settings:allowDividerAbove="true">
            <intent
                android:action="android.settings.WIFI_SETTINGS"
                android:targetClass="Settings$WifiSettingsActivity" />
        </com.android.settings.widget.MasterSwitchPreference>

        <com.android.settings.widget.AddPreference
            android:key="mobile_network_list"
            android:title="@string/network_settings_title"
            android:summary="@string/summary_placeholder"
            android:icon="@drawable/ic_network_cell"
            android:order="-15"
            settings:keywords="@string/keywords_more_mobile_networks"
            settings:userRestriction="no_config_mobile_networks"
            settings:useAdminDisabledSummary="true" />

        <com.android.settingslib.RestrictedSwitchPreference
            android:key="airplane_mode"
            android:title="@string/airplane_mode"
            android:icon="@drawable/ic_airplanemode_active"
            android:disableDependentsState="true"
            android:order="-5"
            settings:controller="com.android.settings.network.AirplaneModePreferenceController"
            settings:userRestriction="no_airplane_mode"/>

        <com.android.settingslib.RestrictedPreference
            android:key="manage_mobile_plan"
            android:title="@string/manage_mobile_plan_title"
            android:persistent="false"
            android:order="0"
            settings:userRestriction="no_config_mobile_networks"
            settings:useAdminDisabledSummary="true" />

        <com.android.settingslib.RestrictedPreference
            android:fragment="com.android.settings.TetherSettings"
            android:key="tether_settings"
            android:title="@string/tether_settings_title_all"
            android:icon="@drawable/ic_wifi_tethering"
            android:order="5"
            android:summary="@string/summary_placeholder"
            settings:keywords="@string/keywords_hotspot_tethering"
            settings:userRestriction="no_config_tethering"
            settings:useAdminDisabledSummary="true" />

        <com.android.settings.widget.MasterSwitchPreference
            android:fragment="com.android.settings.AllInOneTetherSettings"
            android:key="all_tether_settings"
            android:title="@string/tether_settings_title_all"
            android:icon="@drawable/ic_wifi_tethering"
            android:order="6"
            android:summary="@string/summary_placeholder"
            settings:controller="com.android.settings.network.AllInOneTetherPreferenceController"
            settings:keywords="@string/keywords_hotspot_tethering"
            settings:userRestriction="no_config_tethering"
            settings:useAdminDisabledSummary="true" />

        <com.android.settings.datausage.DataSaverPreference
            android:key="restrict_background_parent_entry"
            android:title="@string/data_saver_title"
            android:icon="@drawable/ic_settings_data_usage"
            android:order="10"
            android:fragment="com.android.settings.datausage.DataSaverSummary"/>

        <com.android.settingslib.RestrictedPreference
            android:fragment="com.android.settings.vpn2.VpnSettings"
            android:key="vpn_settings"
            android:title="@string/vpn_settings_title"
            android:icon="@drawable/ic_vpn_key"
            android:order="15"
            android:summary="@string/summary_placeholder"
            settings:userRestriction="no_config_vpn"
            settings:useAdminDisabledSummary="true" />

        <com.android.settings.network.PrivateDnsModeDialogPreference
            android:key="private_dns_settings"
            android:title="@string/select_private_dns_configuration_title"
            android:order="20"
            android:dialogTitle="@string/select_private_dns_configuration_dialog_title"
            android:dialogLayout="@layout/private_dns_mode_dialog"
            android:positiveButtonText="@string/save"
            android:negativeButtonText="@android:string/cancel" />

       <com.android.settingslib.RestrictedPreference
            android:key="ethernet_settings"
           android:title="@string/ethernet_settings_title"
           android:icon="@drawable/ic_ethernet"
           settings:userRestriction="no_ethernet_settings"
           settings:useAdminDisabledSummary="true"
           android:fragment="com.android.settings.EthernetSettings" />

        <Preference
            android:fragment="com.android.settings.network.AdaptiveConnectivitySettings"
            android:key="adaptive_connectivity"
            android:title="@string/adaptive_connectivity_title"
            android:summary="@string/summary_placeholder"
            android:order="25"
            settings:controller="com.android.settings.network.AdaptiveConnectivityPreferenceController"/>
    </PreferenceScreen>

/packages/apps/Settings/res/drawable/ic_ethernet.xml
ic_ethernet.xml
  • <?xml version="1.0" encoding="utf-8"?>
    <!--
      Copyright (C) 2016 The Android Open Source Project

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

           http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License
      -->
    <vector xmlns:android="http://schemas.android.com/apk/res/android"
            android:width="24dp"
            android:height="24dp"
            android:viewportWidth="24.0"
            android:viewportHeight="24.0"
            android:tint="?android:attr/colorControlNormal">
        <path
            android:fillColor="#FF000000"
            android:pathData="M7.77,6.76L6.23,5.48 0.82,12l5.41,6.52 1.54,-1.28L3.42,12l4.35,-5.24zM7,13h2v-2L7,11v2zM17,11h-2v2h2v-2zM11,13h2v-2h-2v2zM17.77,5.48l-1.54,1.28L20.58,12l-4.35,5.24 1.54,1.28L23.18,12l-5.41,-6.52z"/>
    </vector>

Recherche