├── .gitignore ├── LICENSE ├── README.md ├── ics ├── build │ └── 0001-Adding-Ethernet-support.patch ├── development │ ├── 0001-Adding-ethernet-support-to-monkey-for-network-statis.patch │ └── 0002-Adding-Ethernet-API-in-classpath-file-for-Eclipse-ID.patch ├── external │ └── dhcpcd │ │ └── 0001-Patching-dhcpcd-daemon-to-handle-dns-properties-corr.patch ├── frameworks │ └── base │ │ ├── 0005-Adding-Ethernet-support-in-ICS-DHCP-mode-working-Sta.patch │ │ ├── 0008-Defining-default-network-connection-to-Ethernet-in-A.patch │ │ ├── 0009-Adding-Ethernet-support-in-Android-SIP-Service.patch │ │ ├── 0010-Adding-right-DNS-management-in-Android-framework.patch │ │ ├── 0011-Adding-traces-for-No-internet-connection-issue-with-.patch │ │ ├── 0012-Redefining-default-network-connection-to-ETHERNET-in.patch │ │ ├── 0013-Adding-missing-Ethernet-support-in-ConnectivityServi.patch │ │ ├── 0014-Adding-Ethernet-support-in-NetworkTimeUpdateService.patch │ │ ├── 0015-Register-Ethernet-Service-before-Wifi-Service.patch │ │ ├── 0016-Redirect-all-getNetworkInfo-requests-on-Ethernet-for.patch │ │ ├── 0017-Remove-useless-logs-and-correct-connection-label-in-.patch │ │ ├── 0022-Defining-eth0-as-default-ethernet-interface.patch │ │ ├── 0023-Adding-static-configuration-to-Ethernet-Connectivity.patch │ │ ├── 0024-adding-new-config-values-and-functions-to-handle-def.patch │ │ ├── 0028-updating-API-for-modification-regarding-EthernetDevI.patch │ │ ├── 0029-Setting-a-net.http.proxy-property-to-be-able-to-retr.patch │ │ ├── 0030-adding-proxy-support-in-chrome-HTTP-stack-for-libsta.patch │ │ ├── 0031-adding-function-to-retrieve-eth0-MAC-address.patch │ │ ├── 0032-adding-new-field-MAC-address-in-Ethernet-configurati.patch │ │ ├── 0033-adding-new-field-for-NTP-server.patch │ │ ├── 0034-Adding-properties-for-proxy-to-be-used-by-OMXPlayer-.patch │ │ ├── 0035-Creating-NTP-server-field-in-system-database-at-star.patch │ │ ├── 0036-Adding-new-NTP_SERVER-system-setting.patch │ │ ├── 0037-Modifying-NtpTrustedTime-to-handle-NTP-server-field-.patch │ │ ├── 0038-Modifying-NetworkTimeUpdateService-to-handle-new-Set.patch │ │ ├── 0046-adding-ethernet-stats-template.patch │ │ ├── 0047-modifying-EthernetStateTracker-to-return-correct-val.patch │ │ └── 0048-generating-Ethernet-statistics-in-NetworkStatsServic.patch ├── packages │ ├── apps │ │ ├── Email │ │ │ └── 0001-Adding-Ethernet-support-in-Email-application-for-att.patch │ │ ├── Phone │ │ │ └── 0001-Adding-Ethernet-support-in-Phone-application.patch │ │ └── Settings │ │ │ ├── 0001-Adding-Ethernet-configuration-in-Settings-Android-ap.patch │ │ │ ├── 0003-use-white-color-for-ethernet-text-items.patch │ │ │ ├── 0007-Defining-eth0-as-default-choice-for-Ethernet-connect.patch │ │ │ ├── 0008-Changing-one-typo-error-in-Ethernet-Settings.patch │ │ │ ├── 0009-adding-two-new-fields-in-order-to-display-Ethernet-I.patch │ │ │ ├── 0010-adding-code-to-retrieve-Ethernet-IP-and-MAC-address.patch │ │ │ ├── 0011-putting-correctly-Ethernet-Config-and-Proxy-Config-n.patch │ │ │ ├── 0012-adding-new-screen-for-NTP-server-configuration.patch │ │ │ ├── 0018-adding-support-for-ethernet-stats-in-NetworkPolicyEd.patch │ │ │ └── 0019-modifying-DataUsageSummary-screen-for-ethernet-stati.patch │ └── providers │ │ └── DownloadProvider │ │ └── 0001-Adding-Ethernet-support-in-DownloadProvider.patch └── system │ └── core │ └── 0001-adding-the-right-AID-for-daemons-trying-to-set-syste.patch └── jb ├── build └── ethernet.diff ├── development └── ethernet.diff ├── device └── ti │ └── panda │ └── ethernet.diff ├── external └── dhcpcd │ └── ethernet.diff ├── frameworks ├── base │ └── ethernet.diff └── native │ └── ethernet.diff ├── hardware └── libhardware_legacy │ └── ethernet.diff ├── packages └── apps │ ├── Email │ └── ethernet.diff │ └── Phone │ └── ethernet.diff └── system └── core └── ethernet.diff /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .project 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 The Android Open Source Project 2 | Copyright (C) 2012 Benjamin Zores 3 | Copyright (C) 2012 Fabien Brisset 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | aosp-ethernet 2 | ============= 3 | 4 | This repository is a collection of patches to Google's AOSP tree 5 | that provide Ethernet support to Android. 6 | 7 | The original support is based on the fork from Android-x86 project 8 | (see ethernet.diff.tar.gz from http://www.android-x86.org/download page). 9 | 10 | The goal of the patchset is to provide a complete Ethernet support to 11 | AOSP, from low-level layers to applicative framework. 12 | The patchset is hardware independant and only requires the Linux kernel 13 | Ethernet driver to be available. 14 | 15 | The work has been made publicly available by Alcatel-Lucent and is 16 | courtesy of Fabien Brisset and Benjamin Zores. 17 | 18 | The patchset provides the following features: 19 | - Ethernet low-level layer support in AOSP's framework. 20 | - Settings app modification to allow DHCP/Static configuration by user. 21 | - Ethernet IP/MAC addresses display in Settings app. 22 | - StatusBar modification to add Ethernet connectivity status. 23 | - DNS support. 24 | - HTTP proxy support. 25 | - NTP support. 26 | - Seamless Ethernet connectivity support for all apps, shortcuting WiFi. 27 | 28 | Relevant implementation details have been presented in November 2012 29 | at Embedded Linux Conference Europe, Barcelona. 30 | 31 | See http://www.slideshare.net/gxben/elce-2012-dive-into-android-networking-adding-ethernet-connectivity 32 | for additional details and specific information. 33 | 34 | This patchset has been developed against Ice Cream Sandwich 4.0.4_r2.1 branch. 35 | It has been fully validated, though its implementation is not neat. 36 | The patchset sources are available in the ics/ directory. 37 | 38 | Long term goal is to provide a "Google-compliant" implementation instead 39 | of an evil hack and push that upstream for complete integration. 40 | 41 | Long-term implementation is available (still as a draft so far) 42 | for JellyBean 4.2_r1 branch within the jb/ directory. 43 | 44 | Feel free to send remarks and suggestions to: 45 | - Fabien Brisset 46 | - Benjamin Zores 47 | 48 | Happy Hacking ! 49 | 50 | -------------------------------------------------------------------------------- /ics/build/0001-Adding-Ethernet-support.patch: -------------------------------------------------------------------------------- 1 | From 43870c99b1baa727bb1071903036ee9c395d0a11 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 24 Apr 2012 13:30:26 +0200 4 | Subject: [PATCH 1/8] Adding Ethernet support 5 | 6 | --- 7 | core/pathmap.mk | 1 + 8 | 1 files changed, 1 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/core/pathmap.mk b/core/pathmap.mk 11 | index 60fbfd2..5cfa5d9 100644 12 | --- a/core/pathmap.mk 13 | +++ b/core/pathmap.mk 14 | @@ -87,6 +87,7 @@ FRAMEWORKS_BASE_SUBDIRS := \ 15 | opengl \ 16 | sax \ 17 | telephony \ 18 | + ethernet \ 19 | wifi \ 20 | keystore \ 21 | icu4j \ 22 | -- 23 | 1.7.4.1 24 | 25 | -------------------------------------------------------------------------------- /ics/development/0001-Adding-ethernet-support-to-monkey-for-network-statis.patch: -------------------------------------------------------------------------------- 1 | From 800a39463b9ca29fb39e8991d16f95eccfd79bf0 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:11:06 +0200 4 | Subject: [PATCH 1/2] Adding ethernet support to monkey for network statistics 5 | 6 | --- 7 | .../commands/monkey/MonkeyNetworkMonitor.java | 11 +++++++++-- 8 | 1 files changed, 9 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java 11 | index 6af9940..f758f68 100644 12 | --- a/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java 13 | +++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java 14 | @@ -37,6 +37,7 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 15 | private int mLastNetworkType = -1; // unknown 16 | private long mWifiElapsedTime = 0; // accumulated time spent on wifi since start() 17 | private long mMobileElapsedTime = 0; // accumulated time spent on mobile since start() 18 | + private long mEthernetElapsedTime = 0; 19 | private long mElapsedTime = 0; // amount of time spent between start() and stop() 20 | 21 | public void performReceive(Intent intent, int resultCode, String data, Bundle extras, 22 | @@ -68,6 +69,10 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 23 | if (LDEBUG) System.out.println("Adding to wifi: " + delta); 24 | mWifiElapsedTime += delta; 25 | break; 26 | + case ConnectivityManager.TYPE_ETHERNET: 27 | + if (LDEBUG) System.out.println("Adding to ethernet: " + delta); 28 | + mEthernetElapsedTime += delta; 29 | + break; 30 | default: 31 | if (LDEBUG) System.out.println("Unaccounted for: " + delta); 32 | break; 33 | @@ -78,6 +83,7 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 34 | public void start() { 35 | mWifiElapsedTime = 0; 36 | mMobileElapsedTime = 0; 37 | + mEthernetElapsedTime = 0; 38 | mElapsedTime = 0; 39 | mEventTime = mCollectionStartTime = SystemClock.elapsedRealtime(); 40 | } 41 | @@ -100,6 +106,7 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 42 | System.out.println("## Network stats: elapsed time=" + mElapsedTime + "ms (" 43 | + mMobileElapsedTime + "ms mobile, " 44 | + mWifiElapsedTime + "ms wifi, " 45 | - + (mElapsedTime - mMobileElapsedTime - mWifiElapsedTime) + "ms not connected)"); 46 | + + mEthernetElapsedTime + "ms ethernet, " 47 | + + (mElapsedTime - mMobileElapsedTime - mWifiElapsedTime - mEthernetElapsedTime) + "ms not connected)"); 48 | } 49 | - } 50 | \ No newline at end of file 51 | + } 52 | -- 53 | 1.7.4.1 54 | 55 | -------------------------------------------------------------------------------- /ics/development/0002-Adding-Ethernet-API-in-classpath-file-for-Eclipse-ID.patch: -------------------------------------------------------------------------------- 1 | From 125f8576b0fc0a16698dd4e3f0b310638f3b34cf Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 3 Jul 2012 16:44:35 +0200 4 | Subject: [PATCH 2/2] Adding Ethernet API in classpath file for Eclipse IDE 5 | 6 | --- 7 | ide/eclipse/.classpath | 2 ++ 8 | 1 files changed, 2 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath 11 | index f6bcc4c..820aed4 100644 12 | --- a/ide/eclipse/.classpath 13 | +++ b/ide/eclipse/.classpath 14 | @@ -37,6 +37,7 @@ 15 | 16 | 17 | 18 | + 19 | 20 | 21 | 22 | @@ -91,6 +92,7 @@ 23 | 24 | 25 | 26 | + 27 | 28 | 29 | 30 | -- 31 | 1.7.4.1 32 | 33 | -------------------------------------------------------------------------------- /ics/external/dhcpcd/0001-Patching-dhcpcd-daemon-to-handle-dns-properties-corr.patch: -------------------------------------------------------------------------------- 1 | From a4ec3439097a97414f5649a5ad18c583d36e3c81 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:09:41 +0200 4 | Subject: [PATCH 1/2] Patching dhcpcd daemon to handle dns properties correctly 5 | 6 | --- 7 | dhcpcd-hooks/20-dns.conf | 3 +++ 8 | 1 files changed, 3 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/dhcpcd-hooks/20-dns.conf b/dhcpcd-hooks/20-dns.conf 11 | index a92e91d..87eca70 100644 12 | --- a/dhcpcd-hooks/20-dns.conf 13 | +++ b/dhcpcd-hooks/20-dns.conf 14 | @@ -15,8 +15,11 @@ set_dns_props() 15 | count=1 16 | for dnsaddr in ${new_domain_name_servers}; do 17 | setprop dhcp.${interface}.dns${count} ${dnsaddr} 18 | + setprop net.dns${count} ${dnsaddr} 19 | count=$(($count + 1)) 20 | done 21 | } 22 | -- 23 | 1.7.4.1 24 | -------------------------------------------------------------------------------- /ics/frameworks/base/0008-Defining-default-network-connection-to-Ethernet-in-A.patch: -------------------------------------------------------------------------------- 1 | From 2e6f3d67b25f76cd11ef9791144b67cfc9f54cae Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:16:04 +0200 4 | Subject: [PATCH 08/50] Defining default network connection to Ethernet in Android API description files 5 | 6 | --- 7 | api/1.xml | 2 +- 8 | api/10.xml | 2 +- 9 | api/11.xml | 2 +- 10 | api/12.xml | 2 +- 11 | api/13.xml | 2 +- 12 | api/14.txt | 2 +- 13 | api/15.txt | 2 +- 14 | api/2.xml | 2 +- 15 | api/3.xml | 2 +- 16 | api/4.xml | 2 +- 17 | api/5.xml | 2 +- 18 | api/6.xml | 2 +- 19 | api/7.xml | 2 +- 20 | api/8.xml | 2 +- 21 | api/9.xml | 2 +- 22 | api/current.txt | 3 ++- 23 | 16 files changed, 17 insertions(+), 16 deletions(-) 24 | 25 | diff --git a/api/1.xml b/api/1.xml 26 | index 8456bda..5c21165 100644 27 | --- a/api/1.xml 28 | +++ b/api/1.xml 29 | @@ -59112,7 +59112,7 @@ 30 | type="int" 31 | transient="false" 32 | volatile="false" 33 | - value="1" 34 | + value="9" 35 | static="true" 36 | final="true" 37 | deprecated="not deprecated" 38 | diff --git a/api/10.xml b/api/10.xml 39 | index 08df93b..0d3295b 100644 40 | --- a/api/10.xml 41 | +++ b/api/10.xml 42 | @@ -93194,7 +93194,7 @@ 43 | type="int" 44 | transient="false" 45 | volatile="false" 46 | - value="1" 47 | + value="9" 48 | static="true" 49 | final="true" 50 | deprecated="not deprecated" 51 | diff --git a/api/11.xml b/api/11.xml 52 | index beb82b2..0675750 100644 53 | --- a/api/11.xml 54 | +++ b/api/11.xml 55 | @@ -110851,7 +110851,7 @@ 56 | type="int" 57 | transient="false" 58 | volatile="false" 59 | - value="1" 60 | + value="9" 61 | static="true" 62 | final="true" 63 | deprecated="not deprecated" 64 | diff --git a/api/12.xml b/api/12.xml 65 | index e98be45..faba113 100644 66 | --- a/api/12.xml 67 | +++ b/api/12.xml 68 | @@ -113987,7 +113987,7 @@ 69 | type="int" 70 | transient="false" 71 | volatile="false" 72 | - value="1" 73 | + value="9" 74 | static="true" 75 | final="true" 76 | deprecated="not deprecated" 77 | diff --git a/api/13.xml b/api/13.xml 78 | index 73995de..aaab9ac 100644 79 | --- a/api/13.xml 80 | +++ b/api/13.xml 81 | @@ -114898,7 +114898,7 @@ 82 | type="int" 83 | transient="false" 84 | volatile="false" 85 | - value="1" 86 | + value="9" 87 | static="true" 88 | final="true" 89 | deprecated="not deprecated" 90 | diff --git a/api/14.txt b/api/14.txt 91 | index 92969f6..8d2dc5c 100644 92 | --- a/api/14.txt 93 | +++ b/api/14.txt 94 | @@ -11552,7 +11552,7 @@ package android.net { 95 | method public int stopUsingNetworkFeature(int, java.lang.String); 96 | field public static final java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"; 97 | field public static final java.lang.String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; 98 | - field public static final int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1 99 | + field public static final int DEFAULT_NETWORK_PREFERENCE = 9; // 0x9 100 | field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo"; 101 | field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover"; 102 | field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; 103 | diff --git a/api/15.txt b/api/15.txt 104 | index 68fb4bc..33179c0 100644 105 | --- a/api/15.txt 106 | +++ b/api/15.txt 107 | @@ -11591,7 +11591,7 @@ package android.net { 108 | method public int stopUsingNetworkFeature(int, java.lang.String); 109 | field public static final java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"; 110 | field public static final java.lang.String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; 111 | - field public static final int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1 112 | + field public static final int DEFAULT_NETWORK_PREFERENCE = 9; // 0x9 113 | field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo"; 114 | field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover"; 115 | field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; 116 | diff --git a/api/2.xml b/api/2.xml 117 | index fdfd41c..1418c4c 100644 118 | --- a/api/2.xml 119 | +++ b/api/2.xml 120 | @@ -59145,7 +59145,7 @@ 121 | type="int" 122 | transient="false" 123 | volatile="false" 124 | - value="1" 125 | + value="9" 126 | static="true" 127 | final="true" 128 | deprecated="not deprecated" 129 | diff --git a/api/3.xml b/api/3.xml 130 | index 8d2240c..a2a41bc 100644 131 | --- a/api/3.xml 132 | +++ b/api/3.xml 133 | @@ -68596,7 +68596,7 @@ 134 | type="int" 135 | transient="false" 136 | volatile="false" 137 | - value="1" 138 | + value="9" 139 | static="true" 140 | final="true" 141 | deprecated="not deprecated" 142 | diff --git a/api/4.xml b/api/4.xml 143 | index 36592ee..0458de0 100644 144 | --- a/api/4.xml 145 | +++ b/api/4.xml 146 | @@ -72983,7 +72983,7 @@ 147 | type="int" 148 | transient="false" 149 | volatile="false" 150 | - value="1" 151 | + value="9" 152 | static="true" 153 | final="true" 154 | deprecated="not deprecated" 155 | diff --git a/api/5.xml b/api/5.xml 156 | index b7d5906..ebe59ce 100644 157 | --- a/api/5.xml 158 | +++ b/api/5.xml 159 | @@ -81997,7 +81997,7 @@ 160 | type="int" 161 | transient="false" 162 | volatile="false" 163 | - value="1" 164 | + value="9" 165 | static="true" 166 | final="true" 167 | deprecated="not deprecated" 168 | diff --git a/api/6.xml b/api/6.xml 169 | index 133f95e..b812aa7 100644 170 | --- a/api/6.xml 171 | +++ b/api/6.xml 172 | @@ -82067,7 +82067,7 @@ 173 | type="int" 174 | transient="false" 175 | volatile="false" 176 | - value="1" 177 | + value="9" 178 | static="true" 179 | final="true" 180 | deprecated="not deprecated" 181 | diff --git a/api/7.xml b/api/7.xml 182 | index 174d947..dce93cb 100644 183 | --- a/api/7.xml 184 | +++ b/api/7.xml 185 | @@ -82586,7 +82586,7 @@ 186 | type="int" 187 | transient="false" 188 | volatile="false" 189 | - value="1" 190 | + value="9" 191 | static="true" 192 | final="true" 193 | deprecated="not deprecated" 194 | diff --git a/api/8.xml b/api/8.xml 195 | index 225ea91..84fab98 100644 196 | --- a/api/8.xml 197 | +++ b/api/8.xml 198 | @@ -87537,7 +87537,7 @@ 199 | type="int" 200 | transient="false" 201 | volatile="false" 202 | - value="1" 203 | + value="9" 204 | static="true" 205 | final="true" 206 | deprecated="not deprecated" 207 | diff --git a/api/9.xml b/api/9.xml 208 | index c724b70..da6970c 100644 209 | --- a/api/9.xml 210 | +++ b/api/9.xml 211 | @@ -92578,7 +92578,7 @@ 212 | type="int" 213 | transient="false" 214 | volatile="false" 215 | - value="1" 216 | + value="9" 217 | static="true" 218 | final="true" 219 | deprecated="not deprecated" 220 | diff --git a/api/current.txt b/api/current.txt 221 | index 92a90cf..36f76a2 100644 222 | --- a/api/current.txt 223 | +++ b/api/current.txt 224 | @@ -11614,7 +11614,7 @@ package android.net { 225 | method public int stopUsingNetworkFeature(int, java.lang.String); 226 | field public static final java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"; 227 | field public static final java.lang.String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; 228 | - field public static final int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1 229 | + field public static final int DEFAULT_NETWORK_PREFERENCE = 9; // 0x9 230 | field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo"; 231 | field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover"; 232 | field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; 233 | @@ -12267,6 +12267,7 @@ package android.net.sip { 234 | method public boolean isOpened(java.lang.String) throws android.net.sip.SipException; 235 | method public boolean isRegistered(java.lang.String) throws android.net.sip.SipException; 236 | method public static boolean isSipWifiOnly(android.content.Context); 237 | + method public static boolean isSipEthernet(android.content.Context); 238 | method public static boolean isVoipSupported(android.content.Context); 239 | method public android.net.sip.SipAudioCall makeAudioCall(android.net.sip.SipProfile, android.net.sip.SipProfile, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException; 240 | method public android.net.sip.SipAudioCall makeAudioCall(java.lang.String, java.lang.String, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException; 241 | -- 242 | 1.7.4.1 243 | 244 | -------------------------------------------------------------------------------- /ics/frameworks/base/0009-Adding-Ethernet-support-in-Android-SIP-Service.patch: -------------------------------------------------------------------------------- 1 | From 148eebeccd778f637ded2b6c681de29b07abc712 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:16:34 +0200 4 | Subject: [PATCH 09/50] Adding Ethernet support in Android SIP Service 5 | 6 | --- 7 | voip/java/android/net/sip/SipManager.java | 7 +++++++ 8 | voip/java/com/android/server/sip/SipService.java | 6 +++++- 9 | 2 files changed, 12 insertions(+), 1 deletions(-) 10 | 11 | diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java 12 | index 74c3672..5d8402f 100644 13 | --- a/voip/java/android/net/sip/SipManager.java 14 | +++ b/voip/java/android/net/sip/SipManager.java 15 | @@ -155,6 +155,13 @@ public class SipManager { 16 | com.android.internal.R.bool.config_sip_wifi_only); 17 | } 18 | 19 | + /** 20 | + * Returns true anyway for SIP on ethernet connection. 21 | + */ 22 | + public static boolean isSipEthernet(Context context) { 23 | + return true; 24 | + } 25 | + 26 | private SipManager(Context context) { 27 | mContext = context; 28 | createSipService(); 29 | diff --git a/voip/java/com/android/server/sip/SipService.java b/voip/java/com/android/server/sip/SipService.java 30 | index 38a683e..5e566fb 100644 31 | --- a/voip/java/com/android/server/sip/SipService.java 32 | +++ b/voip/java/com/android/server/sip/SipService.java 33 | @@ -82,6 +82,7 @@ public final class SipService extends ISipService.Stub { 34 | private SipWakeupTimer mTimer; 35 | private WifiManager.WifiLock mWifiLock; 36 | private boolean mSipOnWifiOnly; 37 | + private boolean mSipEthernet; 38 | 39 | private IntervalMeasurementProcess mIntervalMeasurementProcess; 40 | 41 | @@ -122,6 +123,7 @@ public final class SipService extends ISipService.Stub { 42 | .createWifiLock(WifiManager.WIFI_MODE_FULL, TAG); 43 | mWifiLock.setReferenceCounted(false); 44 | mSipOnWifiOnly = SipManager.isSipWifiOnly(context); 45 | + mSipEthernet = SipManager.isSipEthernet(context); 46 | 47 | mMyWakeLock = new SipWakeLock((PowerManager) 48 | context.getSystemService(Context.POWER_SERVICE)); 49 | @@ -1154,7 +1156,9 @@ public final class SipService extends ISipService.Stub { 50 | // Some devices limit SIP on Wi-Fi. In this case, if we are not on 51 | // Wi-Fi, treat it as a DISCONNECTED event. 52 | boolean connected = (info != null && info.isConnected() && 53 | - (!mSipOnWifiOnly || info.getType() == ConnectivityManager.TYPE_WIFI)); 54 | + mSipEthernet && info.getType() == ConnectivityManager.TYPE_ETHERNET); 55 | + //(!mSipOnWifiOnly || info.getType() == ConnectivityManager.TYPE_WIFI)); 56 | + 57 | String networkType = connected ? info.getTypeName() : "null"; 58 | 59 | // Ignore the event if the current active network is not changed. 60 | -- 61 | 1.7.4.1 62 | 63 | -------------------------------------------------------------------------------- /ics/frameworks/base/0010-Adding-right-DNS-management-in-Android-framework.patch: -------------------------------------------------------------------------------- 1 | From 3b7071a88b28069bfa90a93a65f2405f46306b04 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:18:11 +0200 4 | Subject: [PATCH 10/50] Adding right DNS management in Android framework 5 | 6 | --- 7 | .../android/net/ethernet/EthernetStateTracker.java | 5 ++++- 8 | .../com/android/server/connectivity/Tethering.java | 4 ++-- 9 | 2 files changed, 6 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/ethernet/java/android/net/ethernet/EthernetStateTracker.java b/ethernet/java/android/net/ethernet/EthernetStateTracker.java 12 | index 9b78de6..d7226f8 100644 13 | --- a/ethernet/java/android/net/ethernet/EthernetStateTracker.java 14 | +++ b/ethernet/java/android/net/ethernet/EthernetStateTracker.java 15 | @@ -385,7 +385,10 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 16 | if (localLOGV) Slog.d(TAG, "DhcpHandler: DHCP request started"); 17 | if (NetworkUtils.runDhcp(mInterfaceName, mDhcpInfo)) { 18 | event = EVENT_INTERFACE_CONFIGURATION_SUCCEEDED; 19 | - if (localLOGV) Slog.d(TAG, "DhcpHandler: DHCP request succeeded: " + mDhcpInfo.toString()); 20 | + //FBR : patch for handling DHCP DNS 21 | + SystemProperties.set("net.dns1", mDhcpInfo.dns1); 22 | + SystemProperties.set("net." + mInterfaceName + ".dns1", mDhcpInfo.dns1); 23 | + if (localLOGV) Slog.d(TAG, "DhcpHandler: DHCP request succeeded: " + mDhcpInfo.toString()); 24 | } else { 25 | event = EVENT_INTERFACE_CONFIGURATION_FAILED; 26 | Slog.e(TAG, "DhcpHandler: DHCP request failed: " + NetworkUtils.getDhcpError()); 27 | diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java 28 | index 20550de..6ed9ccf 100644 29 | --- a/services/java/com/android/server/connectivity/Tethering.java 30 | +++ b/services/java/com/android/server/connectivity/Tethering.java 31 | @@ -172,9 +172,9 @@ public class Tethering extends INetworkManagementEventObserver.Stub { 32 | updateConfiguration(); 33 | 34 | // TODO - remove and rely on real notifications of the current iface 35 | - mDefaultDnsServers = new String[2]; 36 | + /*mDefaultDnsServers = new String[2]; 37 | mDefaultDnsServers[0] = DNS_DEFAULT_SERVER1; 38 | - mDefaultDnsServers[1] = DNS_DEFAULT_SERVER2; 39 | + mDefaultDnsServers[1] = DNS_DEFAULT_SERVER2;*/ 40 | } 41 | 42 | void updateConfiguration() { 43 | -- 44 | 1.7.4.1 45 | 46 | -------------------------------------------------------------------------------- /ics/frameworks/base/0011-Adding-traces-for-No-internet-connection-issue-with-.patch: -------------------------------------------------------------------------------- 1 | From 6b8b57d044fd02046c923c3f2dae33af85cd5d91 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:18:44 +0200 4 | Subject: [PATCH 11/50] Adding traces for No internet connection issue with Ethernet 5 | 6 | --- 7 | .../statusbar/policy/NetworkController.java | 12 ++++++++++++ 8 | 1 files changed, 12 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java 11 | index dd9b28c..90d2c7c 100644 12 | --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java 13 | +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java 14 | @@ -918,9 +918,12 @@ public class NetworkController extends BroadcastReceiver { 15 | mBluetoothTethered = false; 16 | } 17 | 18 | + Slog.e(TAG, "Before refresh Eth connected value = " + mEthernetConnected); 19 | if (info != null && info.getType() == ConnectivityManager.TYPE_ETHERNET) { 20 | mEthernetConnected = info.isConnected(); 21 | } 22 | + Slog.e(TAG, "After refresh Eth connected value = " + mEthernetConnected); 23 | + 24 | // We want to update all the icons, all at once, for any condition change 25 | updateDataNetType(); 26 | updateWimaxIcons(); 27 | @@ -1029,8 +1032,12 @@ public class NetworkController extends BroadcastReceiver { 28 | } 29 | } 30 | 31 | + Slog.e(TAG, "Eth connected value = " + mEthernetConnected); 32 | if (mEthernetConnected) { 33 | + Slog.e(TAG, "Updating label eth connected"); 34 | combinedLabel = "Ethernet Connected"; 35 | + wifiLabel = ""; 36 | + mobileLabel = ""; 37 | combinedActivityIconId = 0; 38 | combinedSignalIconId = mEthernetIconId; 39 | } 40 | @@ -1241,6 +1248,11 @@ public class NetworkController extends BroadcastReceiver { 41 | } 42 | } 43 | 44 | + 45 | + Slog.e(TAG, "combined label value = " + combinedLabel); 46 | + Slog.e(TAG, "wifi label value = " + wifiLabel); 47 | + Slog.e(TAG, "mobile label value = " + mobileLabel); 48 | + 49 | // the combinedLabel in the notification panel 50 | if (!mLastCombinedLabel.equals(combinedLabel)) { 51 | mLastCombinedLabel = combinedLabel; 52 | -- 53 | 1.7.4.1 54 | 55 | -------------------------------------------------------------------------------- /ics/frameworks/base/0012-Redefining-default-network-connection-to-ETHERNET-in.patch: -------------------------------------------------------------------------------- 1 | From d14fe103cfbf481d1b07baf2f2fd26304ce8ada1 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:19:46 +0200 4 | Subject: [PATCH 12/50] Redefining default network connection to ETHERNET in Android framework 5 | 6 | --- 7 | core/java/android/net/ConnectivityManager.java | 2 +- 8 | packages/SettingsProvider/res/values/defaults.xml | 2 +- 9 | 2 files changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java 12 | index 0052dd0..755e102 100644 13 | --- a/core/java/android/net/ConnectivityManager.java 14 | +++ b/core/java/android/net/ConnectivityManager.java 15 | @@ -284,7 +284,7 @@ public class ConnectivityManager { 16 | /** {@hide} */ 17 | public static final int MAX_NETWORK_TYPE = TYPE_WIFI_P2P; 18 | 19 | - public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI; 20 | + public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_ETHERNET; 21 | 22 | private final IConnectivityManager mService; 23 | 24 | diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml 25 | index ffc4289..8cf0e7f 100644 26 | --- a/packages/SettingsProvider/res/values/defaults.xml 27 | +++ b/packages/SettingsProvider/res/values/defaults.xml 28 | @@ -67,7 +67,7 @@ 29 | gps 30 | true 31 | 32 | - 1 33 | + 9 34 | true 35 | false 36 | true 37 | -- 38 | 1.7.4.1 39 | 40 | -------------------------------------------------------------------------------- /ics/frameworks/base/0013-Adding-missing-Ethernet-support-in-ConnectivityServi.patch: -------------------------------------------------------------------------------- 1 | From f382ef9e6bc7c00c20bfb49a8ecd9b95f47f2ff8 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:20:21 +0200 4 | Subject: [PATCH 13/50] Adding missing Ethernet support in ConnectivityService 5 | 6 | --- 7 | .../com/android/server/ConnectivityService.java | 2 ++ 8 | 1 files changed, 2 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java 11 | index 002fb56..8e009b8 100644 12 | --- a/services/java/com/android/server/ConnectivityService.java 13 | +++ b/services/java/com/android/server/ConnectivityService.java 14 | @@ -2877,6 +2877,8 @@ private NetworkStateTracker makeWimaxStateTracker() { 15 | } else { 16 | Slog.e(TAG, "Can't match any wifi netTracker!"); 17 | } 18 | + } else if (networkType == ConnectivityManager.TYPE_ETHERNET) { 19 | + usedNetworkType = ConnectivityManager.TYPE_ETHERNET; 20 | } else { 21 | Slog.e(TAG, "Unexpected network type"); 22 | } 23 | -- 24 | 1.7.4.1 25 | 26 | -------------------------------------------------------------------------------- /ics/frameworks/base/0014-Adding-Ethernet-support-in-NetworkTimeUpdateService.patch: -------------------------------------------------------------------------------- 1 | From 325d7c74cb41d4c97dd92b0d21d97667f7e7f683 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:20:49 +0200 4 | Subject: [PATCH 14/50] Adding Ethernet support in NetworkTimeUpdateService 5 | 6 | --- 7 | .../android/server/NetworkTimeUpdateService.java | 7 +++++++ 8 | 1 files changed, 7 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/NetworkTimeUpdateService.java b/services/java/com/android/server/NetworkTimeUpdateService.java 11 | index f7fe39e..f1725d6 100644 12 | --- a/services/java/com/android/server/NetworkTimeUpdateService.java 13 | +++ b/services/java/com/android/server/NetworkTimeUpdateService.java 14 | @@ -56,6 +56,7 @@ public class NetworkTimeUpdateService { 15 | private static final int EVENT_AUTO_TIME_CHANGED = 1; 16 | private static final int EVENT_POLL_NETWORK_TIME = 2; 17 | private static final int EVENT_WIFI_CONNECTED = 3; 18 | + private static final int EVENT_ETHERNET_CONNECTED = 4; 19 | 20 | /** Normal polling frequency */ 21 | private static final long POLLING_INTERVAL_MS = 24L * 60 * 60 * 1000; // 24 hrs 22 | @@ -242,6 +243,11 @@ public class NetworkTimeUpdateService { 23 | netInfo.getType() == ConnectivityManager.TYPE_WIFI ) { 24 | mHandler.obtainMessage(EVENT_WIFI_CONNECTED).sendToTarget(); 25 | } 26 | + //Patch for ethernet 27 | + if (netInfo.getState() == NetworkInfo.State.CONNECTED && 28 | + netInfo.getType() == ConnectivityManager.TYPE_ETHERNET ) { 29 | + mHandler.obtainMessage(EVENT_ETHERNET_CONNECTED).sendToTarget(); 30 | + } 31 | } 32 | } 33 | } 34 | @@ -260,6 +266,7 @@ public class NetworkTimeUpdateService { 35 | case EVENT_AUTO_TIME_CHANGED: 36 | case EVENT_POLL_NETWORK_TIME: 37 | case EVENT_WIFI_CONNECTED: 38 | + case EVENT_ETHERNET_CONNECTED: 39 | onPollNetworkTime(msg.what); 40 | break; 41 | } 42 | -- 43 | 1.7.4.1 44 | 45 | -------------------------------------------------------------------------------- /ics/frameworks/base/0015-Register-Ethernet-Service-before-Wifi-Service.patch: -------------------------------------------------------------------------------- 1 | From 76f0f6fae4691946b16d66ba7958b9a7dc7107cc Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 26 Jun 2012 13:36:10 +0200 4 | Subject: [PATCH 15/50] Register Ethernet Service before Wifi Service 5 | 6 | --- 7 | core/java/android/app/ContextImpl.java | 14 +++++++------- 8 | 1 files changed, 7 insertions(+), 7 deletions(-) 9 | 10 | diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java 11 | index 826c243..a9c3c35 100644 12 | --- a/core/java/android/app/ContextImpl.java 13 | +++ b/core/java/android/app/ContextImpl.java 14 | @@ -444,6 +444,13 @@ class ContextImpl extends Context { 15 | 16 | registerService(WALLPAPER_SERVICE, WALLPAPER_FETCHER); 17 | 18 | + registerService(ETHERNET_SERVICE, new ServiceFetcher() { 19 | + public Object createService(ContextImpl ctx) { 20 | + IBinder b = ServiceManager.getService(ETHERNET_SERVICE); 21 | + IEthernetManager service = IEthernetManager.Stub.asInterface(b); 22 | + return new EthernetManager(service, ctx.mMainThread.getHandler()); 23 | + }}); 24 | + 25 | registerService(WIFI_SERVICE, new ServiceFetcher() { 26 | public Object createService(ContextImpl ctx) { 27 | IBinder b = ServiceManager.getService(WIFI_SERVICE); 28 | @@ -458,13 +465,6 @@ class ContextImpl extends Context { 29 | return new WifiP2pManager(service); 30 | }}); 31 | 32 | - registerService(ETHERNET_SERVICE, new ServiceFetcher() { 33 | - public Object createService(ContextImpl ctx) { 34 | - IBinder b = ServiceManager.getService(ETHERNET_SERVICE); 35 | - IEthernetManager service = IEthernetManager.Stub.asInterface(b); 36 | - return new EthernetManager(service, ctx.mMainThread.getHandler()); 37 | - }}); 38 | - 39 | registerService(WINDOW_SERVICE, new ServiceFetcher() { 40 | public Object getService(ContextImpl ctx) { 41 | return WindowManagerImpl.getDefault(ctx.mPackageInfo.mCompatibilityInfo); 42 | -- 43 | 1.7.4.1 44 | 45 | -------------------------------------------------------------------------------- /ics/frameworks/base/0016-Redirect-all-getNetworkInfo-requests-on-Ethernet-for.patch: -------------------------------------------------------------------------------- 1 | From 85e738fa4a48c833e1df7531a8f20b18f18fe335 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 26 Jun 2012 13:38:13 +0200 4 | Subject: [PATCH 16/50] Redirect all getNetworkInfo requests on Ethernet for mobile and wireless connections 5 | 6 | --- 7 | core/java/android/net/ConnectivityManager.java | 18 ++++++++++- 8 | .../com/android/server/ConnectivityService.java | 34 +++++++++++++++++++- 9 | 2 files changed, 50 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java 12 | index 755e102..4f2533a 100644 13 | --- a/core/java/android/net/ConnectivityManager.java 14 | +++ b/core/java/android/net/ConnectivityManager.java 15 | @@ -379,7 +379,23 @@ public class ConnectivityManager { 16 | 17 | public NetworkInfo getNetworkInfo(int networkType) { 18 | try { 19 | - return mService.getNetworkInfo(networkType); 20 | + switch (networkType) { 21 | + case TYPE_MOBILE: 22 | + case TYPE_WIFI: 23 | + case TYPE_WIMAX: 24 | + case TYPE_MOBILE_MMS: 25 | + case TYPE_MOBILE_SUPL: 26 | + case TYPE_MOBILE_DUN: 27 | + case TYPE_MOBILE_HIPRI: 28 | + case TYPE_MOBILE_FOTA: 29 | + case TYPE_MOBILE_IMS: 30 | + case TYPE_MOBILE_CBS: 31 | + networkType = TYPE_ETHERNET; 32 | + break; 33 | + default: 34 | + break; 35 | + } 36 | + return mService.getNetworkInfo(networkType); 37 | } catch (RemoteException e) { 38 | return null; 39 | } 40 | diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java 41 | index 8e009b8..d69893f 100644 42 | --- a/services/java/com/android/server/ConnectivityService.java 43 | +++ b/services/java/com/android/server/ConnectivityService.java 44 | @@ -781,11 +781,43 @@ private NetworkStateTracker makeWimaxStateTracker() { 45 | public NetworkInfo getNetworkInfo(int networkType) { 46 | enforceAccessPermission(); 47 | final int uid = Binder.getCallingUid(); 48 | - return getNetworkInfo(networkType, uid); 49 | + switch (networkType) { 50 | + case ConnectivityManager.TYPE_MOBILE: 51 | + case ConnectivityManager.TYPE_WIFI: 52 | + case ConnectivityManager.TYPE_WIMAX: 53 | + case ConnectivityManager.TYPE_MOBILE_MMS: 54 | + case ConnectivityManager.TYPE_MOBILE_SUPL: 55 | + case ConnectivityManager.TYPE_MOBILE_DUN: 56 | + case ConnectivityManager.TYPE_MOBILE_HIPRI: 57 | + case ConnectivityManager.TYPE_MOBILE_FOTA: 58 | + case ConnectivityManager.TYPE_MOBILE_IMS: 59 | + case ConnectivityManager.TYPE_MOBILE_CBS: 60 | + networkType = ConnectivityManager.TYPE_ETHERNET; 61 | + break; 62 | + default: 63 | + break; 64 | + } 65 | + return getNetworkInfo(networkType, uid); 66 | } 67 | 68 | private NetworkInfo getNetworkInfo(int networkType, int uid) { 69 | NetworkInfo info = null; 70 | + switch (networkType) { 71 | + case ConnectivityManager.TYPE_MOBILE: 72 | + case ConnectivityManager.TYPE_WIFI: 73 | + case ConnectivityManager.TYPE_WIMAX: 74 | + case ConnectivityManager.TYPE_MOBILE_MMS: 75 | + case ConnectivityManager.TYPE_MOBILE_SUPL: 76 | + case ConnectivityManager.TYPE_MOBILE_DUN: 77 | + case ConnectivityManager.TYPE_MOBILE_HIPRI: 78 | + case ConnectivityManager.TYPE_MOBILE_FOTA: 79 | + case ConnectivityManager.TYPE_MOBILE_IMS: 80 | + case ConnectivityManager.TYPE_MOBILE_CBS: 81 | + networkType = ConnectivityManager.TYPE_ETHERNET; 82 | + break; 83 | + default: 84 | + break; 85 | + } 86 | if (isNetworkTypeValid(networkType)) { 87 | final NetworkStateTracker tracker = mNetTrackers[networkType]; 88 | if (tracker != null) { 89 | -- 90 | 1.7.4.1 91 | 92 | -------------------------------------------------------------------------------- /ics/frameworks/base/0017-Remove-useless-logs-and-correct-connection-label-in-.patch: -------------------------------------------------------------------------------- 1 | From 5f905abb481f0d38dd5673486fe8c6f19c5d1fb5 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 26 Jun 2012 13:38:56 +0200 4 | Subject: [PATCH 17/50] Remove useless logs and correct connection label in status bar 5 | 6 | --- 7 | .../statusbar/policy/NetworkController.java | 10 +++------- 8 | 1 files changed, 3 insertions(+), 7 deletions(-) 9 | 10 | diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java 11 | index 90d2c7c..109a2bd 100644 12 | --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java 13 | +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java 14 | @@ -918,11 +918,9 @@ public class NetworkController extends BroadcastReceiver { 15 | mBluetoothTethered = false; 16 | } 17 | 18 | - Slog.e(TAG, "Before refresh Eth connected value = " + mEthernetConnected); 19 | if (info != null && info.getType() == ConnectivityManager.TYPE_ETHERNET) { 20 | mEthernetConnected = info.isConnected(); 21 | } 22 | - Slog.e(TAG, "After refresh Eth connected value = " + mEthernetConnected); 23 | 24 | // We want to update all the icons, all at once, for any condition change 25 | updateDataNetType(); 26 | @@ -1032,12 +1030,10 @@ public class NetworkController extends BroadcastReceiver { 27 | } 28 | } 29 | 30 | - Slog.e(TAG, "Eth connected value = " + mEthernetConnected); 31 | if (mEthernetConnected) { 32 | - Slog.e(TAG, "Updating label eth connected"); 33 | - combinedLabel = "Ethernet Connected"; 34 | - wifiLabel = ""; 35 | - mobileLabel = ""; 36 | + wifiLabel = "Ethernet Connected"; 37 | + mobileLabel = ""; 38 | + combinedLabel = wifiLabel; 39 | combinedActivityIconId = 0; 40 | combinedSignalIconId = mEthernetIconId; 41 | } 42 | -- 43 | 1.7.4.1 44 | 45 | -------------------------------------------------------------------------------- /ics/frameworks/base/0022-Defining-eth0-as-default-ethernet-interface.patch: -------------------------------------------------------------------------------- 1 | From 21f2edd8130e2aa6d8dad04c1dc0bdf8e45ce862 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 12 Jul 2012 13:33:57 +0200 4 | Subject: [PATCH 22/50] Defining eth0 as default ethernet interface 5 | 6 | --- 7 | .../java/android/net/ethernet/EthernetDevInfo.java | 2 +- 8 | .../java/com/android/server/EthernetService.java | 2 +- 9 | 2 files changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/ethernet/java/android/net/ethernet/EthernetDevInfo.java b/ethernet/java/android/net/ethernet/EthernetDevInfo.java 12 | index 058eb82..5441e8e 100644 13 | --- a/ethernet/java/android/net/ethernet/EthernetDevInfo.java 14 | +++ b/ethernet/java/android/net/ethernet/EthernetDevInfo.java 15 | @@ -47,7 +47,7 @@ public class EthernetDevInfo implements Parcelable { 16 | private String mode; 17 | 18 | public EthernetDevInfo () { 19 | - dev_name = null; 20 | + dev_name = "eth0"; 21 | ipaddr = null; 22 | dns = null; 23 | route = null; 24 | diff --git a/services/java/com/android/server/EthernetService.java b/services/java/com/android/server/EthernetService.java 25 | index 46f4669..0598789 100644 26 | --- a/services/java/com/android/server/EthernetService.java 27 | +++ b/services/java/com/android/server/EthernetService.java 28 | @@ -98,7 +98,7 @@ public class EthernetService extends IEthernetManager.Stub { 29 | public synchronized void setMode(String mode) { 30 | final ContentResolver cr = mContext.getContentResolver(); 31 | if (DevName != null) { 32 | - Settings.Secure.putString(cr, Settings.Secure.ETHERNET_IFNAME, DevName[0]); 33 | + Settings.Secure.putString(cr, Settings.Secure.ETHERNET_IFNAME, "eth0"); 34 | Settings.Secure.putInt(cr, Settings.Secure.ETHERNET_CONF, 1); 35 | Settings.Secure.putString(cr, Settings.Secure.ETHERNET_MODE, mode); 36 | } 37 | -- 38 | 1.7.4.1 39 | 40 | -------------------------------------------------------------------------------- /ics/frameworks/base/0023-Adding-static-configuration-to-Ethernet-Connectivity.patch: -------------------------------------------------------------------------------- 1 | From b57e076d3765db233a0ff22208c11b5819cd2c20 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 17 Jul 2012 14:56:51 +0200 4 | Subject: [PATCH 23/50] Adding static configuration to Ethernet Connectivity Manager 5 | 6 | --- 7 | .../android/net/ethernet/EthernetStateTracker.java | 32 +++++++++++++------- 8 | 1 files changed, 21 insertions(+), 11 deletions(-) 9 | 10 | diff --git a/ethernet/java/android/net/ethernet/EthernetStateTracker.java b/ethernet/java/android/net/ethernet/EthernetStateTracker.java 11 | index 861f17d..1e57a76 100644 12 | --- a/ethernet/java/android/net/ethernet/EthernetStateTracker.java 13 | +++ b/ethernet/java/android/net/ethernet/EthernetStateTracker.java 14 | @@ -19,6 +19,7 @@ 15 | package android.net.ethernet; 16 | 17 | import java.net.InetAddress; 18 | +import java.net.Inet4Address; 19 | import java.net.UnknownHostException; 20 | 21 | import android.R; 22 | @@ -32,8 +33,11 @@ import android.content.IntentFilter; 23 | import android.content.BroadcastReceiver; 24 | import android.net.LinkCapabilities; 25 | import android.net.LinkProperties; 26 | +import android.net.LinkAddress; 27 | +import android.net.RouteInfo; 28 | import android.net.ConnectivityManager; 29 | import android.net.DhcpInfoInternal; 30 | +import android.net.DhcpInfo; 31 | import android.net.NetworkStateTracker; 32 | import android.net.NetworkUtils; 33 | import android.net.LinkCapabilities; 34 | @@ -141,10 +145,12 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 35 | } 36 | 37 | private boolean configureInterface(EthernetDevInfo info) throws UnknownHostException { 38 | + DhcpInfo infoDhcp = new DhcpInfo(); 39 | mStackConnected = false; 40 | mHWConnected = false; 41 | mInterfaceStopped = false; 42 | mStartingDhcp = true; 43 | + NetworkUtils.resetConnections(info.getIfName(), NetworkUtils.RESET_ALL_ADDRESSES); 44 | if (info.getConnectMode().equals(EthernetDevInfo.ETHERNET_CONN_MODE_DHCP)) { 45 | if (localLOGV) Slog.i(TAG, "trigger dhcp for device " + info.getIfName()); 46 | sDnsPropNames = new String[] { 47 | @@ -154,21 +160,23 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 48 | 49 | mDhcpTarget.sendEmptyMessage(EVENT_DHCP_START); 50 | } else { 51 | -/* HFM 52 | int event; 53 | sDnsPropNames = new String[] { 54 | "net." + mInterfaceName + ".dns1", 55 | "net." + mInterfaceName + ".dns2" 56 | }; 57 | - mDhcpInfo.ipAddress = lookupHost(info.getIpAddress()); 58 | - mDhcpInfo.gateway = lookupHost(info.getRouteAddr()); 59 | - mDhcpInfo.netmask = lookupHost(info.getNetMask()); 60 | - mDhcpInfo.dns1 = lookupHost(info.getDnsAddr()); 61 | - mDhcpInfo.dns2 = 0; 62 | + mDhcpInfo.ipAddress = info.getIpAddress(); 63 | + mDhcpInfo.prefixLength = NetworkUtils.netmaskIntToPrefixLength(lookupHost(info.getNetMask())); 64 | + LinkAddress linkAddress = new LinkAddress(Inet4Address.ANY, mDhcpInfo.prefixLength); 65 | + InetAddress gatewayAddress = NetworkUtils.intToInetAddress(lookupHost(info.getRouteAddr())); 66 | + RouteInfo defaultRoute = new RouteInfo(gatewayAddress); 67 | + mDhcpInfo.addRoute(defaultRoute); 68 | + mDhcpInfo.dns1 = info.getDnsAddr(); 69 | + mDhcpInfo.dns2 = "0.0.0.0"; 70 | + infoDhcp = mDhcpInfo.makeDhcpInfo(); 71 | 72 | if (localLOGV) Slog.i(TAG, "set ip manually " + mDhcpInfo.toString()); 73 | - NetworkUtils.removeDefaultRoute(info.getIfName()); 74 | - if (NetworkUtils.configureInterface(info.getIfName(), mDhcpInfo)) { 75 | + if (NetworkUtils.configureInterface(info.getIfName(), infoDhcp)) { 76 | event = EVENT_INTERFACE_CONFIGURATION_SUCCEEDED; 77 | SystemProperties.set("net.dns1", info.getDnsAddr()); 78 | SystemProperties.set("net." + info.getIfName() + ".dns1", info.getDnsAddr()); 79 | @@ -179,7 +187,6 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 80 | if (localLOGV) Slog.w(TAG, "Static IP configuration failed"); 81 | } 82 | this.sendEmptyMessage(event); 83 | -*/ 84 | } 85 | return true; 86 | } 87 | @@ -377,7 +384,7 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 88 | 89 | public void handleMessage(Message msg) { 90 | int event; 91 | - 92 | + DhcpInfo infoDhcp = new DhcpInfo(); 93 | switch (msg.what) { 94 | case EVENT_DHCP_START: 95 | synchronized (mDhcpTarget) { 96 | @@ -385,11 +392,14 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 97 | if (localLOGV) Slog.d(TAG, "DhcpHandler: DHCP request started"); 98 | if (NetworkUtils.runDhcp(mInterfaceName, mDhcpInfo)) { 99 | event = EVENT_INTERFACE_CONFIGURATION_SUCCEEDED; 100 | - //FBR : patch for handling DHCP DNS. Hardcoded for the moment 101 | //SystemProperties.set("net.dns1", mDhcpInfo.dns1); 102 | SystemProperties.set("net.dns1", "155.132.205.13"); 103 | SystemProperties.set("net." + mInterfaceName + ".dns1", mDhcpInfo.dns1); 104 | if (localLOGV) Slog.d(TAG, "DhcpHandler: DHCP request succeeded: " + mDhcpInfo.toString()); 105 | + infoDhcp = mDhcpInfo.makeDhcpInfo(); 106 | + if (!NetworkUtils.configureInterface(mInterfaceName, infoDhcp)) { 107 | + event = EVENT_INTERFACE_CONFIGURATION_FAILED; 108 | + } 109 | } else { 110 | event = EVENT_INTERFACE_CONFIGURATION_FAILED; 111 | Slog.e(TAG, "DhcpHandler: DHCP request failed: " + NetworkUtils.getDhcpError()); 112 | -- 113 | 1.7.4.1 114 | 115 | -------------------------------------------------------------------------------- /ics/frameworks/base/0024-adding-new-config-values-and-functions-to-handle-def.patch: -------------------------------------------------------------------------------- 1 | From a3bace00f235ec7351069a4231a30b8fe7ad6b6e Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 27 Jul 2012 18:16:52 +0200 4 | Subject: [PATCH 24/50] adding new config values and functions to handle default proxy configuration 5 | 6 | --- 7 | core/res/res/values/config.xml | 6 ++++++ 8 | .../com/android/server/ConnectivityService.java | 8 ++++++++ 9 | 2 files changed, 14 insertions(+), 0 deletions(-) 10 | 11 | diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml 12 | index 6aeeeaa..986ff55 100755 13 | --- a/core/res/res/values/config.xml 14 | +++ b/core/res/res/values/config.xml 15 | @@ -596,6 +596,12 @@ 16 | 17 | 8.8.8.8 18 | 19 | + 20 | + 8.8.8.8 21 | + 22 | + 8080 23 | + 24 | + 25 | 26 | 27 | 28 | diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java 29 | index d69893f..bcfb774 100644 30 | --- a/services/java/com/android/server/ConnectivityService.java 31 | +++ b/services/java/com/android/server/ConnectivityService.java 32 | @@ -356,6 +356,14 @@ public class ConnectivityService extends IConnectivityManager.Stub { 33 | loge("Error setting defaultDns using " + dns); 34 | } 35 | 36 | + //default proxy implementation 37 | + String proxyHost = context.getResources().getString( 38 | + com.android.internal.R.string.config_default_proxy_host); 39 | + int proxyPort = context.getResources().getInteger( 40 | + com.android.internal.R.integer.config_default_proxy_port); 41 | + 42 | + mGlobalProxy = new ProxyProperties(proxyHost, proxyPort, null); 43 | + 44 | mContext = checkNotNull(context, "missing Context"); 45 | mNetd = checkNotNull(netd, "missing INetworkManagementService"); 46 | mPolicyManager = checkNotNull(policyManager, "missing INetworkPolicyManager"); 47 | -- 48 | 1.7.4.1 49 | 50 | -------------------------------------------------------------------------------- /ics/frameworks/base/0028-updating-API-for-modification-regarding-EthernetDevI.patch: -------------------------------------------------------------------------------- 1 | From 03630a0c6599cac0e89e2076a850aad52a556950 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 10:53:35 +0200 4 | Subject: [PATCH 28/50] updating API for modification regarding EthernetDevInfo (new MAC address field) 5 | 6 | --- 7 | api/current.txt | 4 +++- 8 | 1 files changed, 3 insertions(+), 1 deletions(-) 9 | 10 | diff --git a/api/current.txt b/api/current.txt 11 | index 36f76a2..b6bd229 100644 12 | --- a/api/current.txt 13 | +++ b/api/current.txt 14 | @@ -12000,12 +12000,14 @@ package android.net.ethernet { 15 | method public java.lang.String getDnsAddr(); 16 | method public java.lang.String getIfName(); 17 | method public java.lang.String getIpAddress(); 18 | + method public java.lang.String getMacAddress(); 19 | method public java.lang.String getNetMask(); 20 | method public java.lang.String getRouteAddr(); 21 | method public boolean setConnectMode(java.lang.String); 22 | method public void setDnsAddr(java.lang.String); 23 | method public void setIfName(java.lang.String); 24 | method public void setIpAddress(java.lang.String); 25 | + method public void setMacAddress(java.lang.String); 26 | method public void setNetMask(java.lang.String); 27 | method public void setRouteAddr(java.lang.String); 28 | method public void writeToParcel(android.os.Parcel, int); 29 | @@ -12266,8 +12268,8 @@ package android.net.sip { 30 | method public static boolean isIncomingCallIntent(android.content.Intent); 31 | method public boolean isOpened(java.lang.String) throws android.net.sip.SipException; 32 | method public boolean isRegistered(java.lang.String) throws android.net.sip.SipException; 33 | - method public static boolean isSipWifiOnly(android.content.Context); 34 | method public static boolean isSipEthernet(android.content.Context); 35 | + method public static boolean isSipWifiOnly(android.content.Context); 36 | method public static boolean isVoipSupported(android.content.Context); 37 | method public android.net.sip.SipAudioCall makeAudioCall(android.net.sip.SipProfile, android.net.sip.SipProfile, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException; 38 | method public android.net.sip.SipAudioCall makeAudioCall(java.lang.String, java.lang.String, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException; 39 | -- 40 | 1.7.4.1 41 | 42 | -------------------------------------------------------------------------------- /ics/frameworks/base/0029-Setting-a-net.http.proxy-property-to-be-able-to-retr.patch: -------------------------------------------------------------------------------- 1 | From 0c28a0008fef812f7247a88840342a79fabe8b26 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 10:54:33 +0200 4 | Subject: [PATCH 29/50] Setting a net.http.proxy property to be able to retrieve proxy value for other libraries/applications 5 | 6 | --- 7 | .../com/android/server/ConnectivityService.java | 2 ++ 8 | 1 files changed, 2 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java 11 | index bcfb774..0ae85ff 100644 12 | --- a/services/java/com/android/server/ConnectivityService.java 13 | +++ b/services/java/com/android/server/ConnectivityService.java 14 | @@ -363,6 +363,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { 15 | com.android.internal.R.integer.config_default_proxy_port); 16 | 17 | mGlobalProxy = new ProxyProperties(proxyHost, proxyPort, null); 18 | + SystemProperties.set("net.http.proxy", proxyHost + ":" + proxyPort); 19 | 20 | mContext = checkNotNull(context, "missing Context"); 21 | mNetd = checkNotNull(netd, "missing INetworkManagementService"); 22 | @@ -2784,6 +2785,7 @@ private NetworkStateTracker makeWimaxStateTracker() { 23 | Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, port); 24 | Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, 25 | exclList); 26 | + SystemProperties.set("net.http.proxy", host + ":" + port); 27 | } 28 | 29 | if (mGlobalProxy == null) { 30 | -- 31 | 1.7.4.1 32 | 33 | -------------------------------------------------------------------------------- /ics/frameworks/base/0030-adding-proxy-support-in-chrome-HTTP-stack-for-libsta.patch: -------------------------------------------------------------------------------- 1 | From 4ef87927dea53eb62a5a89ccedec77ddb4454e3c Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 10:55:06 +0200 4 | Subject: [PATCH 30/50] adding proxy support in chrome HTTP stack for libstagefright 5 | 6 | --- 7 | media/libstagefright/chromium_http/support.cpp | 12 +++++++++++- 8 | media/libstagefright/chromium_http/support.h | 3 +++ 9 | 2 files changed, 14 insertions(+), 1 deletions(-) 10 | 11 | diff --git a/media/libstagefright/chromium_http/support.cpp b/media/libstagefright/chromium_http/support.cpp 12 | index f15014e..5e34989 100644 13 | --- a/media/libstagefright/chromium_http/support.cpp 14 | +++ b/media/libstagefright/chromium_http/support.cpp 15 | @@ -164,6 +164,10 @@ SfRequestContext::SfRequestContext() { 16 | #endif 17 | 18 | char value[PROPERTY_VALUE_MAX]; 19 | + char value_proxy[PROPERTY_VALUE_MAX]; 20 | + std::string m_proxy; 21 | + std::string m_exclusionList = ""; 22 | + property_get("net.http.proxy", value_proxy, "Unknown"); 23 | property_get("ro.build.version.release", value, "Unknown"); 24 | ua.append(value); 25 | ua.append(")"); 26 | @@ -181,8 +185,14 @@ SfRequestContext::SfRequestContext() { 27 | set_ssl_config_service( 28 | net::SSLConfigService::CreateSystemSSLConfigService()); 29 | 30 | + m_proxyConfigService = new net::ProxyConfigServiceAndroid(); 31 | + if (strcmp(value_proxy,"Unknown") != 0) 32 | + { 33 | + m_proxy = value_proxy; 34 | + m_proxyConfigService->UpdateProxySettings(m_proxy, m_exclusionList); 35 | + } 36 | set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( 37 | - new net::ProxyConfigServiceAndroid, net_log())); 38 | + proxy(), net_log())); 39 | 40 | set_http_transaction_factory(new net::HttpCache( 41 | host_resolver(), 42 | diff --git a/media/libstagefright/chromium_http/support.h b/media/libstagefright/chromium_http/support.h 43 | index d2c5bc0..f207555 100644 44 | --- a/media/libstagefright/chromium_http/support.h 45 | +++ b/media/libstagefright/chromium_http/support.h 46 | @@ -25,6 +25,7 @@ 47 | #include "net/url_request/url_request_context.h" 48 | #include "net/base/android_network_library.h" 49 | #include "net/base/io_buffer.h" 50 | +#include "net/proxy/proxy_config_service_android.h" 51 | 52 | #include 53 | #include 54 | @@ -54,9 +55,11 @@ struct SfRequestContext : public net::URLRequestContext { 55 | SfRequestContext(); 56 | 57 | virtual const std::string &GetUserAgent(const GURL &url) const; 58 | + net::ProxyConfigServiceAndroid* proxy() { return m_proxyConfigService; } 59 | 60 | private: 61 | std::string mUserAgent; 62 | + net::ProxyConfigServiceAndroid* m_proxyConfigService; 63 | 64 | DISALLOW_EVIL_CONSTRUCTORS(SfRequestContext); 65 | }; 66 | -- 67 | 1.7.4.1 68 | 69 | -------------------------------------------------------------------------------- /ics/frameworks/base/0031-adding-function-to-retrieve-eth0-MAC-address.patch: -------------------------------------------------------------------------------- 1 | From f03c34bb1bf6cbb34e587a654f1b2c10136b66c0 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 10:55:46 +0200 4 | Subject: [PATCH 31/50] adding function to retrieve eth0 MAC address 5 | 6 | --- 7 | core/jni/android_net_ethernet.cpp | 50 ++++++++++++++++++++ 8 | .../java/android/net/ethernet/EthernetNative.java | 1 + 9 | 2 files changed, 51 insertions(+), 0 deletions(-) 10 | 11 | diff --git a/core/jni/android_net_ethernet.cpp b/core/jni/android_net_ethernet.cpp 12 | index f540b30..d0d9a6f 100644 13 | --- a/core/jni/android_net_ethernet.cpp 14 | +++ b/core/jni/android_net_ethernet.cpp 15 | @@ -35,6 +35,14 @@ 16 | #include 17 | #include 18 | 19 | +#include 20 | +#include 21 | +#include 22 | +#include 23 | +#include 24 | +#include 25 | + 26 | + 27 | 28 | #define ETH_PKG_NAME "android/net/ethernet/EthernetNative" 29 | #define NL_SOCK_INV -1 30 | @@ -362,6 +370,46 @@ namespace android { 31 | } 32 | 33 | 34 | + static jstring android_net_ethernet_getInterfaceMacAddress(JNIEnv *env, 35 | + jobject clazz) 36 | + { 37 | + int sock = -1; 38 | + char *buf; 39 | + unsigned char *ptr; 40 | + struct ifreq ifr; 41 | + 42 | + sock = socket (AF_INET, SOCK_STREAM, 0); 43 | + if (sock < 0) 44 | + { 45 | + LOGE("socket"); 46 | + return env->NewStringUTF(NULL); 47 | + } 48 | + 49 | + strcpy (ifr.ifr_name, "eth0"); 50 | + strcpy (ifr.ifr_hwaddr.sa_data, ""); 51 | + 52 | + if (ioctl (sock, SIOCGIFHWADDR, &ifr) < 0) 53 | + { 54 | + LOGE("ioctl"); 55 | + return env->NewStringUTF(NULL); 56 | + } 57 | + 58 | + buf = (char *) malloc (64 * sizeof (char)); 59 | + memset (buf, 0, 64); 60 | + ptr = (unsigned char *) ifr.ifr_hwaddr.sa_data; 61 | + 62 | + snprintf (buf, 64, "%02x:%02x:%02x:%02x:%02x:%02x", 63 | + (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), 64 | + (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)); 65 | + 66 | + if (sock) 67 | + close (sock); 68 | + 69 | + LOGI("MAC Address: %s\n", buf); 70 | + 71 | + return env->NewStringUTF(buf); 72 | + } 73 | + 74 | static jint android_net_ethernet_getInterfaceCnt() 75 | { 76 | return total_int; 77 | @@ -370,6 +418,8 @@ namespace android { 78 | static JNINativeMethod gEthernetMethods[] = { 79 | {"waitForEvent", "()Ljava/lang/String;", 80 | (void *)android_net_ethernet_waitForEvent}, 81 | + {"getInterfaceMacAddress", "()Ljava/lang/String;", 82 | + (void *)android_net_ethernet_getInterfaceMacAddress}, 83 | {"getInterfaceName", "(I)Ljava/lang/String;", 84 | (void *)android_net_ethernet_getInterfaceName}, 85 | {"initEthernetNative", "()I", 86 | diff --git a/ethernet/java/android/net/ethernet/EthernetNative.java b/ethernet/java/android/net/ethernet/EthernetNative.java 87 | index 7f3a083..35fe902 100644 88 | --- a/ethernet/java/android/net/ethernet/EthernetNative.java 89 | +++ b/ethernet/java/android/net/ethernet/EthernetNative.java 90 | @@ -24,6 +24,7 @@ package android.net.ethernet; 91 | */ 92 | public class EthernetNative { 93 | public native static String getInterfaceName(int i); 94 | + public native static String getInterfaceMacAddress(); 95 | public native static int getInterfaceCnt(); 96 | public native static int initEthernetNative(); 97 | public native static String waitForEvent(); 98 | -- 99 | 1.7.4.1 100 | 101 | -------------------------------------------------------------------------------- /ics/frameworks/base/0032-adding-new-field-MAC-address-in-Ethernet-configurati.patch: -------------------------------------------------------------------------------- 1 | From e9f3b01f2b69b567ce3c4e72d466b48723ec72e2 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 10:56:16 +0200 4 | Subject: [PATCH 32/50] adding new field MAC address in Ethernet configuration object 5 | 6 | --- 7 | .../java/android/net/ethernet/EthernetDevInfo.java | 10 ++++++++++ 8 | 1 files changed, 10 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/ethernet/java/android/net/ethernet/EthernetDevInfo.java b/ethernet/java/android/net/ethernet/EthernetDevInfo.java 11 | index 5441e8e..9ba907e 100644 12 | --- a/ethernet/java/android/net/ethernet/EthernetDevInfo.java 13 | +++ b/ethernet/java/android/net/ethernet/EthernetDevInfo.java 14 | @@ -40,6 +40,7 @@ public class EthernetDevInfo implements Parcelable { 15 | public static final String ETHERNET_CONN_MODE_MANUAL = "manual"; 16 | 17 | private String dev_name; 18 | + private String mac_addr; 19 | private String ipaddr; 20 | private String netmask; 21 | private String route; 22 | @@ -48,6 +49,7 @@ public class EthernetDevInfo implements Parcelable { 23 | 24 | public EthernetDevInfo () { 25 | dev_name = "eth0"; 26 | + mac_addr = EthernetNative.getInterfaceMacAddress(); 27 | ipaddr = null; 28 | dns = null; 29 | route = null; 30 | @@ -77,6 +79,14 @@ public class EthernetDevInfo implements Parcelable { 31 | public String getIpAddress( ) { 32 | return this.ipaddr; 33 | } 34 | + public void setMacAddress(String mac_addr) { 35 | + this.mac_addr = mac_addr; 36 | + } 37 | + 38 | + public String getMacAddress( ) { 39 | + return this.mac_addr; 40 | + } 41 | + 42 | 43 | public void setNetMask(String ip) { 44 | this.netmask = ip; 45 | -- 46 | 1.7.4.1 47 | 48 | -------------------------------------------------------------------------------- /ics/frameworks/base/0033-adding-new-field-for-NTP-server.patch: -------------------------------------------------------------------------------- 1 | From c3a31c35338651fea5f7064cd2e04d9d2be89304 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:30:48 +0200 4 | Subject: [PATCH 33/50] adding new field for NTP server 5 | 6 | --- 7 | api/current.txt | 1 + 8 | 1 files changed, 1 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/api/current.txt b/api/current.txt 11 | index b6bd229..6640949 100644 12 | --- a/api/current.txt 13 | +++ b/api/current.txt 14 | @@ -17681,6 +17681,7 @@ package android.provider { 15 | field public static final deprecated java.lang.String NETWORK_PREFERENCE = "network_preference"; 16 | field public static final java.lang.String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; 17 | field public static final java.lang.String NOTIFICATION_SOUND = "notification_sound"; 18 | + field public static final java.lang.String NTP_SERVER = "ntp_server"; 19 | field public static final deprecated java.lang.String PARENTAL_CONTROL_ENABLED = "parental_control_enabled"; 20 | field public static final deprecated java.lang.String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update"; 21 | field public static final deprecated java.lang.String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url"; 22 | -- 23 | 1.7.4.1 24 | 25 | -------------------------------------------------------------------------------- /ics/frameworks/base/0034-Adding-properties-for-proxy-to-be-used-by-OMXPlayer-.patch: -------------------------------------------------------------------------------- 1 | From b9f6f325672ddacc1173b38efd7fbaba058b80cf Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:32:03 +0200 4 | Subject: [PATCH 34/50] Adding properties for proxy to be used by OMXPlayer libraries 5 | 6 | --- 7 | .../com/android/server/ConnectivityService.java | 4 ++++ 8 | 1 files changed, 4 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java 11 | index 0ae85ff..caeda92 100644 12 | --- a/services/java/com/android/server/ConnectivityService.java 13 | +++ b/services/java/com/android/server/ConnectivityService.java 14 | @@ -364,6 +364,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { 15 | 16 | mGlobalProxy = new ProxyProperties(proxyHost, proxyPort, null); 17 | SystemProperties.set("net.http.proxy", proxyHost + ":" + proxyPort); 18 | + SystemProperties.set("net.proxy", proxyHost + ":" + proxyPort); 19 | + SystemProperties.set("rw.HTTP_PROXY", "http://" + proxyHost + ":" + proxyPort); 20 | 21 | mContext = checkNotNull(context, "missing Context"); 22 | mNetd = checkNotNull(netd, "missing INetworkManagementService"); 23 | @@ -2786,6 +2788,8 @@ private NetworkStateTracker makeWimaxStateTracker() { 24 | Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, 25 | exclList); 26 | SystemProperties.set("net.http.proxy", host + ":" + port); 27 | + SystemProperties.set("net.proxy", host + ":" + port); 28 | + SystemProperties.set("rw.HTTP_PROXY", "http://" + host + ":" + port); 29 | } 30 | 31 | if (mGlobalProxy == null) { 32 | -- 33 | 1.7.4.1 34 | 35 | -------------------------------------------------------------------------------- /ics/frameworks/base/0035-Creating-NTP-server-field-in-system-database-at-star.patch: -------------------------------------------------------------------------------- 1 | From 9088b9f58168c6d7510897b626d39586e0776052 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:33:13 +0200 4 | Subject: [PATCH 35/50] Creating NTP server field in system database at startup 5 | 6 | --- 7 | .../android/providers/settings/DatabaseHelper.java | 3 +++ 8 | 1 files changed, 3 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java 11 | index bc7baf3..1280005 100644 12 | --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java 13 | +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java 14 | @@ -1424,6 +1424,9 @@ public class DatabaseHelper extends SQLiteOpenHelper { 15 | loadBooleanSetting(stmt, Settings.System.AUTO_TIME, 16 | R.bool.def_auto_time); // Sync time to NITZ 17 | 18 | + loadStringSetting(stmt, Settings.System.NTP_SERVER, 19 | + com.android.internal.R.string.config_ntpServer); 20 | + 21 | loadBooleanSetting(stmt, Settings.System.AUTO_TIME_ZONE, 22 | R.bool.def_auto_time_zone); // Sync timezone to NITZ 23 | 24 | -- 25 | 1.7.4.1 26 | 27 | -------------------------------------------------------------------------------- /ics/frameworks/base/0036-Adding-new-NTP_SERVER-system-setting.patch: -------------------------------------------------------------------------------- 1 | From ae98531a45d11b4962b995255227894cbdc64cb0 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:34:00 +0200 4 | Subject: [PATCH 36/50] Adding new NTP_SERVER system setting 5 | 6 | --- 7 | core/java/android/provider/Settings.java | 6 ++++++ 8 | 1 files changed, 6 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java 11 | index 60fef1e..61c8b39 100644 12 | --- a/core/java/android/provider/Settings.java 13 | +++ b/core/java/android/provider/Settings.java 14 | @@ -1650,6 +1650,11 @@ public final class Settings { 15 | public static final String AUTO_TIME = "auto_time"; 16 | 17 | /** 18 | + * Value for NTP Server 19 | + */ 20 | + public static final String NTP_SERVER = "ntp_server"; 21 | + 22 | + /** 23 | * Value to specify if the user prefers the time zone 24 | * to be automatically fetched from the network (NITZ). 1=yes, 0=no 25 | */ 26 | @@ -1972,6 +1977,7 @@ public final class Settings { 27 | TEXT_AUTO_PUNCTUATE, 28 | TEXT_SHOW_PASSWORD, 29 | AUTO_TIME, 30 | + NTP_SERVER, 31 | AUTO_TIME_ZONE, 32 | TIME_12_24, 33 | DATE_FORMAT, 34 | -- 35 | 1.7.4.1 36 | 37 | -------------------------------------------------------------------------------- /ics/frameworks/base/0037-Modifying-NtpTrustedTime-to-handle-NTP-server-field-.patch: -------------------------------------------------------------------------------- 1 | From 5af8c1edd1515611ecd8ba94adcb6ba72545ff30 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:37:05 +0200 4 | Subject: [PATCH 37/50] Modifying NtpTrustedTime to handle NTP server field setting 5 | 6 | --- 7 | core/java/android/util/NtpTrustedTime.java | 15 ++++++++++----- 8 | 1 files changed, 10 insertions(+), 5 deletions(-) 9 | 10 | diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java 11 | index 2179ff3..fc19908 100644 12 | --- a/core/java/android/util/NtpTrustedTime.java 13 | +++ b/core/java/android/util/NtpTrustedTime.java 14 | @@ -35,7 +35,7 @@ public class NtpTrustedTime implements TrustedTime { 15 | 16 | private static NtpTrustedTime sSingleton; 17 | 18 | - private final String mServer; 19 | + private String mServer; 20 | private final long mTimeout; 21 | 22 | private boolean mHasCache; 23 | @@ -54,17 +54,17 @@ public class NtpTrustedTime implements TrustedTime { 24 | final Resources res = context.getResources(); 25 | final ContentResolver resolver = context.getContentResolver(); 26 | 27 | - final String defaultServer = res.getString( 28 | - com.android.internal.R.string.config_ntpServer); 29 | + String defaultServer = Settings.System.getString( 30 | + resolver, Settings.System.NTP_SERVER); 31 | final long defaultTimeout = res.getInteger( 32 | com.android.internal.R.integer.config_ntpTimeout); 33 | 34 | - final String secureServer = Settings.Secure.getString( 35 | + String secureServer = Settings.Secure.getString( 36 | resolver, Settings.Secure.NTP_SERVER); 37 | final long timeout = Settings.Secure.getLong( 38 | resolver, Settings.Secure.NTP_TIMEOUT, defaultTimeout); 39 | 40 | - final String server = secureServer != null ? secureServer : defaultServer; 41 | + String server = secureServer != null ? secureServer : defaultServer; 42 | sSingleton = new NtpTrustedTime(server, timeout); 43 | } 44 | 45 | @@ -134,4 +134,9 @@ public class NtpTrustedTime implements TrustedTime { 46 | public long getCachedNtpTimeReference() { 47 | return mCachedNtpElapsedRealtime; 48 | } 49 | + 50 | + public void refreshServer(String ntpServer) { 51 | + if (!ntpServer.equals(mServer)) 52 | + mServer = ntpServer; 53 | + } 54 | } 55 | -- 56 | 1.7.4.1 57 | 58 | -------------------------------------------------------------------------------- /ics/frameworks/base/0038-Modifying-NetworkTimeUpdateService-to-handle-new-Set.patch: -------------------------------------------------------------------------------- 1 | From 4f5d1aeb259c7b823da4846e89518fbfbda9f64f Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:43:47 +0200 4 | Subject: [PATCH 38/50] Modifying NetworkTimeUpdateService to handle new Setting for NTP Server 5 | 6 | --- 7 | .../android/server/NetworkTimeUpdateService.java | 45 +++++++++++++++++-- 8 | 1 files changed, 40 insertions(+), 5 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/NetworkTimeUpdateService.java b/services/java/com/android/server/NetworkTimeUpdateService.java 11 | index f1725d6..73b4daf 100644 12 | --- a/services/java/com/android/server/NetworkTimeUpdateService.java 13 | +++ b/services/java/com/android/server/NetworkTimeUpdateService.java 14 | @@ -57,6 +57,7 @@ public class NetworkTimeUpdateService { 15 | private static final int EVENT_POLL_NETWORK_TIME = 2; 16 | private static final int EVENT_WIFI_CONNECTED = 3; 17 | private static final int EVENT_ETHERNET_CONNECTED = 4; 18 | + private static final int EVENT_NTP_SERVER_CHANGED = 5; 19 | 20 | /** Normal polling frequency */ 21 | private static final long POLLING_INTERVAL_MS = 24L * 60 * 60 * 1000; // 24 hrs 22 | @@ -77,7 +78,7 @@ public class NetworkTimeUpdateService { 23 | private long mNitzZoneSetTime = NOT_SET; 24 | 25 | private Context mContext; 26 | - private TrustedTime mTime; 27 | + private NtpTrustedTime mTime; 28 | 29 | // NTP lookup is done on this thread and handler 30 | private Handler mHandler; 31 | @@ -85,6 +86,7 @@ public class NetworkTimeUpdateService { 32 | private AlarmManager mAlarmManager; 33 | private PendingIntent mPendingPollIntent; 34 | private SettingsObserver mSettingsObserver; 35 | + private SettingsNtpServerObserver mSettingsNtpServerObserver; 36 | // The last time that we successfully fetched the NTP time. 37 | private long mLastNtpFetchTime = NOT_SET; 38 | // Keeps track of how many quick attempts were made to fetch NTP time. 39 | @@ -114,6 +116,8 @@ public class NetworkTimeUpdateService { 40 | 41 | mSettingsObserver = new SettingsObserver(mHandler, EVENT_AUTO_TIME_CHANGED); 42 | mSettingsObserver.observe(mContext); 43 | + mSettingsNtpServerObserver = new SettingsNtpServerObserver(mHandler, EVENT_NTP_SERVER_CHANGED); 44 | + mSettingsNtpServerObserver.observe(mContext); 45 | } 46 | 47 | private void registerForTelephonyIntents() { 48 | @@ -152,9 +156,15 @@ public class NetworkTimeUpdateService { 49 | } 50 | final long currentTime = System.currentTimeMillis(); 51 | if (DBG) Log.d(TAG, "System time = " + currentTime); 52 | + 53 | + //Update server if NTP changed 54 | + if (event == EVENT_NTP_SERVER_CHANGED) 55 | + { 56 | + mTime.refreshServer(Settings.System.getString(mContext.getContentResolver(), Settings.System.NTP_SERVER)); 57 | + } 58 | // Get the NTP time 59 | if (mLastNtpFetchTime == NOT_SET || refTime >= mLastNtpFetchTime + POLLING_INTERVAL_MS 60 | - || event == EVENT_AUTO_TIME_CHANGED) { 61 | + || event == EVENT_AUTO_TIME_CHANGED || event == EVENT_NTP_SERVER_CHANGED) { 62 | if (DBG) Log.d(TAG, "Before Ntp fetch"); 63 | 64 | // force refresh NTP cache when outdated 65 | @@ -162,8 +172,8 @@ public class NetworkTimeUpdateService { 66 | mTime.forceRefresh(); 67 | } 68 | 69 | - // only update when NTP time is fresh 70 | - if (mTime.getCacheAge() < POLLING_INTERVAL_MS) { 71 | + // only update when NTP time is fresh or server changed 72 | + if ((mTime.getCacheAge() < POLLING_INTERVAL_MS) || (event == EVENT_NTP_SERVER_CHANGED)) { 73 | final long ntp = mTime.currentTimeMillis(); 74 | mTryAgainCounter = 0; 75 | mLastNtpFetchTime = SystemClock.elapsedRealtime(); 76 | @@ -266,7 +276,8 @@ public class NetworkTimeUpdateService { 77 | case EVENT_AUTO_TIME_CHANGED: 78 | case EVENT_POLL_NETWORK_TIME: 79 | case EVENT_WIFI_CONNECTED: 80 | - case EVENT_ETHERNET_CONNECTED: 81 | + case EVENT_ETHERNET_CONNECTED: 82 | + case EVENT_NTP_SERVER_CHANGED: 83 | onPollNetworkTime(msg.what); 84 | break; 85 | } 86 | @@ -296,4 +307,28 @@ public class NetworkTimeUpdateService { 87 | mHandler.obtainMessage(mMsg).sendToTarget(); 88 | } 89 | } 90 | + 91 | + /** Observer to watch for changes to the NTP Server setting */ 92 | + private static class SettingsNtpServerObserver extends ContentObserver { 93 | + 94 | + private int mMsg; 95 | + private Handler mHandler; 96 | + 97 | + SettingsNtpServerObserver(Handler handler, int msg) { 98 | + super(handler); 99 | + mHandler = handler; 100 | + mMsg = msg; 101 | + } 102 | + 103 | + void observe(Context context) { 104 | + ContentResolver resolver = context.getContentResolver(); 105 | + resolver.registerContentObserver(Settings.System.getUriFor(Settings.System.NTP_SERVER), 106 | + false, this); 107 | + } 108 | + 109 | + @Override 110 | + public void onChange(boolean selfChange) { 111 | + mHandler.obtainMessage(mMsg).sendToTarget(); 112 | + } 113 | + } 114 | } 115 | -- 116 | 1.7.4.1 117 | 118 | -------------------------------------------------------------------------------- /ics/frameworks/base/0046-adding-ethernet-stats-template.patch: -------------------------------------------------------------------------------- 1 | From 0522d6fd60121294c5074ee3a79bf8b938bad517 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Mon, 3 Sep 2012 11:03:15 +0200 4 | Subject: [PATCH 46/50] adding ethernet stats template 5 | 6 | --- 7 | .../java/com/android/server/EventLogTags.logtags | 1 + 8 | 1 files changed, 1 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/EventLogTags.logtags b/services/java/com/android/server/EventLogTags.logtags 11 | index 4dad209..de00209 100644 12 | --- a/services/java/com/android/server/EventLogTags.logtags 13 | +++ b/services/java/com/android/server/EventLogTags.logtags 14 | @@ -144,3 +144,4 @@ option java_package com.android.server 15 | # --------------------------- 16 | 51100 netstats_mobile_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3),(dev_history_start|2|3) 17 | 51101 netstats_wifi_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3),(dev_history_start|2|3) 18 | +51102 netstats_ethernet_sample (dev_rx_bytes|2|2),(dev_tx_bytes|2|2),(dev_rx_pkts|2|1),(dev_tx_pkts|2|1),(xt_rx_bytes|2|2),(xt_tx_bytes|2|2),(xt_rx_pkts|2|1),(xt_tx_pkts|2|1),(uid_rx_bytes|2|2),(uid_tx_bytes|2|2),(uid_rx_pkts|2|1),(uid_tx_pkts|2|1),(trusted_time|2|3),(dev_history_start|2|3) 19 | -- 20 | 1.7.4.1 21 | 22 | -------------------------------------------------------------------------------- /ics/frameworks/base/0047-modifying-EthernetStateTracker-to-return-correct-val.patch: -------------------------------------------------------------------------------- 1 | From 3f31ac22502070468be3d6a1330bd58acb242187 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Mon, 3 Sep 2012 11:03:51 +0200 4 | Subject: [PATCH 47/50] modifying EthernetStateTracker to return correct values for eth0 statistics 5 | 6 | --- 7 | .../android/net/ethernet/EthernetStateTracker.java | 13 +++++++++++-- 8 | 1 files changed, 11 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/ethernet/java/android/net/ethernet/EthernetStateTracker.java b/ethernet/java/android/net/ethernet/EthernetStateTracker.java 11 | index 1e57a76..71d1abd 100644 12 | --- a/ethernet/java/android/net/ethernet/EthernetStateTracker.java 13 | +++ b/ethernet/java/android/net/ethernet/EthernetStateTracker.java 14 | @@ -79,6 +79,8 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 15 | private EthernetManager mEM; 16 | private boolean mServiceStarted; 17 | private NetworkInfo mNetworkInfo; 18 | + private LinkProperties mLinkProperties; 19 | + private LinkCapabilities mLinkCapabilities; 20 | 21 | private boolean mStackConnected; 22 | private boolean mHWConnected; 23 | @@ -173,6 +175,8 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 24 | mDhcpInfo.addRoute(defaultRoute); 25 | mDhcpInfo.dns1 = info.getDnsAddr(); 26 | mDhcpInfo.dns2 = "0.0.0.0"; 27 | + mLinkProperties = mDhcpInfo.makeLinkProperties(); 28 | + mLinkProperties.setInterfaceName("eth0"); 29 | infoDhcp = mDhcpInfo.makeDhcpInfo(); 30 | 31 | if (localLOGV) Slog.i(TAG, "set ip manually " + mDhcpInfo.toString()); 32 | @@ -314,7 +318,10 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 33 | } 34 | 35 | private void postNotification(int event) { 36 | - Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, new NetworkInfo(mNetworkInfo)); 37 | + Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); 38 | + msg.sendToTarget(); 39 | + 40 | + msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); 41 | msg.sendToTarget(); 42 | } 43 | 44 | @@ -404,6 +411,8 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 45 | event = EVENT_INTERFACE_CONFIGURATION_FAILED; 46 | Slog.e(TAG, "DhcpHandler: DHCP request failed: " + NetworkUtils.getDhcpError()); 47 | } 48 | + mLinkProperties = mDhcpInfo.makeLinkProperties(); 49 | + mLinkProperties.setInterfaceName("eth0"); 50 | mTrackerTarget.sendEmptyMessage(event); 51 | } else { 52 | mInterfaceStopped = false; 53 | @@ -494,7 +503,7 @@ public class EthernetStateTracker extends Handler implements NetworkStateTracker 54 | * Fetch LinkProperties for the network 55 | */ 56 | public LinkProperties getLinkProperties() { 57 | - return new LinkProperties(); 58 | + return new LinkProperties(mLinkProperties); 59 | } 60 | 61 | /** 62 | -- 63 | 1.7.4.1 64 | 65 | -------------------------------------------------------------------------------- /ics/frameworks/base/0048-generating-Ethernet-statistics-in-NetworkStatsServic.patch: -------------------------------------------------------------------------------- 1 | From a960a17406ed76dc8ac2a300ab5e870ca77fef83 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Mon, 3 Sep 2012 11:04:30 +0200 4 | Subject: [PATCH 48/50] generating Ethernet statistics in NetworkStatsService 5 | 6 | --- 7 | .../android/server/net/NetworkStatsService.java | 20 ++++++++++++++++++++ 8 | 1 files changed, 20 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java 11 | index f660520..633f66a 100644 12 | --- a/services/java/com/android/server/net/NetworkStatsService.java 13 | +++ b/services/java/com/android/server/net/NetworkStatsService.java 14 | @@ -26,6 +26,12 @@ import static android.content.Intent.ACTION_UID_REMOVED; 15 | import static android.content.Intent.EXTRA_UID; 16 | import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED; 17 | import static android.net.ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE; 18 | + 19 | +import android.net.NetworkInfo.DetailedState; 20 | +import android.net.LinkCapabilities; 21 | +import android.net.LinkProperties; 22 | +import android.net.ConnectivityManager; 23 | + 24 | import static android.net.NetworkStats.IFACE_ALL; 25 | import static android.net.NetworkStats.SET_ALL; 26 | import static android.net.NetworkStats.SET_DEFAULT; 27 | @@ -34,6 +40,7 @@ import static android.net.NetworkStats.TAG_NONE; 28 | import static android.net.NetworkStats.UID_ALL; 29 | import static android.net.NetworkTemplate.buildTemplateMobileAll; 30 | import static android.net.NetworkTemplate.buildTemplateWifi; 31 | +import static android.net.NetworkTemplate.buildTemplateEthernet; 32 | import static android.net.TrafficStats.UID_REMOVED; 33 | import static android.provider.Settings.Secure.NETSTATS_NETWORK_BUCKET_DURATION; 34 | import static android.provider.Settings.Secure.NETSTATS_NETWORK_MAX_HISTORY; 35 | @@ -1031,6 +1038,19 @@ public class NetworkStatsService extends INetworkStatsService.Stub { 36 | xtTotal.rxBytes, xtTotal.rxPackets, xtTotal.txBytes, xtTotal.txPackets, 37 | uidTotal.rxBytes, uidTotal.rxPackets, uidTotal.txBytes, uidTotal.txPackets, 38 | trustedTime, devHistoryStart); 39 | + 40 | + // collect ethernet sample 41 | + template = buildTemplateEthernet(); 42 | + devTotal = getSummaryForNetworkDev(template, start, end).getTotal(devTotal); 43 | + devHistoryStart = getHistoryStartLocked(template, mNetworkDevStats); 44 | + xtTotal = getSummaryForNetworkXt(template, start, end).getTotal(xtTotal); 45 | + uidTotal = getSummaryForAllUid(template, start, end, false).getTotal(uidTotal); 46 | + EventLogTags.writeNetstatsEthernetSample( 47 | + devTotal.rxBytes, devTotal.rxPackets, devTotal.txBytes, devTotal.txPackets, 48 | + xtTotal.rxBytes, xtTotal.rxPackets, xtTotal.txBytes, xtTotal.txPackets, 49 | + uidTotal.rxBytes, uidTotal.rxPackets, uidTotal.txBytes, uidTotal.txPackets, 50 | + trustedTime, devHistoryStart); 51 | + 52 | } 53 | 54 | /** 55 | -- 56 | 1.7.4.1 57 | 58 | -------------------------------------------------------------------------------- /ics/packages/apps/Email/0001-Adding-Ethernet-support-in-Email-application-for-att.patch: -------------------------------------------------------------------------------- 1 | From 21c71171542f6cdc9b7b531546ad131e485d8c13 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:10:26 +0200 4 | Subject: [PATCH] Adding Ethernet support in Email application for attachment handling 5 | 6 | --- 7 | src/com/android/email/AttachmentInfo.java | 3 ++- 8 | .../email/service/AttachmentDownloadService.java | 3 ++- 9 | 2 files changed, 4 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/src/com/android/email/AttachmentInfo.java b/src/com/android/email/AttachmentInfo.java 12 | index cedb63e..1f01cbf 100644 13 | --- a/src/com/android/email/AttachmentInfo.java 14 | +++ b/src/com/android/email/AttachmentInfo.java 15 | @@ -160,7 +160,8 @@ public class AttachmentInfo { 16 | // The size limit is overridden when on a wifi connection - any size is OK 17 | if (mSize > AttachmentUtilities.MAX_ATTACHMENT_DOWNLOAD_SIZE) { 18 | int networkType = EmailConnectivityManager.getActiveNetworkType(context); 19 | - if (networkType != ConnectivityManager.TYPE_WIFI) { 20 | + if ((networkType != ConnectivityManager.TYPE_ETHERNET) && (networkType != ConnectivityManager.TYPE_WIFI)) { 21 | + 22 | canView = false; 23 | canSave = false; 24 | denyFlags |= DENY_WIFIONLY; 25 | diff --git a/src/com/android/email/service/AttachmentDownloadService.java b/src/com/android/email/service/AttachmentDownloadService.java 26 | index 18468fb..64d9f2e 100644 27 | --- a/src/com/android/email/service/AttachmentDownloadService.java 28 | +++ b/src/com/android/email/service/AttachmentDownloadService.java 29 | @@ -341,7 +341,8 @@ public class AttachmentDownloadService extends Service implements Runnable { 30 | if (ecm == null) return; 31 | if (!ecm.isAutoSyncAllowed()) return; 32 | // Don't prefetch unless we're on a WiFi network 33 | - if (ecm.getActiveNetworkType() != ConnectivityManager.TYPE_WIFI) { 34 | + if ((ecm.getActiveNetworkType() != ConnectivityManager.TYPE_ETHERNET) && (ecm.getActiveNetworkType() != ConnectivityManager.TYPE_WIFI)) { 35 | + 36 | return; 37 | } 38 | // Then, try opportunistic download of appropriate attachments 39 | -- 40 | 1.7.4.1 41 | 42 | -------------------------------------------------------------------------------- /ics/packages/apps/Phone/0001-Adding-Ethernet-support-in-Phone-application.patch: -------------------------------------------------------------------------------- 1 | From 69507afd627cd09751f0eac03b5d65c561649346 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 21 Jun 2012 17:14:41 +0200 4 | Subject: [PATCH 1/3] Adding Ethernet support in Phone application 5 | 6 | --- 7 | src/com/android/phone/SipCallOptionHandler.java | 6 ++++-- 8 | 1 files changed, 4 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/src/com/android/phone/SipCallOptionHandler.java b/src/com/android/phone/SipCallOptionHandler.java 11 | index 0734cd7..32ada4e 100644 12 | --- a/src/com/android/phone/SipCallOptionHandler.java 13 | +++ b/src/com/android/phone/SipCallOptionHandler.java 14 | @@ -406,8 +406,10 @@ public class SipCallOptionHandler extends Activity implements 15 | NetworkInfo ni = cm.getActiveNetworkInfo(); 16 | if ((ni == null) || !ni.isConnected()) return false; 17 | 18 | - return ((ni.getType() == ConnectivityManager.TYPE_WIFI) 19 | - || !SipManager.isSipWifiOnly(this)); 20 | + return ((ni.getType() == ConnectivityManager.TYPE_ETHERNET) 21 | + && SipManager.isSipEthernet(this)); 22 | + //return ((ni.getType() == ConnectivityManager.TYPE_WIFI) 23 | + // || !SipManager.isSipWifiOnly(this)); 24 | } 25 | return false; 26 | } 27 | -- 28 | 1.7.4.1 29 | 30 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0001-Adding-Ethernet-configuration-in-Settings-Android-ap.patch: -------------------------------------------------------------------------------- 1 | From ea5b1390f6c65c86e9ddae3b109035e5cfacdfd3 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 24 Apr 2012 13:59:48 +0200 4 | Subject: [PATCH 01/19] Adding Ethernet configuration in Settings Android app 5 | 6 | --- 7 | AndroidManifest.xml | 48 +++++ 8 | proguard.flags | 1 + 9 | res/drawable-hdpi/ic_settings_ethernet.png | Bin 0 -> 946 bytes 10 | res/drawable-mdpi/ic_settings_ethernet.png | Bin 0 -> 946 bytes 11 | res/drawable/ic_settings_ethernet.xml | 20 ++ 12 | res/drawable/ic_settings_ethernet_img.png | Bin 0 -> 946 bytes 13 | res/layout/eth_configure.xml | 112 ++++++++++ 14 | res/values/strings.xml | 21 ++ 15 | res/xml/ethernet_settings.xml | 32 +++ 16 | res/xml/settings_headers.xml | 15 ++ 17 | src/com/android/settings/Settings.java | 1 + 18 | .../settings/ethernet/EthernetConfigDialog.java | 216 ++++++++++++++++++++ 19 | .../android/settings/ethernet/EthernetEnabler.java | 172 ++++++++++++++++ 20 | .../android/settings/ethernet/EthernetLayer.java | 68 ++++++ 21 | .../settings/ethernet/EthernetSettings.java | 93 +++++++++ 22 | 15 files changed, 799 insertions(+), 0 deletions(-) 23 | create mode 100644 res/drawable-hdpi/ic_settings_ethernet.png 24 | create mode 100644 res/drawable-mdpi/ic_settings_ethernet.png 25 | create mode 100644 res/drawable/ic_settings_ethernet.xml 26 | create mode 100644 res/drawable/ic_settings_ethernet_img.png 27 | create mode 100644 res/layout/eth_configure.xml 28 | create mode 100644 res/xml/ethernet_settings.xml 29 | create mode 100644 src/com/android/settings/ethernet/EthernetConfigDialog.java 30 | create mode 100644 src/com/android/settings/ethernet/EthernetEnabler.java 31 | create mode 100644 src/com/android/settings/ethernet/EthernetLayer.java 32 | create mode 100644 src/com/android/settings/ethernet/EthernetSettings.java 33 | 34 | diff --git a/AndroidManifest.xml b/AndroidManifest.xml 35 | index 39175ce..332d8d5 100644 36 | --- a/AndroidManifest.xml 37 | +++ b/AndroidManifest.xml 38 | @@ -88,6 +88,54 @@ 39 | 40 | 41 | 42 | + 43 | + 44 | + 46 | + 47 | + 48 | + 49 | + 50 | + 51 | + 52 | + 54 | + 56 | + 57 | + 58 | + 61 | + 62 | + 63 | + 64 | + 65 | + 66 | + 67 | + 68 | + 70 | + 72 | + 73 | + 74 | + 77 | + 78 | + 79 | + 80 | + 81 | + 82 | + 83 | + 84 | + 86 | + 88 | + 89 | + 90 | 91 | 92 | Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXiB 112 | z0|YKMFI;#400S~fL_t(o!|m74Yg|k1r@h~pe|f!aUnucK}D*?pRIX_F^#pxW+rpooPozUlg!kmx$t<* 114 | zd-t9Dz32Nq-+P9=@qZuHv>!yo3hu@-+7rYGY~vE%t*Yum^JV86K;Mq%u!3{wjR6sP 115 | zU56X758vTG1L)unyn)l0#au2n$ZF($GXb8$lW2_!b}i#?tmdvB#Zh!e#9qZ)xR~Em 116 | z69b5de@(8cYLM0*`Z$7pDs))ewk&R)A>$Ea&wKe#`(( 118 | zAd!4mS%ynERZ2OQX|Ea?m`KsXqlF*vaxSo(^R|Z+-fxuDEp=TV8hBnslCGHyMn4KLgIx-8rF$(V`fB_}H;hU`e{S6CV!2-_YyQz#Q5W|b7 121 | z;+vkZjR$aBQq^hz3w(i>@cpy^s^oJx1B0q)HGt07b$xI!2ho^+J+9!Vq-s|H1N8gQ 122 | z8Ib{{lun9sCV`wSrJTW9DP=a}baUQ4xDT&S0${MS%lH(BODS_1tiqtYw(&`N{Cw)+ 123 | z9Dc!phDPR62PYEjt`ux$-L~*vs<`O`8XRB9XIF6?k0kI;zVD|MA5982CjoFaRr@eD 124 | z8mC!_T?%f$)ytew@eW_%=1LYsa$?5l=_N<%o#Y)z#SP9ueyi@oYpa 125 | z48=JS5g$jyGZ8U6aZ45vkK={push;FY96hF6jyi^?_}#$;Z8iC&tI#mYGYC(T1*#v 126 | zF^!{>zhme?iqy&yp2B0eHM^xYN(yjmTraR&8Ad}$)rh7dhOU{k;BLnK6CWk_Thjno 127 | z&tOlC5#TU@*|gp_v;A5dvhv?|0x(Jg%h_zSCurXXv~*ML7pto3?fu)?8`F$`0OHMc 128 | Uu>{dYKL7v#07*qoM6N<$f}dlntpET3 129 | 130 | literal 0 131 | HcmV?d00001 132 | 133 | diff --git a/res/drawable-mdpi/ic_settings_ethernet.png b/res/drawable-mdpi/ic_settings_ethernet.png 134 | new file mode 100644 135 | index 0000000000000000000000000000000000000000..7e5f923402682119d69f855e74e115a48a964afd 136 | GIT binary patch 137 | literal 946 138 | zcmV;j15NyiP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXiB 140 | z0|YKMFI;#400S~fL_t(o!|m74Yg|k1r@h~pe|f!aUnucK}D*?pRIX_F^#pxW+rpooPozUlg!kmx$t<* 142 | zd-t9Dz32Nq-+P9=@qZuHv>!yo3hu@-+7rYGY~vE%t*Yum^JV86K;Mq%u!3{wjR6sP 143 | zU56X758vTG1L)unyn)l0#au2n$ZF($GXb8$lW2_!b}i#?tmdvB#Zh!e#9qZ)xR~Em 144 | z69b5de@(8cYLM0*`Z$7pDs))ewk&R)A>$Ea&wKe#`(( 146 | zAd!4mS%ynERZ2OQX|Ea?m`KsXqlF*vaxSo(^R|Z+-fxuDEp=TV8hBnslCGHyMn4KLgIx-8rF$(V`fB_}H;hU`e{S6CV!2-_YyQz#Q5W|b7 149 | z;+vkZjR$aBQq^hz3w(i>@cpy^s^oJx1B0q)HGt07b$xI!2ho^+J+9!Vq-s|H1N8gQ 150 | z8Ib{{lun9sCV`wSrJTW9DP=a}baUQ4xDT&S0${MS%lH(BODS_1tiqtYw(&`N{Cw)+ 151 | z9Dc!phDPR62PYEjt`ux$-L~*vs<`O`8XRB9XIF6?k0kI;zVD|MA5982CjoFaRr@eD 152 | z8mC!_T?%f$)ytew@eW_%=1LYsa$?5l=_N<%o#Y)z#SP9ueyi@oYpa 153 | z48=JS5g$jyGZ8U6aZ45vkK={push;FY96hF6jyi^?_}#$;Z8iC&tI#mYGYC(T1*#v 154 | zF^!{>zhme?iqy&yp2B0eHM^xYN(yjmTraR&8Ad}$)rh7dhOU{k;BLnK6CWk_Thjno 155 | z&tOlC5#TU@*|gp_v;A5dvhv?|0x(Jg%h_zSCurXXv~*ML7pto3?fu)?8`F$`0OHMc 156 | Uu>{dYKL7v#07*qoM6N<$f}dlntpET3 157 | 158 | literal 0 159 | HcmV?d00001 160 | 161 | diff --git a/res/drawable/ic_settings_ethernet.xml b/res/drawable/ic_settings_ethernet.xml 162 | new file mode 100644 163 | index 0000000..09e9237 164 | --- /dev/null 165 | +++ b/res/drawable/ic_settings_ethernet.xml 166 | @@ -0,0 +1,20 @@ 167 | + 168 | + 182 | + 183 | + 184 | + 185 | + 186 | + 187 | diff --git a/res/drawable/ic_settings_ethernet_img.png b/res/drawable/ic_settings_ethernet_img.png 188 | new file mode 100644 189 | index 0000000000000000000000000000000000000000..7e5f923402682119d69f855e74e115a48a964afd 190 | GIT binary patch 191 | literal 946 192 | zcmV;j15NyiP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXiB 194 | z0|YKMFI;#400S~fL_t(o!|m74Yg|k1r@h~pe|f!aUnucK}D*?pRIX_F^#pxW+rpooPozUlg!kmx$t<* 196 | zd-t9Dz32Nq-+P9=@qZuHv>!yo3hu@-+7rYGY~vE%t*Yum^JV86K;Mq%u!3{wjR6sP 197 | zU56X758vTG1L)unyn)l0#au2n$ZF($GXb8$lW2_!b}i#?tmdvB#Zh!e#9qZ)xR~Em 198 | z69b5de@(8cYLM0*`Z$7pDs))ewk&R)A>$Ea&wKe#`(( 200 | zAd!4mS%ynERZ2OQX|Ea?m`KsXqlF*vaxSo(^R|Z+-fxuDEp=TV8hBnslCGHyMn4KLgIx-8rF$(V`fB_}H;hU`e{S6CV!2-_YyQz#Q5W|b7 203 | z;+vkZjR$aBQq^hz3w(i>@cpy^s^oJx1B0q)HGt07b$xI!2ho^+J+9!Vq-s|H1N8gQ 204 | z8Ib{{lun9sCV`wSrJTW9DP=a}baUQ4xDT&S0${MS%lH(BODS_1tiqtYw(&`N{Cw)+ 205 | z9Dc!phDPR62PYEjt`ux$-L~*vs<`O`8XRB9XIF6?k0kI;zVD|MA5982CjoFaRr@eD 206 | z8mC!_T?%f$)ytew@eW_%=1LYsa$?5l=_N<%o#Y)z#SP9ueyi@oYpa 207 | z48=JS5g$jyGZ8U6aZ45vkK={push;FY96hF6jyi^?_}#$;Z8iC&tI#mYGYC(T1*#v 208 | zF^!{>zhme?iqy&yp2B0eHM^xYN(yjmTraR&8Ad}$)rh7dhOU{k;BLnK6CWk_Thjno 209 | z&tOlC5#TU@*|gp_v;A5dvhv?|0x(Jg%h_zSCurXXv~*ML7pto3?fu)?8`F$`0OHMc 210 | Uu>{dYKL7v#07*qoM6N<$f}dlntpET3 211 | 212 | literal 0 213 | HcmV?d00001 214 | 215 | diff --git a/res/layout/eth_configure.xml b/res/layout/eth_configure.xml 216 | new file mode 100644 217 | index 0000000..331e625 218 | --- /dev/null 219 | +++ b/res/layout/eth_configure.xml 220 | @@ -0,0 +1,112 @@ 221 | + 222 | + 225 | + 226 | + 231 | + 232 | + 237 | + 238 | + 239 | + 240 | + 241 | + 247 | + 248 | + 249 | + 252 | + 253 | + 254 | + 260 | + 264 | + 270 | + 276 | + 277 | + 278 | + 279 | + 284 | + 290 | + 295 | + 301 | + 306 | + 312 | + 317 | + 323 | + 328 | + 329 | + 330 | + 331 | + 332 | + 333 | diff --git a/res/values/strings.xml b/res/values/strings.xml 334 | index 8dfe208..09638cd 100644 335 | --- a/res/values/strings.xml 336 | +++ b/res/values/strings.xml 337 | @@ -375,6 +375,8 @@ 338 | 339 | 340 | Proxy settings 341 | + 342 | + Ethernet proxy settings 343 | 344 | Clear 345 | 346 | @@ -1152,6 +1154,25 @@ 347 | 348 | When this feature is turned on, you can beam app content to another NFC-capable device by holding the devices close together. For example, you can beam Browser pages, YouTube videos, People contacts, and more.\n\nJust bring the devices together (typically back to back) and then touch your screen. The app determines what gets beamed. 349 | 350 | + 351 | + Configure Ethernet device 352 | + Ethernet setting 353 | + Ethernet Devices: 354 | + Connection Type 355 | + DHCP 356 | + Static IP 357 | + DNS address 358 | + Gateway address 359 | + IP address 360 | + Ethernet 361 | + Turn on Ethernet 362 | + Ethernet configuration 363 | + Ethernet configuration 364 | + Configure Ethernet devices 365 | + Netmask 366 | + Turn off Ethernet 367 | + Turn on Ethernet 368 | + 369 | 370 | 371 | Wi-Fi 372 | diff --git a/res/xml/ethernet_settings.xml b/res/xml/ethernet_settings.xml 373 | new file mode 100644 374 | index 0000000..2ac71c1 375 | --- /dev/null 376 | +++ b/res/xml/ethernet_settings.xml 377 | @@ -0,0 +1,32 @@ 378 | + 379 | + 393 | + 394 | + 396 | + 397 | + 403 | + 409 | + 410 | diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml 411 | index 0f4dbb3..f4f1a78 100644 412 | --- a/res/xml/settings_headers.xml 413 | +++ b/res/xml/settings_headers.xml 414 | @@ -57,6 +57,21 @@ 415 | android:fragment="com.android.settings.WirelessSettings" 416 | android:icon="@drawable/empty_icon" /> 417 | 418 | + 419 | +
424 | + 425 | + 426 | +
432 | + 433 | 434 |
435 | 436 | diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java 437 | index c9f5c73..c56e819 100644 438 | --- a/src/com/android/settings/Settings.java 439 | +++ b/src/com/android/settings/Settings.java 440 | @@ -574,6 +574,7 @@ public class Settings extends PreferenceActivity implements ButtonBarHandler { 441 | public static class DateTimeSettingsActivity extends Settings { /* empty */ } 442 | public static class StorageSettingsActivity extends Settings { /* empty */ } 443 | public static class WifiSettingsActivity extends Settings { /* empty */ } 444 | + public static class EthernetSettingsActivity extends Settings { /* empty */ } 445 | public static class WifiP2pSettingsActivity extends Settings { /* empty */ } 446 | public static class InputMethodAndLanguageSettingsActivity extends Settings { /* empty */ } 447 | public static class InputMethodAndSubtypeEnablerActivity extends Settings { /* empty */ } 448 | diff --git a/src/com/android/settings/ethernet/EthernetConfigDialog.java b/src/com/android/settings/ethernet/EthernetConfigDialog.java 449 | new file mode 100644 450 | index 0000000..68b4b2e 451 | --- /dev/null 452 | +++ b/src/com/android/settings/ethernet/EthernetConfigDialog.java 453 | @@ -0,0 +1,216 @@ 454 | +/* Copyright (C) 2010 The Android-x86 Open Source Project 455 | + * 456 | + * Licensed under the Apache License, Version 2.0 (the "License"); 457 | + * you may not use this file except in compliance with the License. 458 | + * You may obtain a copy of the License at 459 | + * 460 | + * http://www.apache.org/licenses/LICENSE-2.0 461 | + * 462 | + * Unless required by applicable law or agreed to in writing, software 463 | + * distributed under the License is distributed on an "AS IS" BASIS, 464 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 465 | + * See the License for the specific language governing permissions and 466 | + * limitations under the License. 467 | + * 468 | + * Author: Yi Sun 469 | + */ 470 | + 471 | +package com.android.settings.ethernet; 472 | + 473 | + 474 | +import java.util.List; 475 | + 476 | +import com.android.settings.R; 477 | + 478 | +import android.app.AlertDialog; 479 | +import android.content.BroadcastReceiver; 480 | +import android.content.Context; 481 | +import android.content.DialogInterface; 482 | +import android.content.Intent; 483 | +import android.net.NetworkInfo; 484 | +import android.net.ethernet.EthernetManager; 485 | +import android.net.ethernet.EthernetDevInfo; 486 | +import android.os.Bundle; 487 | +import android.view.View; 488 | +import android.view.ViewGroup; 489 | +import android.widget.AdapterView; 490 | +import android.widget.ArrayAdapter; 491 | +import android.widget.CheckBox; 492 | +import android.widget.EditText; 493 | +import android.widget.RadioButton; 494 | +import android.widget.RadioGroup; 495 | +import android.widget.Spinner; 496 | +import android.widget.TextView; 497 | +import android.util.Slog; 498 | + 499 | +public class EthernetConfigDialog extends AlertDialog implements 500 | + DialogInterface.OnClickListener, AdapterView.OnItemSelectedListener, View.OnClickListener { 501 | + private final String TAG = "EtherenetSettings"; 502 | + private static final boolean localLOGV = true; 503 | + 504 | + private EthernetEnabler mEthEnabler; 505 | + private View mView; 506 | + private Spinner mDevList; 507 | + private TextView mDevs; 508 | + private RadioButton mConTypeDhcp; 509 | + private RadioButton mConTypeManual; 510 | + private EditText mIpaddr; 511 | + private EditText mDns; 512 | + private EditText mGw; 513 | + private EditText mMask; 514 | + 515 | + private EthernetLayer mEthLayer; 516 | + private EthernetManager mEthManager; 517 | + private EthernetDevInfo mEthInfo; 518 | + private boolean mEnablePending; 519 | + 520 | + public EthernetConfigDialog(Context context, EthernetEnabler Enabler) { 521 | + super(context); 522 | + mEthLayer = new EthernetLayer(this); 523 | + mEthEnabler = Enabler; 524 | + mEthManager=Enabler.getManager(); 525 | + buildDialogContent(context); 526 | + } 527 | + 528 | + public int buildDialogContent(Context context) { 529 | + this.setTitle(R.string.eth_config_title); 530 | + this.setView(mView = getLayoutInflater().inflate(R.layout.eth_configure, null)); 531 | + mDevs = (TextView) mView.findViewById(R.id.eth_dev_list_text); 532 | + mDevList = (Spinner) mView.findViewById(R.id.eth_dev_spinner); 533 | + mConTypeDhcp = (RadioButton) mView.findViewById(R.id.dhcp_radio); 534 | + mConTypeManual = (RadioButton) mView.findViewById(R.id.manual_radio); 535 | + mIpaddr = (EditText)mView.findViewById(R.id.ipaddr_edit); 536 | + mMask = (EditText)mView.findViewById(R.id.netmask_edit); 537 | + mDns = (EditText)mView.findViewById(R.id.eth_dns_edit); 538 | + mGw = (EditText)mView.findViewById(R.id.eth_gw_edit); 539 | + 540 | + mConTypeDhcp.setChecked(true); 541 | + mConTypeManual.setChecked(false); 542 | + mIpaddr.setEnabled(false); 543 | + mMask.setEnabled(false); 544 | + mDns.setEnabled(false); 545 | + mGw.setEnabled(false); 546 | + mConTypeManual.setOnClickListener(new RadioButton.OnClickListener() { 547 | + public void onClick(View v) { 548 | + mIpaddr.setEnabled(true); 549 | + mDns.setEnabled(true); 550 | + mGw.setEnabled(true); 551 | + mMask.setEnabled(true); 552 | + } 553 | + }); 554 | + 555 | + mConTypeDhcp.setOnClickListener(new RadioButton.OnClickListener() { 556 | + public void onClick(View v) { 557 | + mIpaddr.setEnabled(false); 558 | + mDns.setEnabled(false); 559 | + mGw.setEnabled(false); 560 | + mMask.setEnabled(false); 561 | + } 562 | + }); 563 | + 564 | + this.setInverseBackgroundForced(true); 565 | + this.setButton(BUTTON_POSITIVE, context.getText(R.string.menu_save), this); 566 | + this.setButton(BUTTON_NEGATIVE, context.getText(R.string.menu_cancel), this); 567 | + String[] Devs = mEthEnabler.getManager().getDeviceNameList(); 568 | + if (Devs != null) { 569 | + if (localLOGV) 570 | + Slog.v(TAG, "found device: " + Devs[0]); 571 | + updateDevNameList(Devs); 572 | + if (mEthManager.isConfigured()) { 573 | + mEthInfo = mEthManager.getSavedConfig(); 574 | + for (int i = 0 ; i < Devs.length; i++) { 575 | + if (Devs[i].equals(mEthInfo.getIfName())) { 576 | + mDevList.setSelection(i); 577 | + break; 578 | + } 579 | + } 580 | + mIpaddr.setText(mEthInfo.getIpAddress()); 581 | + mGw.setText(mEthInfo.getRouteAddr()); 582 | + mDns.setText(mEthInfo.getDnsAddr()); 583 | + mMask.setText(mEthInfo.getNetMask()); 584 | + if (mEthInfo.getConnectMode().equals(EthernetDevInfo.ETHERNET_CONN_MODE_DHCP)) { 585 | + mIpaddr.setEnabled(false); 586 | + mDns.setEnabled(false); 587 | + mGw.setEnabled(false); 588 | + mMask.setEnabled(false); 589 | + } else { 590 | + mConTypeDhcp.setChecked(false); 591 | + mConTypeManual.setChecked(true); 592 | + mIpaddr.setEnabled(true); 593 | + mDns.setEnabled(true); 594 | + mGw.setEnabled(true); 595 | + mMask.setEnabled(true); 596 | + } 597 | + } 598 | + } 599 | + return 0; 600 | + } 601 | + 602 | + private void handle_saveconf() { 603 | + EthernetDevInfo info = new EthernetDevInfo(); 604 | + info.setIfName(mDevList.getSelectedItem().toString()); 605 | + if (localLOGV) 606 | + Slog.v(TAG, "Config device for " + mDevList.getSelectedItem().toString()); 607 | + if (mConTypeDhcp.isChecked()) { 608 | + Slog.v(TAG, "Config device for DHCP "); 609 | + info.setConnectMode(EthernetDevInfo.ETHERNET_CONN_MODE_DHCP); 610 | + info.setIpAddress(null); 611 | + info.setRouteAddr(null); 612 | + info.setDnsAddr(null); 613 | + info.setNetMask(null); 614 | + } else { 615 | + Slog.v(TAG, "Config device for static " + mIpaddr.getText().toString() + mGw.getText().toString() + mDns.getText().toString() + mMask.getText().toString()); 616 | + info.setConnectMode(EthernetDevInfo.ETHERNET_CONN_MODE_MANUAL); 617 | + info.setIpAddress(mIpaddr.getText().toString()); 618 | + info.setRouteAddr(mGw.getText().toString()); 619 | + info.setDnsAddr(mDns.getText().toString()); 620 | + info.setNetMask(mMask.getText().toString()); 621 | + } 622 | + mEthManager.updateDevInfo(info); 623 | + if (mEnablePending) { 624 | + mEthManager.setEnabled(true); 625 | + mEnablePending = false; 626 | + } 627 | + } 628 | + 629 | + public void onClick(DialogInterface dialog, int which) { 630 | + switch (which) { 631 | + case BUTTON_POSITIVE: 632 | + handle_saveconf(); 633 | + break; 634 | + case BUTTON_NEGATIVE: 635 | + //Don't need to do anything 636 | + break; 637 | + default: 638 | + Slog.e(TAG,"Unknow button"); 639 | + } 640 | + } 641 | + 642 | + public void onItemSelected(AdapterView parent, View view, int position, long id) { 643 | + 644 | + } 645 | + 646 | + public void onNothingSelected(AdapterView parent) { 647 | + 648 | + } 649 | + 650 | + public void onClick(View v) { 651 | + 652 | + } 653 | + 654 | + public void updateDevNameList(String[] DevList) { 655 | + if (DevList != null) { 656 | + ArrayAdapter adapter = new ArrayAdapter( 657 | + getContext(), android.R.layout.simple_spinner_item, DevList); 658 | + adapter.setDropDownViewResource( 659 | + android.R.layout.simple_spinner_dropdown_item); 660 | + mDevList.setAdapter(adapter); 661 | + } 662 | + 663 | + } 664 | + 665 | + public void enableAfterConfig() { 666 | + mEnablePending = true; 667 | + } 668 | +} 669 | + 670 | diff --git a/src/com/android/settings/ethernet/EthernetEnabler.java b/src/com/android/settings/ethernet/EthernetEnabler.java 671 | new file mode 100644 672 | index 0000000..8621e7f 673 | --- /dev/null 674 | +++ b/src/com/android/settings/ethernet/EthernetEnabler.java 675 | @@ -0,0 +1,172 @@ 676 | +/* Copyright (C) 2010 The Android-x86 Open Source Project 677 | + * 678 | + * Licensed under the Apache License, Version 2.0 (the "License"); 679 | + * you may not use this file except in compliance with the License. 680 | + * You may obtain a copy of the License at 681 | + * 682 | + * http://www.apache.org/licenses/LICENSE-2.0 683 | + * 684 | + * Unless required by applicable law or agreed to in writing, software 685 | + * distributed under the License is distributed on an "AS IS" BASIS, 686 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 687 | + * See the License for the specific language governing permissions and 688 | + * limitations under the License. 689 | + * 690 | + * Author: Yi Sun 691 | + */ 692 | + 693 | +package com.android.settings.ethernet; 694 | + 695 | + 696 | +import static android.net.ethernet.EthernetManager.ETHERNET_STATE_DISABLED; 697 | +import static android.net.ethernet.EthernetManager.ETHERNET_STATE_ENABLED; 698 | +import static android.net.ethernet.EthernetManager.ETHERNET_STATE_UNKNOWN; 699 | + 700 | +import com.android.settings.R; 701 | + 702 | +import android.content.BroadcastReceiver; 703 | +import android.content.Context; 704 | +import android.content.Intent; 705 | +import android.content.IntentFilter; 706 | +import android.net.NetworkInfo; 707 | +import android.net.ethernet.EthernetManager; 708 | +import android.preference.Preference; 709 | +import android.preference.CheckBoxPreference; 710 | +import android.text.TextUtils; 711 | +import android.util.Config; 712 | +import android.util.Slog; 713 | +import android.widget.Switch; 714 | + 715 | +public class EthernetEnabler implements Preference.OnPreferenceChangeListener { 716 | + private static final String TAG = "EthenetEnabler"; 717 | + 718 | + private static final boolean LOCAL_LOGD = true; 719 | + //private final IntentFilter mEthStateFilter; 720 | + private Context mContext; 721 | + private EthernetManager mEthManager; 722 | + private CheckBoxPreference mEthCheckBoxPref; 723 | + private final CharSequence mOriginalSummary; 724 | + private EthernetConfigDialog mEthConfigDialog; 725 | + 726 | + private final BroadcastReceiver mEthStateReceiver = new BroadcastReceiver() { 727 | + @Override 728 | + public void onReceive(Context context, Intent intent) { 729 | + if (intent.getAction().equals(EthernetManager.ETHERNET_STATE_CHANGED_ACTION)) { 730 | + handleEthStateChanged( 731 | + intent.getIntExtra(EthernetManager.EXTRA_ETHERNET_STATE, 732 | + EthernetManager.ETHERNET_STATE_UNKNOWN), 733 | + intent.getIntExtra(EthernetManager.EXTRA_PREVIOUS_ETHERNET_STATE, 734 | + EthernetManager.ETHERNET_STATE_UNKNOWN)); 735 | + } else if (intent.getAction().equals(EthernetManager.NETWORK_STATE_CHANGED_ACTION)) { 736 | + handleNetworkStateChanged( 737 | + (NetworkInfo) intent.getParcelableExtra(EthernetManager.EXTRA_NETWORK_INFO)); 738 | + } 739 | + } 740 | + }; 741 | + 742 | + public void setConfigDialog (EthernetConfigDialog Dialog) { 743 | + mEthConfigDialog = Dialog; 744 | + } 745 | + 746 | + public EthernetEnabler(EthernetManager ethernetManager, CheckBoxPreference ethernetCheckBoxPreference) { 747 | + mEthCheckBoxPref = ethernetCheckBoxPreference; 748 | + mEthManager = ethernetManager; 749 | + 750 | + mOriginalSummary = ethernetCheckBoxPreference.getSummary(); 751 | + ethernetCheckBoxPreference.setPersistent(false); 752 | + if (mEthManager.getState() == ETHERNET_STATE_ENABLED) { 753 | + mEthCheckBoxPref.setChecked(true); 754 | + } 755 | + 756 | + /* 757 | + mEthStateFilter = new IntentFilter(EthernetManager.ETHERNET_STATE_CHANGED_ACTION); 758 | + mEthStateFilter.addAction(EthernetManager.NETWORK_STATE_CHANGED_ACTION); 759 | + */ 760 | + } 761 | + 762 | + public EthernetManager getManager() { 763 | + return mEthManager; 764 | + } 765 | + 766 | + public void resume() { 767 | + mEthCheckBoxPref.setOnPreferenceChangeListener(this); 768 | + } 769 | + 770 | + public void pause() { 771 | + // mContext.unregisterReceiver(mEthStateReceiver); 772 | + mEthCheckBoxPref.setOnPreferenceChangeListener(null); 773 | + } 774 | + 775 | + public boolean onPreferenceChange(Preference preference, Object newValue) { 776 | + setEthEnabled((Boolean)newValue); 777 | + return false; 778 | + } 779 | + 780 | + private void setEthEnabled(final boolean enable) { 781 | + 782 | + int state = mEthManager.getState(); 783 | + 784 | + Slog.i(TAG,"Show configuration dialog " + enable + state); 785 | + // Disable button 786 | + mEthCheckBoxPref.setEnabled(false); 787 | + 788 | + if (state != ETHERNET_STATE_ENABLED && enable) { 789 | + if (mEthManager.isConfigured() != true) { 790 | + // Now, kick off the setting dialog to get the configurations 791 | + mEthConfigDialog.enableAfterConfig(); 792 | + mEthConfigDialog.show(); 793 | + } else { 794 | + mEthManager.setEnabled(enable); 795 | + } 796 | + } else { 797 | + mEthManager.setEnabled(enable); 798 | + } 799 | + 800 | + mEthCheckBoxPref.setChecked(enable); 801 | + // Disable button 802 | + mEthCheckBoxPref.setEnabled(true); 803 | + } 804 | + 805 | + private void handleEthStateChanged(int ethState, int previousEthState) { 806 | + 807 | + } 808 | + 809 | + private void handleNetworkStateChanged(NetworkInfo networkInfo) { 810 | + if (LOCAL_LOGD) { 811 | + Slog.d(TAG, "Received network state changed to " + networkInfo); 812 | + } 813 | + } 814 | + 815 | + private boolean isEnabledByDependency() { 816 | + Preference dep = getDependencyPreference(); 817 | + if (dep == null) { 818 | + return true; 819 | + } 820 | + 821 | + 822 | + return !dep.shouldDisableDependents(); 823 | + } 824 | + 825 | + private Preference getDependencyPreference() { 826 | + String depKey = mEthCheckBoxPref.getDependency(); 827 | + if (TextUtils.isEmpty(depKey)) { 828 | + return null; 829 | + } 830 | + 831 | + return mEthCheckBoxPref.getPreferenceManager().findPreference(depKey); 832 | + } 833 | + 834 | + private static String getHumanReadableEthState(int wifiState) { 835 | + switch (wifiState) { 836 | + case ETHERNET_STATE_DISABLED: 837 | + return "Disabled"; 838 | + case ETHERNET_STATE_ENABLED: 839 | + return "Enabled"; 840 | + case ETHERNET_STATE_UNKNOWN: 841 | + return "Unknown"; 842 | + default: 843 | + return "Some other state!"; 844 | + } 845 | + } 846 | +} 847 | + 848 | diff --git a/src/com/android/settings/ethernet/EthernetLayer.java b/src/com/android/settings/ethernet/EthernetLayer.java 849 | new file mode 100644 850 | index 0000000..635d39f 851 | --- /dev/null 852 | +++ b/src/com/android/settings/ethernet/EthernetLayer.java 853 | @@ -0,0 +1,68 @@ 854 | +/* Copyright (C) 2010 The Android-x86 Open Source Project 855 | + * 856 | + * Licensed under the Apache License, Version 2.0 (the "License"); 857 | + * you may not use this file except in compliance with the License. 858 | + * You may obtain a copy of the License at 859 | + * 860 | + * http://www.apache.org/licenses/LICENSE-2.0 861 | + * 862 | + * Unless required by applicable law or agreed to in writing, software 863 | + * distributed under the License is distributed on an "AS IS" BASIS, 864 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 865 | + * See the License for the specific language governing permissions and 866 | + * limitations under the License. 867 | + * 868 | + * Author: Yi Sun 869 | + */ 870 | + 871 | +package com.android.settings.ethernet; 872 | + 873 | +import static android.net.ethernet.EthernetManager.ETHERNET_DEVICE_SCAN_RESULT_READY; 874 | + 875 | +import com.android.settings.R; 876 | +import android.content.BroadcastReceiver; 877 | +import android.content.Context; 878 | +import android.content.Intent; 879 | +import android.content.IntentFilter; 880 | +import android.net.NetworkInfo; 881 | +import android.net.NetworkInfo.DetailedState; 882 | +import android.net.NetworkInfo.State; 883 | +import android.net.ethernet.EthernetManager; 884 | +import android.os.Handler; 885 | +import android.os.Message; 886 | +import android.provider.Settings; 887 | +import android.text.TextUtils; 888 | +import android.util.Config; 889 | + 890 | +import java.util.ArrayList; 891 | +import java.util.Collections; 892 | +import java.util.Comparator; 893 | +import java.util.List; 894 | + 895 | +public class EthernetLayer { 896 | + private static final String TAG = "EthernetLayer"; 897 | + 898 | + private EthernetManager mEthManager; 899 | + private String[] mDevList; 900 | + private EthernetConfigDialog mDialog; 901 | + 902 | + EthernetLayer (EthernetConfigDialog configdialog) { 903 | + mDialog = configdialog; 904 | + } 905 | + 906 | + private BroadcastReceiver mReceiver = new BroadcastReceiver() { 907 | + @Override 908 | + public void onReceive(Context context, Intent intent) { 909 | + final String action = intent.getAction(); 910 | + if (action.equals(EthernetManager.ETHERNET_DEVICE_SCAN_RESULT_READY)) { 911 | + handleDevListChanges(); 912 | + } 913 | + } 914 | + }; 915 | + 916 | + private void handleDevListChanges() { 917 | + mDevList = mEthManager.getDeviceNameList(); 918 | + mDialog.updateDevNameList(mDevList); 919 | + } 920 | +} 921 | + 922 | diff --git a/src/com/android/settings/ethernet/EthernetSettings.java b/src/com/android/settings/ethernet/EthernetSettings.java 923 | new file mode 100644 924 | index 0000000..33ee2e3 925 | --- /dev/null 926 | +++ b/src/com/android/settings/ethernet/EthernetSettings.java 927 | @@ -0,0 +1,93 @@ 928 | +/* 929 | + * Copyright (C) 2010 The Android-x86 Open Source Project 930 | + * 931 | + * Licensed under the Apache License, Version 2.0 (the "License"); 932 | + * you may not use this file except in compliance with the License. 933 | + * You may obtain a copy of the License at 934 | + * 935 | + * http://www.apache.org/licenses/LICENSE-2.0 936 | + * 937 | + * Unless required by applicable law or agreed to in writing, software 938 | + * distributed under the License is distributed on an "AS IS" BASIS, 939 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 940 | + * See the License for the specific language governing permissions and 941 | + * limitations under the License. 942 | + * 943 | + * Author: Yi Sun 944 | + */ 945 | + 946 | +package com.android.settings.ethernet; 947 | + 948 | +import com.android.settings.R; 949 | +import com.android.settings.SettingsPreferenceFragment; 950 | + 951 | +import android.app.Activity; 952 | +import android.content.Context; 953 | +import android.net.ethernet.EthernetManager; 954 | +import android.content.DialogInterface; 955 | +import android.os.Bundle; 956 | +import android.preference.CheckBoxPreference; 957 | +import android.preference.Preference; 958 | +import android.preference.PreferenceActivity; 959 | +import android.preference.PreferenceScreen; 960 | +import android.widget.Switch; 961 | +import android.util.Log; 962 | + 963 | +public class EthernetSettings extends SettingsPreferenceFragment { 964 | + private static final String LOG_TAG = "EthernetSetting"; 965 | + private static final String KEY_TOGGLE_ETH = "toggle_eth"; 966 | + private static final String KEY_CONF_ETH = "ETHERNET_config"; 967 | + 968 | + private EthernetEnabler mEthEnabler; 969 | + private EthernetConfigDialog mEthConfigDialog; 970 | + private Preference mEthConfigPref; 971 | + 972 | + @Override 973 | + public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { 974 | + super.onPreferenceTreeClick(preferenceScreen, preference); 975 | + 976 | + if (preference == mEthConfigPref) { 977 | + mEthConfigDialog.show(); 978 | + } 979 | + return false; 980 | + } 981 | + 982 | + @Override 983 | + public void onCreate(Bundle savedInstanceState) { 984 | + super.onCreate(savedInstanceState); 985 | + 986 | + addPreferencesFromResource(R.xml.ethernet_settings); 987 | + 988 | + final Activity activity = getActivity(); 989 | + Switch actionBarSwitch = new Switch(activity); 990 | + CheckBoxPreference ethernet = (CheckBoxPreference) findPreference(KEY_TOGGLE_ETH); 991 | + 992 | + final PreferenceScreen preferenceScreen = getPreferenceScreen(); 993 | + mEthConfigPref = preferenceScreen.findPreference(KEY_CONF_ETH); 994 | + /* 995 | + * TO DO: 996 | + * Add new perference screen for Etherenet Configuration 997 | + */ 998 | + 999 | + initToggles(); 1000 | + } 1001 | + 1002 | + @Override 1003 | + public void onResume() { 1004 | + super.onResume(); 1005 | + mEthEnabler.resume(); 1006 | + } 1007 | + 1008 | + @Override 1009 | + public void onPause() { 1010 | + super.onPause(); 1011 | + mEthEnabler.pause(); 1012 | + } 1013 | + 1014 | + private void initToggles() { 1015 | + mEthEnabler = new EthernetEnabler((EthernetManager) getSystemService(Context.ETHERNET_SERVICE), (CheckBoxPreference) findPreference(KEY_TOGGLE_ETH)); 1016 | + mEthConfigDialog = new EthernetConfigDialog(getActivity(), mEthEnabler); 1017 | + mEthEnabler.setConfigDialog(mEthConfigDialog); 1018 | + } 1019 | +} 1020 | + 1021 | -- 1022 | 1.7.4.1 1023 | 1024 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0003-use-white-color-for-ethernet-text-items.patch: -------------------------------------------------------------------------------- 1 | From 09f0921ca38605f3c46b344a1633e5c08a5f3e21 Mon Sep 17 00:00:00 2001 2 | From: Benjamin Zores 3 | Date: Wed, 20 Jun 2012 17:09:55 +0200 4 | Subject: [PATCH 03/19] use white color for ethernet text items 5 | 6 | --- 7 | res/layout/eth_configure.xml | 16 ++++++++-------- 8 | 1 files changed, 8 insertions(+), 8 deletions(-) 9 | 10 | diff --git a/res/layout/eth_configure.xml b/res/layout/eth_configure.xml 11 | index 331e625..c8f4c3e 100644 12 | --- a/res/layout/eth_configure.xml 13 | +++ b/res/layout/eth_configure.xml 14 | @@ -19,7 +19,7 @@ 15 | 16 | 17 | 26 | 35 | 42 | 51 | 60 | 69 | 78 | 3 | Date: Thu, 12 Jul 2012 13:37:47 +0200 4 | Subject: [PATCH 07/19] Defining eth0 as default choice for Ethernet connection 5 | 6 | --- 7 | .../settings/ethernet/EthernetConfigDialog.java | 8 ++++++++ 8 | 1 files changed, 8 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/src/com/android/settings/ethernet/EthernetConfigDialog.java b/src/com/android/settings/ethernet/EthernetConfigDialog.java 11 | index 68b4b2e..7c1edd7 100644 12 | --- a/src/com/android/settings/ethernet/EthernetConfigDialog.java 13 | +++ b/src/com/android/settings/ethernet/EthernetConfigDialog.java 14 | @@ -142,6 +142,14 @@ public class EthernetConfigDialog extends AlertDialog implements 15 | mMask.setEnabled(true); 16 | } 17 | } 18 | + else { 19 | + for (int i = 0 ; i < Devs.length; i++) { 20 | + if (Devs[i].equals("eth0")) { 21 | + mDevList.setSelection(i); 22 | + break; 23 | + } 24 | + } 25 | + } 26 | } 27 | return 0; 28 | } 29 | -- 30 | 1.7.4.1 31 | 32 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0008-Changing-one-typo-error-in-Ethernet-Settings.patch: -------------------------------------------------------------------------------- 1 | From 98d5efbdd0c52be523376004d2c8d93268844b36 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Thu, 12 Jul 2012 13:41:46 +0200 4 | Subject: [PATCH 08/19] Changing one typo error in Ethernet Settings 5 | 6 | --- 7 | .../settings/ethernet/EthernetConfigDialog.java | 2 +- 8 | .../settings/ethernet/EthernetSettings.java | 2 +- 9 | 2 files changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/src/com/android/settings/ethernet/EthernetConfigDialog.java b/src/com/android/settings/ethernet/EthernetConfigDialog.java 12 | index 7c1edd7..f6154bc 100644 13 | --- a/src/com/android/settings/ethernet/EthernetConfigDialog.java 14 | +++ b/src/com/android/settings/ethernet/EthernetConfigDialog.java 15 | @@ -45,7 +45,7 @@ import android.util.Slog; 16 | 17 | public class EthernetConfigDialog extends AlertDialog implements 18 | DialogInterface.OnClickListener, AdapterView.OnItemSelectedListener, View.OnClickListener { 19 | - private final String TAG = "EtherenetSettings"; 20 | + private final String TAG = "EthernetSettings"; 21 | private static final boolean localLOGV = true; 22 | 23 | private EthernetEnabler mEthEnabler; 24 | diff --git a/src/com/android/settings/ethernet/EthernetSettings.java b/src/com/android/settings/ethernet/EthernetSettings.java 25 | index 33ee2e3..015934a 100644 26 | --- a/src/com/android/settings/ethernet/EthernetSettings.java 27 | +++ b/src/com/android/settings/ethernet/EthernetSettings.java 28 | @@ -66,7 +66,7 @@ public class EthernetSettings extends SettingsPreferenceFragment { 29 | mEthConfigPref = preferenceScreen.findPreference(KEY_CONF_ETH); 30 | /* 31 | * TO DO: 32 | - * Add new perference screen for Etherenet Configuration 33 | + * Add new perference screen for Ethernet Configuration 34 | */ 35 | 36 | initToggles(); 37 | -- 38 | 1.7.4.1 39 | 40 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0009-adding-two-new-fields-in-order-to-display-Ethernet-I.patch: -------------------------------------------------------------------------------- 1 | From cd7c43fef72d6ea1e52da3ece00e667bad934250 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 10:50:43 +0200 4 | Subject: [PATCH 09/19] adding two new fields in order to display Ethernet IP and MAC address 5 | 6 | --- 7 | res/values/strings.xml | 9 +++++++-- 8 | res/xml/device_info_status.xml | 12 +++++++++++- 9 | 2 files changed, 18 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/res/values/strings.xml b/res/values/strings.xml 12 | index 09638cd..982a84d 100644 13 | --- a/res/values/strings.xml 14 | +++ b/res/values/strings.xml 15 | @@ -1357,10 +1357,13 @@ 16 | 17 | There was a problem setting the frequency band. 18 | 19 | - MAC address 20 | + Wi-Fi MAC address 21 | 22 | 23 | - IP address 24 | + Wi-Fi IP address 25 | + 26 | + 27 | + Ethernet IP address 28 | 29 | 30 | IP settings 31 | @@ -1870,6 +1873,8 @@ 32 | Network 33 | 34 | Wi-Fi MAC address 35 | + 36 | + Ethernet MAC address 37 | 38 | Bluetooth address 39 | 40 | diff --git a/res/xml/device_info_status.xml b/res/xml/device_info_status.xml 41 | index aaa90a9..0c7b7b7 100644 42 | --- a/res/xml/device_info_status.xml 43 | +++ b/res/xml/device_info_status.xml 44 | @@ -105,7 +105,17 @@ 45 | android:title="@string/status_wifi_mac_address" 46 | android:summary="@string/device_info_not_available" 47 | android:persistent="false" /> 48 | - 54 | + 59 | + 3 | Date: Fri, 3 Aug 2012 10:52:15 +0200 4 | Subject: [PATCH 10/19] adding code to retrieve Ethernet IP and MAC address 5 | 6 | --- 7 | src/com/android/settings/deviceinfo/Status.java | 39 +++++++++++++++++++++++ 8 | 1 files changed, 39 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java 11 | index c315acd..82a68a2 100644 12 | --- a/src/com/android/settings/deviceinfo/Status.java 13 | +++ b/src/com/android/settings/deviceinfo/Status.java 14 | @@ -26,6 +26,8 @@ import android.net.ConnectivityManager; 15 | import android.net.NetworkInfo; 16 | import android.net.wifi.WifiInfo; 17 | import android.net.wifi.WifiManager; 18 | +import android.net.ethernet.EthernetDevInfo; 19 | +import android.net.ethernet.EthernetManager; 20 | import android.os.BatteryManager; 21 | import android.os.Build; 22 | import android.os.Bundle; 23 | @@ -41,6 +43,7 @@ import android.telephony.PhoneStateListener; 24 | import android.telephony.ServiceState; 25 | import android.telephony.TelephonyManager; 26 | import android.text.TextUtils; 27 | +import android.util.Log; 28 | 29 | import com.android.internal.telephony.Phone; 30 | import com.android.internal.telephony.PhoneFactory; 31 | @@ -82,6 +85,8 @@ public class Status extends PreferenceActivity { 32 | private static final String KEY_BATTERY_STATUS = "battery_status"; 33 | private static final String KEY_BATTERY_LEVEL = "battery_level"; 34 | private static final String KEY_IP_ADDRESS = "wifi_ip_address"; 35 | + private static final String KEY_ETHERNET_IP_ADDRESS = "ethernet_ip_address"; 36 | + private static final String KEY_ETHERNET_MAC_ADDRESS = "ethernet_mac_address"; 37 | private static final String KEY_WIFI_MAC_ADDRESS = "wifi_mac_address"; 38 | private static final String KEY_BT_ADDRESS = "bt_address"; 39 | private static final String KEY_SERIAL_NUMBER = "serial_number"; 40 | @@ -108,6 +113,8 @@ public class Status extends PreferenceActivity { 41 | 42 | private static final int EVENT_UPDATE_STATS = 500; 43 | 44 | + private static final String TAG = "StatusSettings"; 45 | + 46 | private TelephonyManager mTelephonyManager; 47 | private Phone mPhone = null; 48 | private PhoneStateIntentReceiver mPhoneStateReceiver; 49 | @@ -255,6 +262,8 @@ public class Status extends PreferenceActivity { 50 | setWifiStatus(); 51 | setBtStatus(); 52 | setIpAddressStatus(); 53 | + setEthernetIpAddressStatus(); 54 | + setEthernetMacAddress(); 55 | 56 | String serial = Build.SERIAL; 57 | if (serial != null && !serial.equals("")) { 58 | @@ -439,6 +448,36 @@ public class Status extends PreferenceActivity { 59 | : getString(R.string.status_unavailable)); 60 | } 61 | 62 | + private void setEthernetMacAddress() { 63 | + EthernetManager ethernetManager = (EthernetManager) getSystemService(ETHERNET_SERVICE); 64 | + EthernetDevInfo ethernetInfo = ethernetManager.getSavedConfig(); 65 | + 66 | + Preference ethernetMacAddressPref = findPreference(KEY_ETHERNET_MAC_ADDRESS); 67 | + 68 | + String macAddress = ethernetInfo == null ? null : ethernetInfo.getMacAddress(); 69 | + Log.e(TAG, "Mac address is " + ethernetInfo.getMacAddress()); 70 | + ethernetMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress 71 | + : getString(R.string.status_unavailable)); 72 | + } 73 | + 74 | + private void setEthernetIpAddressStatus() { 75 | + EthernetManager ethernetManager = (EthernetManager) getSystemService(ETHERNET_SERVICE); 76 | + EthernetDevInfo ethernetInfo = ethernetManager.getSavedConfig(); 77 | + 78 | + Preference ethernetIpAddressPref = findPreference(KEY_ETHERNET_IP_ADDRESS); 79 | + 80 | + String ipAddress = null; 81 | + if (ethernetInfo != null) { 82 | + if (ethernetInfo.getIpAddress() != null) 83 | + ipAddress = ethernetInfo.getIpAddress(); 84 | + else 85 | + ipAddress = SystemProperties.get("dhcp.eth0.ipaddress"); 86 | + } 87 | + 88 | + ethernetIpAddressPref.setSummary(!TextUtils.isEmpty(ipAddress) ? ipAddress 89 | + : getString(R.string.status_unavailable)); 90 | + } 91 | + 92 | private void setIpAddressStatus() { 93 | Preference ipAddressPref = findPreference(KEY_IP_ADDRESS); 94 | String ipAddress = Utils.getDefaultIpAddresses(this); 95 | -- 96 | 1.7.4.1 97 | 98 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0011-putting-correctly-Ethernet-Config-and-Proxy-Config-n.patch: -------------------------------------------------------------------------------- 1 | From fb36e305dc9a89a4349eaf3cc715a0de49dd6aa6 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Fri, 3 Aug 2012 16:18:17 +0200 4 | Subject: [PATCH 11/19] putting correctly Ethernet Config and Proxy Config nodes in settings tree 5 | 6 | --- 7 | res/xml/settings_headers.xml | 30 +++++++++++++++--------------- 8 | 1 files changed, 15 insertions(+), 15 deletions(-) 9 | 10 | diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml 11 | index e20438b..3a3fa90 100644 12 | --- a/res/xml/settings_headers.xml 13 | +++ b/res/xml/settings_headers.xml 14 | @@ -21,6 +21,21 @@ 15 | 16 |
17 | 18 | + 19 | +
24 | + 25 | + 26 | +
32 | + 33 | 34 |
39 | 40 | - 41 | -
46 | - 47 | - 48 | -
54 | - 55 | 56 |
57 | 58 | -- 59 | 1.7.4.1 60 | 61 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0012-adding-new-screen-for-NTP-server-configuration.patch: -------------------------------------------------------------------------------- 1 | From 2cb13663142601f3ac6461f21ee7f9be1e61f37e Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:26:39 +0200 4 | Subject: [PATCH 12/19] adding new screen for NTP server configuration 5 | 6 | --- 7 | res/values/strings.xml | 2 ++ 8 | res/xml/date_time_prefs.xml | 6 ++++++ 9 | src/com/android/settings/DateTimeSettings.java | 20 ++++++++++++++++++++ 10 | 3 files changed, 28 insertions(+), 0 deletions(-) 11 | 12 | diff --git a/res/values/strings.xml b/res/values/strings.xml 13 | index 982a84d..46f8b03 100644 14 | --- a/res/values/strings.xml 15 | +++ b/res/values/strings.xml 16 | @@ -624,6 +624,8 @@ 17 | Select time zone 18 | 19 | Set date 20 | + 21 | + NTP server 22 | 23 | Select date format 24 | 25 | diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml 26 | index 657d6b3..35abd7e 100644 27 | --- a/res/xml/date_time_prefs.xml 28 | +++ b/res/xml/date_time_prefs.xml 29 | @@ -34,6 +34,12 @@ 30 | android:title="@string/date_time_set_time" 31 | android:summary="12:00am" 32 | /> 33 | + 39 | 3 | Date: Mon, 3 Sep 2012 11:13:26 +0200 4 | Subject: [PATCH 18/19] adding support for ethernet stats in NetworkPolicyEditor 5 | 6 | --- 7 | .../android/settings/net/NetworkPolicyEditor.java | 7 +++++++ 8 | 1 files changed, 7 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/src/com/android/settings/net/NetworkPolicyEditor.java b/src/com/android/settings/net/NetworkPolicyEditor.java 11 | index 5ba8ca4..9e54c76 100644 12 | --- a/src/com/android/settings/net/NetworkPolicyEditor.java 13 | +++ b/src/com/android/settings/net/NetworkPolicyEditor.java 14 | @@ -22,6 +22,7 @@ import static android.net.NetworkPolicy.WARNING_DISABLED; 15 | import static android.net.NetworkTemplate.MATCH_MOBILE_3G_LOWER; 16 | import static android.net.NetworkTemplate.MATCH_MOBILE_4G; 17 | import static android.net.NetworkTemplate.MATCH_WIFI; 18 | +import static android.net.NetworkTemplate.MATCH_ETHERNET; 19 | import static android.net.NetworkTemplate.buildTemplateMobile3gLower; 20 | import static android.net.NetworkTemplate.buildTemplateMobile4g; 21 | import static android.net.NetworkTemplate.buildTemplateMobileAll; 22 | @@ -84,6 +85,12 @@ public class NetworkPolicyEditor { 23 | continue; 24 | } 25 | 26 | + // drop any ETHERNET policies that were defined 27 | + if (policy.template.getMatchRule() == MATCH_ETHERNET) { 28 | + modified = true; 29 | + continue; 30 | + } 31 | + 32 | mPolicies.add(policy); 33 | } 34 | 35 | -- 36 | 1.7.4.1 37 | 38 | -------------------------------------------------------------------------------- /ics/packages/apps/Settings/0019-modifying-DataUsageSummary-screen-for-ethernet-stati.patch: -------------------------------------------------------------------------------- 1 | From 181f467791f9af46c2f5bb519163d13001500955 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Mon, 3 Sep 2012 11:14:50 +0200 4 | Subject: [PATCH 19/19] modifying DataUsageSummary screen for ethernet statistics 5 | 6 | --- 7 | res/layout/data_usage_chart.xml | 1 + 8 | src/com/android/settings/DataUsageSummary.java | 31 +++++++++++++---------- 9 | 2 files changed, 18 insertions(+), 14 deletions(-) 10 | 11 | diff --git a/res/layout/data_usage_chart.xml b/res/layout/data_usage_chart.xml 12 | index 2501e9d..87587e5 100644 13 | --- a/res/layout/data_usage_chart.xml 14 | +++ b/res/layout/data_usage_chart.xml 15 | @@ -45,6 +45,7 @@ 16 | android:layout_width="match_parent" 17 | android:layout_height="match_parent" 18 | android:layout_gravity="left|bottom" 19 | + android:background="#555555" 20 | settings:strokeColor="@android:color/holo_blue_light" 21 | settings:fillColor="#c033b5e5" 22 | settings:fillColorSecondary="#6633b5e5" /> 23 | diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java 24 | index 46d6c65..608f10a 100644 25 | --- a/src/com/android/settings/DataUsageSummary.java 26 | +++ b/src/com/android/settings/DataUsageSummary.java 27 | @@ -439,15 +439,6 @@ public class DataUsageSummary extends Fragment { 28 | split4g.setVisible(hasMobile4gRadio(context) && !appDetailMode); 29 | split4g.setChecked(isMobilePolicySplit()); 30 | 31 | - final MenuItem showWifi = menu.findItem(R.id.data_usage_menu_show_wifi); 32 | - if (hasWifiRadio(context) && hasMobileRadio(context)) { 33 | - showWifi.setVisible(!appDetailMode); 34 | - showWifi.setChecked(mShowWifi); 35 | - } else { 36 | - showWifi.setVisible(false); 37 | - mShowWifi = true; 38 | - } 39 | - 40 | final MenuItem showEthernet = menu.findItem(R.id.data_usage_menu_show_ethernet); 41 | if (hasEthernet(context) && hasMobileRadio(context)) { 42 | showEthernet.setVisible(!appDetailMode); 43 | @@ -456,6 +447,15 @@ public class DataUsageSummary extends Fragment { 44 | showEthernet.setVisible(false); 45 | mShowEthernet = true; 46 | } 47 | + 48 | + final MenuItem showWifi = menu.findItem(R.id.data_usage_menu_show_wifi); 49 | + if (hasWifiRadio(context) && hasMobileRadio(context)) { 50 | + showWifi.setVisible(!appDetailMode); 51 | + showWifi.setChecked(mShowWifi); 52 | + } else { 53 | + showWifi.setVisible(false); 54 | + mShowWifi = true; 55 | + } 56 | } 57 | 58 | @Override 59 | @@ -576,13 +576,12 @@ public class DataUsageSummary extends Fragment { 60 | } else if (hasMobileRadio(context)) { 61 | mTabHost.addTab(buildTabSpec(TAB_MOBILE, R.string.data_usage_tab_mobile)); 62 | } 63 | - if (mShowWifi && hasWifiRadio(context)) { 64 | - mTabHost.addTab(buildTabSpec(TAB_WIFI, R.string.data_usage_tab_wifi)); 65 | - } 66 | if (mShowEthernet && hasEthernet(context)) { 67 | mTabHost.addTab(buildTabSpec(TAB_ETHERNET, R.string.data_usage_tab_ethernet)); 68 | } 69 | - 70 | + if (mShowWifi && hasWifiRadio(context)) { 71 | + mTabHost.addTab(buildTabSpec(TAB_WIFI, R.string.data_usage_tab_wifi)); 72 | + } 73 | final boolean multipleTabs = mTabWidget.getTabCount() > 1; 74 | mTabWidget.setVisibility(multipleTabs ? View.VISIBLE : View.GONE); 75 | if (mIntentTab != null) { 76 | @@ -903,7 +902,7 @@ public class DataUsageSummary extends Fragment { 77 | mBinding = false; 78 | } 79 | 80 | - final NetworkPolicy policy = mPolicyEditor.getPolicy(mTemplate); 81 | + final NetworkPolicy policy = mPolicyEditor.getOrCreatePolicy(mTemplate); 82 | if (isNetworkPolicyModifiable(policy)) { 83 | mDisableAtLimitView.setVisibility(View.VISIBLE); 84 | mDisableAtLimit.setChecked(policy != null && policy.limitBytes != LIMIT_DISABLED); 85 | @@ -921,6 +920,7 @@ public class DataUsageSummary extends Fragment { 86 | // generate cycle list based on policy and available history 87 | updateCycleList(policy); 88 | } 89 | + 90 | } 91 | 92 | /** 93 | @@ -1568,6 +1568,9 @@ public class DataUsageSummary extends Fragment { 94 | } else if (TAB_WIFI.equals(currentTab)) { 95 | message = buildDialogMessage(res, R.string.data_usage_tab_wifi); 96 | limitBytes = 5 * GB_IN_BYTES; 97 | + } else if (TAB_ETHERNET.equals(currentTab)) { 98 | + message = buildDialogMessage(res, R.string.data_usage_tab_wifi); 99 | + limitBytes = 5 * GB_IN_BYTES; 100 | } else { 101 | throw new IllegalArgumentException("unknown current tab: " + currentTab); 102 | } 103 | -- 104 | 1.7.4.1 105 | 106 | -------------------------------------------------------------------------------- /ics/packages/providers/DownloadProvider/0001-Adding-Ethernet-support-in-DownloadProvider.patch: -------------------------------------------------------------------------------- 1 | From c876dbadc8d91f4d66333ed4a48b80ef552fa640 Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 24 Apr 2012 13:32:32 +0200 4 | Subject: [PATCH] Adding Ethernet support in DownloadProvider 5 | 6 | --- 7 | .../android/providers/downloads/DownloadInfo.java | 6 ++++++ 8 | 1 files changed, 6 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java 11 | index 304d70f..df5e14c 100644 12 | --- a/src/com/android/providers/downloads/DownloadInfo.java 13 | +++ b/src/com/android/providers/downloads/DownloadInfo.java 14 | @@ -418,6 +418,9 @@ public class DownloadInfo { 15 | case ConnectivityManager.TYPE_WIFI: 16 | return DownloadManager.Request.NETWORK_WIFI; 17 | 18 | + case ConnectivityManager.TYPE_ETHERNET: 19 | + return DownloadManager.Request.NETWORK_ETHERNET; 20 | + 21 | default: 22 | return 0; 23 | } 24 | @@ -434,6 +437,9 @@ public class DownloadInfo { 25 | if (networkType == ConnectivityManager.TYPE_WIFI) { 26 | return NETWORK_OK; // anything goes over wifi 27 | } 28 | + if (networkType == ConnectivityManager.TYPE_ETHERNET) { 29 | + return NETWORK_OK; // anything goes over wifi 30 | + } 31 | Long maxBytesOverMobile = mSystemFacade.getMaxBytesOverMobile(); 32 | if (maxBytesOverMobile != null && mTotalBytes > maxBytesOverMobile) { 33 | return NETWORK_UNUSABLE_DUE_TO_SIZE; 34 | -- 35 | 1.7.4.1 36 | 37 | -------------------------------------------------------------------------------- /ics/system/core/0001-adding-the-right-AID-for-daemons-trying-to-set-syste.patch: -------------------------------------------------------------------------------- 1 | From 12c0b28b2a2d8f617d53851fe95918ed36ee778c Mon Sep 17 00:00:00 2001 2 | From: Fabien Brisset 3 | Date: Tue, 7 Aug 2012 14:21:22 +0200 4 | Subject: [PATCH] adding the right AID for daemons trying to set system properties 5 | 6 | --- 7 | init/property_service.c | 2 ++ 8 | 1 files changed, 2 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/init/property_service.c b/init/property_service.c 11 | index 828b7fc..74b9a6e 100644 12 | --- a/init/property_service.c 13 | +++ b/init/property_service.c 14 | @@ -73,11 +73,13 @@ struct { 15 | { "dev.", AID_SYSTEM, 0 }, 16 | { "runtime.", AID_SYSTEM, 0 }, 17 | { "hw.", AID_SYSTEM, 0 }, 18 | + { "rw.", AID_SYSTEM, 0 }, 19 | { "sys.", AID_SYSTEM, 0 }, 20 | { "service.", AID_SYSTEM, 0 }, 21 | { "wlan.", AID_SYSTEM, 0 }, 22 | { "dhcp.", AID_SYSTEM, 0 }, 23 | { "dhcp.", AID_DHCP, 0 }, 24 | + { "net.", AID_DHCP, 0 }, 25 | { "debug.", AID_SHELL, 0 }, 26 | { "log.", AID_SHELL, 0 }, 27 | { "service.adb.root", AID_SHELL, 0 }, 28 | -- 29 | 1.7.4.1 30 | 31 | -------------------------------------------------------------------------------- /jb/build/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/core/pathmap.mk b/core/pathmap.mk 2 | index 4aec521..72ba2d8 100644 3 | --- a/core/pathmap.mk 4 | +++ b/core/pathmap.mk 5 | @@ -94,6 +94,7 @@ FRAMEWORKS_BASE_SUBDIRS := \ 6 | opengl \ 7 | sax \ 8 | telephony \ 9 | + ethernet \ 10 | wifi \ 11 | keystore \ 12 | icu4j \ 13 | 14 | -------------------------------------------------------------------------------- /jb/development/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java 2 | index 191bb59..32187d8 100644 3 | --- a/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java 4 | +++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java 5 | @@ -37,6 +37,7 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 6 | private long mEventTime; // time of last event (connect, disconnect, etc.) 7 | private int mLastNetworkType = -1; // unknown 8 | private long mWifiElapsedTime = 0; // accumulated time spent on wifi since start() 9 | + private long mEthernetElapsedTime = 0; // accumulated time spent on ethernet since start() 10 | private long mMobileElapsedTime = 0; // accumulated time spent on mobile since start() 11 | private long mElapsedTime = 0; // amount of time spent between start() and stop() 12 | 13 | @@ -69,6 +70,10 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 14 | if (LDEBUG) System.out.println("Adding to wifi: " + delta); 15 | mWifiElapsedTime += delta; 16 | break; 17 | + case ConnectivityManager.TYPE_ETHERNET: 18 | + if (LDEBUG) System.out.println("Adding to ethernet: " + delta); 19 | + mEthernetElapsedTime += delta; 20 | + break; 21 | default: 22 | if (LDEBUG) System.out.println("Unaccounted for: " + delta); 23 | break; 24 | @@ -78,6 +83,7 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 25 | 26 | public void start() { 27 | mWifiElapsedTime = 0; 28 | + mEthernetElapsedTime = 0; 29 | mMobileElapsedTime = 0; 30 | mElapsedTime = 0; 31 | mEventTime = mCollectionStartTime = SystemClock.elapsedRealtime(); 32 | @@ -101,6 +107,7 @@ public class MonkeyNetworkMonitor extends IIntentReceiver.Stub { 33 | System.out.println("## Network stats: elapsed time=" + mElapsedTime + "ms (" 34 | + mMobileElapsedTime + "ms mobile, " 35 | + mWifiElapsedTime + "ms wifi, " 36 | - + (mElapsedTime - mMobileElapsedTime - mWifiElapsedTime) + "ms not connected)"); 37 | + + mEthernetElapsedTime + "ms ethernet, " 38 | + + (mElapsedTime - mMobileElapsedTime - mWifiElapsedTime - mEthernetElapsedTime) + "ms not connected)"); 39 | } 40 | } 41 | \ No newline at end of file 42 | -------------------------------------------------------------------------------- /jb/device/ti/panda/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/device.mk b/device.mk 2 | index d2f4c98..c4a597c 100644 3 | --- a/device.mk 4 | +++ b/device.mk 5 | @@ -31,6 +31,7 @@ PRODUCT_COPY_FILES := \ 6 | device/ti/panda/gpio-keys.kl:system/usr/keylayout/gpio-keys.kl \ 7 | frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \ 8 | frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ 9 | + frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml \ 10 | frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml 11 | 12 | PRODUCT_PACKAGES := \ 13 | @@ -38,6 +39,7 @@ PRODUCT_PACKAGES := \ 14 | 15 | PRODUCT_PROPERTY_OVERRIDES := \ 16 | wifi.interface=wlan0 \ 17 | + ethernet.interface=eth0 \ 18 | hwui.render_dirty_regions=false 19 | 20 | PRODUCT_CHARACTERISTICS := tablet,nosdcard 21 | -------------------------------------------------------------------------------- /jb/external/dhcpcd/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/dhcpcd-hooks/20-dns.conf b/dhcpcd-hooks/20-dns.conf 2 | index 6165824..5fb4c0a 100644 3 | --- a/dhcpcd-hooks/20-dns.conf 4 | +++ b/dhcpcd-hooks/20-dns.conf 5 | @@ -22,6 +22,7 @@ set_dns_props() 6 | count=1 7 | for dnsaddr in ${new_domain_name_servers}; do 8 | setprop dhcp.${intf}.dns${count} ${dnsaddr} 9 | + setprop net.dns${count} ${dnsaddr} 10 | count=$(($count + 1)) 11 | done 12 | } 13 | -------------------------------------------------------------------------------- /jb/frameworks/native/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/data/etc/android.hardware.ethernet.xml b/data/etc/android.hardware.ethernet.xml 2 | new file mode 100644 3 | index 0000000..5776c11 4 | --- /dev/null 5 | +++ b/data/etc/android.hardware.ethernet.xml 6 | @@ -0,0 +1,20 @@ 7 | + 8 | + 22 | + 23 | + 24 | + 25 | + 26 | + 27 | -------------------------------------------------------------------------------- /jb/hardware/libhardware_legacy/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/Android.mk b/Android.mk 2 | index 1faf6e2..c07a869 100644 3 | --- a/Android.mk 4 | +++ b/Android.mk 5 | @@ -1,7 +1,7 @@ 6 | # Copyright 2006 The Android Open Source Project 7 | 8 | # Setting LOCAL_PATH will mess up all-subdir-makefiles, so do it beforehand. 9 | -legacy_modules := power uevent vibrator wifi qemu qemu_tracing 10 | +legacy_modules := power uevent vibrator wifi ethernet qemu qemu_tracing 11 | 12 | SAVE_MAKEFILES := $(call all-named-subdir-makefiles,$(legacy_modules)) 13 | LEGACY_AUDIO_MAKEFILES := $(call all-named-subdir-makefiles,audio) 14 | diff --git a/ethernet/Android.mk b/ethernet/Android.mk 15 | new file mode 100644 16 | index 0000000..5518239 17 | --- /dev/null 18 | +++ b/ethernet/Android.mk 19 | @@ -0,0 +1,15 @@ 20 | +# Copyright 2012 The Android Open Source Project 21 | + 22 | +ifdef ETHERNET_DRIVER_MODULE_PATH 23 | +LOCAL_CFLAGS += -DETHERNET_DRIVER_MODULE_PATH=\"$(ETHERNET_DRIVER_MODULE_PATH)\" 24 | +endif 25 | +ifdef ETHERNET_DRIVER_MODULE_ARG 26 | +LOCAL_CFLAGS += -DETHERNET_DRIVER_MODULE_ARG=\"$(ETHERNET_DRIVER_MODULE_ARG)\" 27 | +endif 28 | +ifdef ETHERNET_DRIVER_MODULE_NAME 29 | +LOCAL_CFLAGS += -DETHERNET_DRIVER_MODULE_NAME=\"$(ETHERNET_DRIVER_MODULE_NAME)\" 30 | +endif 31 | + 32 | +LOCAL_SRC_FILES += ethernet/ethernet.c 33 | + 34 | +LOCAL_SHARED_LIBRARIES += libnetutils 35 | diff --git a/ethernet/ethernet.c b/ethernet/ethernet.c 36 | new file mode 100644 37 | index 0000000..2a825e6 38 | --- /dev/null 39 | +++ b/ethernet/ethernet.c 40 | @@ -0,0 +1,390 @@ 41 | +/* 42 | + * Copyright 2012, The Android Open Source Project 43 | + * 44 | + * Licensed under the Apache License, Version 2.0 (the "License"); 45 | + * you may not use this file except in compliance with the License. 46 | + * You may obtain a copy of the License at 47 | + * 48 | + * http://www.apache.org/licenses/LICENSE-2.0 49 | + * 50 | + * Unless required by applicable law or agreed to in writing, software 51 | + * distributed under the License is distributed on an "AS IS" BASIS, 52 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 | + * See the License for the specific language governing permissions and 54 | + * limitations under the License. 55 | + */ 56 | + 57 | +#include 58 | +#include 59 | +#include 60 | +#include 61 | +#include 62 | +#include 63 | +#include 64 | +#include 65 | +#include 66 | +#include 67 | +#include 68 | +#include 69 | +#include 70 | +#include 71 | +#include 72 | +#include 73 | +#include 74 | + 75 | +#include "hardware_legacy/ethernet.h" 76 | + 77 | +#define LOG_TAG "EthernetHW" 78 | + 79 | +#include "cutils/log.h" 80 | +#include "cutils/memory.h" 81 | +#include "cutils/misc.h" 82 | +#include "cutils/properties.h" 83 | +#include "private/android_filesystem_config.h" 84 | +#ifdef HAVE_LIBC_SYSTEM_PROPERTIES 85 | +#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ 86 | +#include 87 | +#endif 88 | + 89 | +extern int do_dhcp(); 90 | +extern int ifc_init(); 91 | +extern void ifc_close(); 92 | +extern char *dhcp_lasterror(); 93 | +extern void get_dhcp_info(); 94 | +extern int init_module(void *, unsigned long, const char *); 95 | +extern int delete_module(const char *, unsigned int); 96 | + 97 | +static char primary_iface[PROPERTY_VALUE_MAX]; 98 | +static int nl_socket_msg = -1; 99 | +static struct sockaddr_nl addr_msg; 100 | +static int nl_socket_poll = -1; 101 | +static struct sockaddr_nl addr_poll; 102 | + 103 | +#ifndef ETHERNET_DRIVER_MODULE_ARG 104 | +#define ETHERNET_DRIVER_MODULE_ARG "" 105 | +#endif 106 | + 107 | +#define ETHERNET_DRIVER_LOADER_DELAY 1000000 108 | + 109 | +#ifdef ETHERNET_DRIVER_MODULE_PATH 110 | +static const char DRIVER_MODULE_NAME[] = ETHERNET_DRIVER_MODULE_NAME; 111 | +static const char DRIVER_MODULE_TAG[] = ETHERNET_DRIVER_MODULE_NAME " "; 112 | +static const char DRIVER_MODULE_PATH[] = ETHERNET_DRIVER_MODULE_PATH; 113 | +static const char DRIVER_MODULE_ARG[] = ETHERNET_DRIVER_MODULE_ARG; 114 | +#endif 115 | + 116 | +static const char DRIVER_PROP_NAME[] = "lan.driver.status"; 117 | +static const char MODULE_FILE[] = "/proc/modules"; 118 | + 119 | +static int insmod(const char *filename, const char *args) 120 | +{ 121 | + void *module; 122 | + unsigned int size; 123 | + int ret; 124 | + 125 | + module = load_file(filename, &size); 126 | + if (!module) 127 | + return -1; 128 | + 129 | + ret = init_module(module, size, args); 130 | + 131 | + free(module); 132 | + 133 | + return ret; 134 | +} 135 | + 136 | +static int rmmod(const char *modname) 137 | +{ 138 | + int ret = -1; 139 | + int maxtry = 10; 140 | + 141 | + while (maxtry-- > 0) { 142 | + ret = delete_module(modname, O_NONBLOCK | O_EXCL); 143 | + if (ret < 0 && errno == EAGAIN) 144 | + usleep(500000); 145 | + else 146 | + break; 147 | + } 148 | + 149 | + if (ret != 0) 150 | + ALOGD("Unable to unload driver module \"%s\": %s\n", 151 | + modname, strerror(errno)); 152 | + return ret; 153 | +} 154 | + 155 | +int do_ethernet_dhcp_request(int *ipaddr, int *gateway, int *mask, 156 | + int *dns1, int *dns2, int *server, int *lease) { 157 | + char ifc[PROPERTY_VALUE_MAX]; 158 | + 159 | + if (ifc_init() < 0) 160 | + return -1; 161 | + 162 | + property_get("ethernet.interface", ifc, NULL); 163 | + 164 | + if (do_dhcp(ifc) < 0) { 165 | + ifc_close(); 166 | + return -1; 167 | + } 168 | + ifc_close(); 169 | + get_dhcp_info(ipaddr, gateway, mask, dns1, dns2, server, lease); 170 | + return 0; 171 | +} 172 | + 173 | +const char *get_ethernet_dhcp_error_string() { 174 | + return dhcp_lasterror(); 175 | +} 176 | + 177 | +int is_ethernet_driver_loaded() { 178 | + char driver_status[PROPERTY_VALUE_MAX]; 179 | +#ifdef ETHERNET_DRIVER_MODULE_PATH 180 | + FILE *proc; 181 | + char line[sizeof(DRIVER_MODULE_TAG)+10]; 182 | +#endif 183 | + 184 | + if (!property_get(DRIVER_PROP_NAME, driver_status, NULL) 185 | + || strcmp(driver_status, "ok") != 0) { 186 | + return 0; /* driver not loaded */ 187 | + } 188 | +#ifdef ETHERNET_DRIVER_MODULE_PATH 189 | + /* 190 | + * If the property says the driver is loaded, check to 191 | + * make sure that the property setting isn't just left 192 | + * over from a previous manual shutdown or a runtime 193 | + * crash. 194 | + */ 195 | + if ((proc = fopen(MODULE_FILE, "r")) == NULL) { 196 | + ALOGW("Could not open %s: %s", MODULE_FILE, strerror(errno)); 197 | + property_set(DRIVER_PROP_NAME, "unloaded"); 198 | + return 0; 199 | + } 200 | + while ((fgets(line, sizeof(line), proc)) != NULL) { 201 | + if (strncmp(line, DRIVER_MODULE_TAG, strlen(DRIVER_MODULE_TAG)) == 0) { 202 | + fclose(proc); 203 | + return 1; 204 | + } 205 | + } 206 | + fclose(proc); 207 | + property_set(DRIVER_PROP_NAME, "unloaded"); 208 | + return 0; 209 | +#else 210 | + return 1; 211 | +#endif 212 | +} 213 | + 214 | +int ethernet_load_driver() 215 | +{ 216 | +#ifdef ETHERNET_DRIVER_MODULE_PATH 217 | + char driver_status[PROPERTY_VALUE_MAX]; 218 | + int count = 100; /* wait at most 20 seconds for completion */ 219 | + 220 | + if (is_ethernet_driver_loaded()) { 221 | + return 0; 222 | + } 223 | + 224 | + if (insmod(DRIVER_MODULE_PATH, DRIVER_MODULE_ARG) < 0) 225 | + return -1; 226 | + 227 | + property_set(DRIVER_PROP_NAME, "ok"); 228 | + 229 | + sched_yield(); 230 | + while (count-- > 0) { 231 | + if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) { 232 | + if (strcmp(driver_status, "ok") == 0) 233 | + return 0; 234 | + else if (strcmp(DRIVER_PROP_NAME, "failed") == 0) { 235 | + ethernet_unload_driver(); 236 | + return -1; 237 | + } 238 | + } 239 | + usleep(200000); 240 | + } 241 | + property_set(DRIVER_PROP_NAME, "timeout"); 242 | + ethernet_unload_driver(); 243 | + return -1; 244 | +#else 245 | + property_set(DRIVER_PROP_NAME, "ok"); 246 | + return 0; 247 | +#endif 248 | +} 249 | + 250 | +int ethernet_unload_driver() 251 | +{ 252 | + usleep(200000); /* allow to finish interface down */ 253 | +#ifdef ETHERNET_DRIVER_MODULE_PATH 254 | + if (rmmod(DRIVER_MODULE_NAME) == 0) { 255 | + int count = 20; /* wait at most 10 seconds for completion */ 256 | + while (count-- > 0) { 257 | + if (!is_ethernet_driver_loaded()) 258 | + break; 259 | + usleep(500000); 260 | + } 261 | + usleep(500000); /* allow card removal */ 262 | + if (count) { 263 | + return 0; 264 | + } 265 | + return -1; 266 | + } else 267 | + return -1; 268 | +#else 269 | + property_set(DRIVER_PROP_NAME, "unloaded"); 270 | + return 0; 271 | +#endif 272 | +} 273 | + 274 | +static int ethernet_get_ifindex (const char *ifname) 275 | +{ 276 | + char path[256]; 277 | + char idx[5] = { 0 }; 278 | + FILE *f; 279 | + 280 | + snprintf(path, sizeof(path), "/sys/class/net/%s/ifindex", ifname); 281 | + f = fopen(path, "r"); 282 | + if (!f) 283 | + return -1; 284 | + 285 | + if (fgets(idx, 4, f)) 286 | + return strtoimax(idx, NULL, 10); 287 | + 288 | + return -1; 289 | +} 290 | + 291 | +int ethernet_get_hwaddr(const char *ifname, uint8_t *addr) 292 | +{ 293 | + struct ifreq ifr; 294 | + int sock = -1; 295 | + 296 | + sock = socket (AF_INET, SOCK_STREAM, 0); 297 | + if (sock < 0) 298 | + return -1; 299 | + 300 | + memset (&ifr, 0, sizeof (ifr)); 301 | + strncpy (ifr.ifr_name, ifname, IFNAMSIZ); 302 | + 303 | + if (ioctl (sock, SIOCGIFHWADDR, &ifr)) 304 | + return -1; 305 | + 306 | + if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) 307 | + return -1; 308 | + 309 | + memcpy (addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN); 310 | + close (sock); 311 | + 312 | + return 0; 313 | +} 314 | + 315 | +int ethernet_init_event(void) 316 | +{ 317 | + memset (&addr_msg, '\0', sizeof(addr_msg)); 318 | + addr_msg.nl_family = AF_NETLINK; 319 | + 320 | + nl_socket_msg = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); 321 | + if (nl_socket_msg <= 0) { 322 | + ALOGE("Can not create netlink msg socket"); 323 | + return -1; 324 | + } 325 | + 326 | + if (bind(nl_socket_msg, (struct sockaddr *)(&addr_msg), 327 | + sizeof(struct sockaddr_nl))) { 328 | + ALOGE("Can not bind to netlink msg socket"); 329 | + return -1; 330 | + } 331 | + 332 | + memset (&addr_poll, '\0', sizeof(addr_poll)); 333 | + addr_poll.nl_family = AF_NETLINK; 334 | + addr_poll.nl_pid = 0; 335 | + addr_poll.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR; 336 | + 337 | + nl_socket_poll = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); 338 | + if (nl_socket_poll <= 0) { 339 | + ALOGE("Can not create netlink poll socket"); 340 | + return -1; 341 | + } 342 | + 343 | + if (bind(nl_socket_poll, (struct sockaddr *)(&addr_poll), 344 | + sizeof(struct sockaddr_nl))) { 345 | + ALOGE("Can not bind to netlink poll socket"); 346 | + return -1; 347 | + } 348 | + 349 | + return 0; 350 | +} 351 | + 352 | +int ethernet_shutdown_event(void) 353 | +{ 354 | + if (nl_socket_msg > 0) 355 | + close(nl_socket_msg); 356 | + 357 | + if (nl_socket_poll > 0) 358 | + close(nl_socket_poll); 359 | + 360 | + return 0; 361 | +} 362 | + 363 | +int ethernet_wait_for_event(const char *ifname, char *buf, size_t len) 364 | +{ 365 | + char buff[8192]; 366 | + struct nlmsghdr *nh; 367 | + struct iovec iov; 368 | + struct msghdr msg; 369 | + int if_index = -1, l; 370 | + 371 | + if_index = ethernet_get_ifindex(ifname); 372 | + ALOGV("Listening to Netlink event on Ethernet interface index: %s:%d", 373 | + ifname, if_index); 374 | + if (if_index == -1) 375 | + return -1; 376 | + 377 | + iov.iov_base = &buff; 378 | + iov.iov_len = sizeof(buf); 379 | + 380 | + memset(&msg, '\0', sizeof(msg)); 381 | + msg.msg_name = (void *)&addr_msg; 382 | + msg.msg_namelen = sizeof(addr_msg); 383 | + msg.msg_iov = &iov; 384 | + msg.msg_iovlen = 1; 385 | + 386 | + l = recvmsg(nl_socket_poll, &msg, 0); 387 | + if (l < 0) 388 | + return -1; 389 | + 390 | + for (nh = (struct nlmsghdr *) buff; NLMSG_OK (nh, (unsigned int) l); 391 | + nh = NLMSG_NEXT (nh, len)) { 392 | + 393 | + struct ifinfomsg *einfo = (struct ifinfomsg *) NLMSG_DATA(nh); 394 | + int type; 395 | + 396 | + if (nh->nlmsg_type == NLMSG_DONE || nh->nlmsg_type == NLMSG_ERROR) 397 | + continue; 398 | + 399 | + /* only consider events from the requested interface */ 400 | + if (einfo->ifi_index != if_index) 401 | + continue; 402 | + 403 | + type = nh->nlmsg_type; 404 | + if (type == RTM_NEWLINK && (!(einfo->ifi_flags & IFF_LOWER_UP))) 405 | + type = RTM_DELLINK; 406 | + 407 | + switch (type) { 408 | + case RTM_DELLINK: 409 | + strncpy(buf, "PHY_DOWN", len - 1); 410 | + buf[len - 1] = '\0'; 411 | + return strlen(buf); 412 | + case RTM_NEWLINK: 413 | + strncpy(buf, "PHY_UP", len - 1); 414 | + buf[len - 1] = '\0'; 415 | + return strlen(buf); 416 | + case RTM_DELADDR: 417 | + strncpy(buf, "DISCONNECTED", len - 1); 418 | + buf[len - 1] = '\0'; 419 | + return strlen(buf); 420 | + case RTM_NEWADDR: 421 | + strncpy(buf, "CONNECTED", len - 1); 422 | + buf[len - 1] = '\0'; 423 | + return strlen(buf); 424 | + default: 425 | + break; 426 | + } 427 | + } 428 | + 429 | + return 0; 430 | +} 431 | diff --git a/include/hardware_legacy/ethernet.h b/include/hardware_legacy/ethernet.h 432 | new file mode 100644 433 | index 0000000..dc9c26f 434 | --- /dev/null 435 | +++ b/include/hardware_legacy/ethernet.h 436 | @@ -0,0 +1,112 @@ 437 | +/* 438 | + * Copyright (C) 2012 The Android Open Source Project 439 | + * 440 | + * Licensed under the Apache License, Version 2.0 (the "License"); 441 | + * you may not use this file except in compliance with the License. 442 | + * You may obtain a copy of the License at 443 | + * 444 | + * http://www.apache.org/licenses/LICENSE-2.0 445 | + * 446 | + * Unless required by applicable law or agreed to in writing, software 447 | + * distributed under the License is distributed on an "AS IS" BASIS, 448 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 449 | + * See the License for the specific language governing permissions and 450 | + * limitations under the License. 451 | + */ 452 | + 453 | +#ifndef _ETHERNET_H 454 | +#define _ETHERNET_H 455 | + 456 | +#if __cplusplus 457 | +extern "C" { 458 | +#endif 459 | + 460 | +/** 461 | + * Load the Ethernet driver. 462 | + * 463 | + * @return 0 on success, < 0 on failure. 464 | + */ 465 | +int ethernet_load_driver(); 466 | + 467 | +/** 468 | + * Unload the Ethernet driver. 469 | + * 470 | + * @return 0 on success, < 0 on failure. 471 | + */ 472 | +int ethernet_unload_driver(); 473 | + 474 | +/** 475 | + * Check if the Ethernet driver is loaded. 476 | + * 477 | + * @return 0 on success, < 0 on failure. 478 | + */ 479 | +int is_ethernet_driver_loaded(); 480 | + 481 | +/** 482 | + * do_dhcp_request() issues a dhcp request and returns the acquired 483 | + * information. 484 | + * 485 | + * All IPV4 addresses/mask are in network byte order. 486 | + * 487 | + * @param ipaddr return the assigned IPV4 address 488 | + * @param gateway return the gateway being used 489 | + * @param mask return the IPV4 mask 490 | + * @param dns1 return the IPV4 address of a DNS server 491 | + * @param dns2 return the IPV4 address of a DNS server 492 | + * @param server return the IPV4 address of DHCP server 493 | + * @param lease return the length of lease in seconds. 494 | + * 495 | + * @return 0 if successful, < 0 if error. 496 | + */ 497 | +int do_ethernet_dhcp_request(int *ipaddr, int *gateway, int *mask, 498 | + int *dns1, int *dns2, int *server, int *lease); 499 | + 500 | +/** 501 | + * Return the error string of the last do_dhcp_request(). 502 | + */ 503 | +const char *get_ethernet_dhcp_error_string(); 504 | + 505 | +/** 506 | + * ethernet_get_hwaddr() returns interface MAC address. 507 | + * 508 | + * @param iface is the requested interface 509 | + * @param addr is the address byte array 510 | + * 511 | + * @return 0 if successful, < 0 if error. 512 | + */ 513 | +int ethernet_get_hwaddr(const char *ifname, uint8_t *addr); 514 | + 515 | +/** 516 | + * ethernet_init_event() initializes the Netlink eventing channel. 517 | + * 518 | + * @return 0 if successful, < 0 if error. 519 | + */ 520 | +int ethernet_init_event(void); 521 | + 522 | +/** 523 | + * ethernet_shudown_event() shutdowns the Netlink eventing channel. 524 | + * 525 | + * @return 0 if successful, < 0 if error. 526 | + */ 527 | +int ethernet_shutdown_event(void); 528 | + 529 | +/** 530 | + * ethernet_wait_for_event() performs a blocking call to 531 | + * get an Ethernet event and returns a string representing 532 | + * a Ethernet event when it occurs. 533 | + * 534 | + * @param iface is the interface on which event is received 535 | + * @param buf is the buffer that receives the event 536 | + * @param len is the maximum length of the buffer 537 | + * 538 | + * @returns number of bytes in buffer, 0 if no 539 | + * event (for instance, no connection), and less than 0 540 | + * if there is an error. 541 | + */ 542 | +int ethernet_wait_for_event(const char *ifname, char *buf, size_t len); 543 | + 544 | +#if __cplusplus 545 | +}; // extern "C" 546 | +#endif 547 | + 548 | +#endif // _ETHERNET_H 549 | -------------------------------------------------------------------------------- /jb/packages/apps/Email/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/src/com/android/email/AttachmentInfo.java b/src/com/android/email/AttachmentInfo.java 2 | index b6751b5..b1f0a9d 100644 3 | --- a/src/com/android/email/AttachmentInfo.java 4 | +++ b/src/com/android/email/AttachmentInfo.java 5 | @@ -157,10 +157,10 @@ public class AttachmentInfo { 6 | } 7 | 8 | // Check for file size exceeded 9 | - // The size limit is overridden when on a wifi connection - any size is OK 10 | + // The size limit is overridden when on a wifi or ethernet connection - any size is OK 11 | if (mSize > AttachmentUtilities.MAX_ATTACHMENT_DOWNLOAD_SIZE) { 12 | int networkType = EmailConnectivityManager.getActiveNetworkType(context); 13 | - if (networkType != ConnectivityManager.TYPE_WIFI) { 14 | + if ((networkType != ConnectivityManager.TYPE_WIFI) && (networkType != ConnectivityManager.TYPE_ETHERNET)) { 15 | canView = false; 16 | canSave = false; 17 | denyFlags |= DENY_WIFIONLY; 18 | diff --git a/src/com/android/email/service/AttachmentDownloadService.java b/src/com/android/email/service/AttachmentDownloadService.java 19 | index 8bd706b..dadb391 100644 20 | --- a/src/com/android/email/service/AttachmentDownloadService.java 21 | +++ b/src/com/android/email/service/AttachmentDownloadService.java 22 | @@ -340,8 +340,8 @@ public class AttachmentDownloadService extends Service implements Runnable { 23 | EmailConnectivityManager ecm = mConnectivityManager; 24 | if (ecm == null) return; 25 | if (!ecm.isAutoSyncAllowed()) return; 26 | - // Don't prefetch unless we're on a WiFi network 27 | - if (ecm.getActiveNetworkType() != ConnectivityManager.TYPE_WIFI) { 28 | + // Don't prefetch unless we're on a WiFi or Ethernet network 29 | + if ((ecm.getActiveNetworkType() != ConnectivityManager.TYPE_WIFI) && (ecm.getActiveNetworkType() != ConnectivityManager.TYPE_ETHERNET)) { 30 | return; 31 | } 32 | // Then, try opportunistic download of appropriate attachments 33 | -------------------------------------------------------------------------------- /jb/packages/apps/Phone/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/src/com/android/phone/SipCallOptionHandler.java b/src/com/android/phone/SipCallOptionHandler.java 2 | index 500f322..d802049 100644 3 | --- a/src/com/android/phone/SipCallOptionHandler.java 4 | +++ b/src/com/android/phone/SipCallOptionHandler.java 5 | @@ -406,8 +406,10 @@ public class SipCallOptionHandler extends Activity implements 6 | NetworkInfo ni = cm.getActiveNetworkInfo(); 7 | if ((ni == null) || !ni.isConnected()) return false; 8 | 9 | - return ((ni.getType() == ConnectivityManager.TYPE_WIFI) 10 | - || !SipManager.isSipWifiOnly(this)); 11 | + return (((ni.getType() == ConnectivityManager.TYPE_WIFI) 12 | + || !SipManager.isSipWifiOnly(this))) || 13 | + (((ni.getType() == ConnectivityManager.TYPE_ETHERNET) 14 | + || !SipManager.isSipEthernetOnly(this))); 15 | } 16 | return false; 17 | } 18 | -------------------------------------------------------------------------------- /jb/system/core/ethernet.diff: -------------------------------------------------------------------------------- 1 | diff --git a/init/property_service.c b/init/property_service.c 2 | index f58e07d..0941f0c 100755 3 | --- a/init/property_service.c 4 | +++ b/init/property_service.c 5 | @@ -78,12 +78,14 @@ struct { 6 | { "dev.", AID_SYSTEM, 0 }, 7 | { "runtime.", AID_SYSTEM, 0 }, 8 | { "hw.", AID_SYSTEM, 0 }, 9 | + { "rw.", AID_SYSTEM, 0 }, 10 | { "sys.", AID_SYSTEM, 0 }, 11 | { "service.", AID_SYSTEM, 0 }, 12 | { "wlan.", AID_SYSTEM, 0 }, 13 | { "bluetooth.", AID_BLUETOOTH, 0 }, 14 | { "dhcp.", AID_SYSTEM, 0 }, 15 | { "dhcp.", AID_DHCP, 0 }, 16 | + { "net.", AID_DHCP, 0 }, 17 | { "debug.", AID_SYSTEM, 0 }, 18 | { "debug.", AID_SHELL, 0 }, 19 | { "log.", AID_SHELL, 0 }, 20 | diff --git a/logcat/event.logtags b/logcat/event.logtags 21 | index 6040bd9..3fc96f8 100644 22 | --- a/logcat/event.logtags 23 | +++ b/logcat/event.logtags 24 | @@ -90,6 +90,16 @@ 25 | # Logged when the supplicant switches to a new state 26 | 50023 wifi_supplicant_state_changed (supplicant_state|1|5) 27 | 28 | +# HSM ethernet state change 29 | +# Hierarchical state class name (as defined in EthernetStateTracker.java) 30 | +# Logged on every state change in the hierarchical state machine 31 | +50031 ethernet_state_changed (ethernet_state|3) 32 | +# HSM ethernet event 33 | +# [31-16] Reserved for future use 34 | +# [15 - 0] HSM event (as defined in EthernetStateTracker.java) 35 | +# Logged when an event is handled in a hierarchical state 36 | +50032 ethernet_event_handled (ethernet_event|1|5) 37 | + 38 | # Do not change these names without updating tag in: 39 | #//device/dalvik/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.c 40 | 51000 socket_stats (send|1|2),(recv|1|2),(ip|1|5),(port|1|5),(close|1|5) 41 | diff --git a/rootdir/init.rc b/rootdir/init.rc 42 | index caef358..1db1713 100644 43 | --- a/rootdir/init.rc 44 | +++ b/rootdir/init.rc 45 | @@ -328,6 +328,7 @@ on boot 46 | # Define TCP buffer sizes for various networks 47 | # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax, 48 | setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208 49 | + setprop net.tcp.buffersize.ethernet 524288,1048576,2097152,262144,524288,1048576 50 | setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576 51 | setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576 52 | setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208 53 | 54 | --------------------------------------------------------------------------------