主题 : 为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏”选项) 复制链接 | 浏览器收藏 | 打印
级别: 骑士
UID: 29604
精华: 9
发帖: 171
金钱: 1830 两
威望: 366 点
贡献值: 9 点
综合积分: 522 分
注册时间: 2010-10-01
最后登录: 2016-04-13
楼主  发表于: 2012-01-02 23:03

 为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏”选项)

管理提醒: 本帖被 xoom 执行加亮操作(2012-01-03)
先分享一下修改后的图片
1.增加状态栏网络图标(有连接时才显示),去除信号图标
2. 增加设置“以太网设置”选项
3. 增加“从不待机”选项,对应的实际值是-1
[attachment=3306]
[attachment=3307]
[attachment=3308] 
[attachment=3311]


友善之臂有提供了1个软件用于设置开发板的有线网络。如果你因某些原因不想使用或不方便使用这个软件,本文讲述如何移植让系统框架支持以太网的设置(DHCP动态分配IP或手动静态设置IP)

主要是利用android-x86现成的Ethernet框架,添加到Tiny6410的android源码中,增加系统对Ethernet的支持。
本文所用的是友善Tiny6410 2011-11-16版本的Android源代码。所有的修改都是基于此版本进行的。
如果你懒得修改,可以直接用附件中改好的代码直接覆盖,当然前提是你使用的开发板型号、源代码版本一样才行。附件的内容仅供参考,除了增加Ethernet框架之外,还更改了一些默认设置。
==========================================================================================
先把友善android源代码解压放好
一、准备工具:curl和repo
yum install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /bin/repo
chmod a+x /bin/repo

二、创建文件夹
mkdir /opt/FriendlyARM/mini6410/ android /android-x86
cd /opt/FriendlyARM/mini6410/ android /android-x86

三、全部源码太大,只下载相关部分源码,gingerbread-x86代表2.3版本的源码
repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b gingerbread-x86
repo sync platform/frameworks/base
repo sync platform/packages/apps/Settings

四、移植framework部分(+号的行代表增加的内容,-号的行代表删除的内容)
源路径=/opt/FriendlyARM/mini6410/android/android-x86
目标路径=/opt/FriendlyARM/mini6410/android/Android-2.3.4
4.1.将源路径framework/base/ethernet 复制到目标路径的framework/base/目录下

4.2.修改目标路径的framework/base目录下的Android.mk
    vpn/java/android/net/vpn/IVpnService.aidl \
+    ethernet/java/android/net/ethernet/IEthernetManager.aidl \
    voip/java/android/net/sip/ISipSession.aidl \

4.3. 将源路径文件frameworks/base/services/java/com/android/server/EthernetService.java复制到目标路径frameworks/base/services/java/com/android/server/目录下

4.4. 修改目标路径framework/base/service/java/com/android/server目录下的ConnectivityService.java文件
import android.net.wifi.WifiStateTracker;
+import android.net.ethernet.EthernetStateTracker;
import android.net.wimax.WimaxManagerConstants;
//-----------------------------------------------------------------------------------------
if (mNetAttributes[n.mType] != null) {
    Slog.e(TAG, "Error in networkAttributes - ignoring attempt to redefine type " +
        n.mType);
    continue;
}
-if (mRadioAttributes[n.mRadio] == null) {
+if ((n.mType != ConnectivityManager.TYPE_ETHERNET) && (mRadioAttributes[n.mRadio] == null)) { //by bjw
    Slog.e(TAG, "Error in networkAttributes - ignoring attempt to use undefined " +
        "radio " + n.mRadio + " in network type " + n.mType);
    continue;
}
mNetAttributes[n.mType] = n;
mNetworksDefined++;
} catch(Exception e) {
+Slog.e(TAG, "wrong dev exception " + e); //by bjw
// ignore it - leave the entry null
}
//-----------------------------------------------------------------------------------------
wifiService.startWifi();
mNetTrackers[ConnectivityManager.TYPE_WIFI] = wst;
wst.startMonitoring();
break;
+case ConnectivityManager.TYPE_ETHERNET: //by bjw
+if (DBG) Slog.v(TAG, "#########Starting Ethernet Service.");  //by bjw
+EthernetStateTracker est = new EthernetStateTracker(context, mHandler);  //by bjw
+EthernetService ethService = new EthernetService(context, est);  //by bjw
+ServiceManager.addService(Context.ETHERNET_SERVICE, ethService);  //by bjw
+mNetTrackers[ConnectivityManager.TYPE_ETHERNET] = est;  //by bjw
+est.startMonitoring(); //by bjw
+break;//by bjw
case ConnectivityManager.TYPE_MOBILE:
//-----------------------------------------------------------------------------------------
if (noMobileData) {
    if (DBG) Slog.d(TAG, "tearing down WiMAX networks due to setting");
    mNetTrackers[netType].teardown();
}
break;
default:
// Slog.e(TAG, "Trying to create a DataStateTracker for an unknown radio type " +
// mNetAttributes[netType].mRadio);

4.5. 将源路径framework/base/core/jni/android_net_ethernet.cpp复制到目标路径framework/base/core/jni/目录下

4.6. 修改目标路径framework/base/core/jni/AndroidRuntime.cpp文件
extern int register_android_net_wifi_WifiManager(JNIEnv* env);
+extern int register_android_net_ethernet_EthernetManager(JNIEnv* env);
extern int register_android_security_Md5MessageDigest(JNIEnv *env);
//-----------------------------------------------------------------------------------------
REG_JNI(register_android_net_wifi_WifiManager),
+REG_JNI(register_android_net_ethernet_EthernetManager),
REG_JNI(register_android_nfc_NdefMessage),

4.7. 修改目标路径framework/base/core/jni/Android.mk文件,添加ethernetJNI接口文件的编译项
android_net_wifi_Wifi.cpp \
+android_net_ethernet.cpp \
android_nio_utils.cpp \

4.8. 修改目标路径framework/base/java/android/content/Context.java
public static final String WIFI_SERVICE = "wifi";
+public static final String ETHERNET_SERVICE = "ethernet";

4.9. 修改目标路径frameworks/base/core/java/android/provider/Settings.java
        public static final String WIFI_ON = "wifi_on";

+        /**
+         * Ethernet related configurations
+         */
+        public static final String ETHERNET_ON      = "ethernet_on";
+        public static final String ETHERNET_MODE    = "ethernet_mode";
+        public static final String ETHERNET_IP      = "ethernet_ip";
+        public static final String ETHERNET_MASK    = "ethernet_netmask";
+        public static final String ETHERNET_DNS     = "ethernet_dns";
+        public static final String ETHERNET_ROUTE   = "ethernet_iproute";
+        public static final String ETHERNET_CONF    = "ethernet_conf";
+        public static final String ETHERNET_IFNAME  = "ethernet_ifname";

4.10. 修改目标路径frameworks/base/core/java/android/app/ContextImpl.java
import android.net.wifi.WifiManager;
+import android.net.ethernet.IEthernetManager;//by bjw
+import android.net.ethernet.EthernetManager; //by bjw
import android.nfc.NfcManager;
//-----------------------------------------------------------------------------------------
private static WifiManager sWifiManager;
+private static EthernetManager sEthernetManager; //by bjw
private static LocationManager sLocationManager;
//-----------------------------------------------------------------------------------------
    } else if (WIFI_SERVICE.equals(name)) {
        return getWifiManager();
+    } else if (ETHERNET_SERVICE.equals(name)) {  //by bjw
+        return getEthernetManager();  //by bjw
    } else if (NOTIFICATION_SERVICE.equals(name)) {
        return getNotificationManager();
//-----------------------------------------------------------------------------------------
return sWifiManager;
    }
+    private EthernetManager getEthernetManager()  //by bjw
+    {  
+        synchronized (sSync) {  
+            if (sEthernetManager == null) {    
+                if (b == null) {
+                        Log.w(TAG, "Error getting service name:" + ETHERNET_SERVICE);
+                }
+                IBinder b = ServiceManager.getService(ETHERNET_SERVICE);  
+                IEthernetManager service = IEthernetManager.Stub.asInterface(b);  
+                sEthernetManager = new EthernetManager(service, mMainThread.getHandler());  
+            }  
+        }  
+        return sEthernetManager;  
+    }
private NotificationManager getNotificationManager() {

4.11. 修改目标路径frameworks/base/core/res/res/values/config.xml
<item><xliff:g id="id">wifi</xliff:g></item>
+<item><xliff:g id="id">ethernet</xliff:g></item>
<item><xliff:g id="id">cdma_eri</xliff:g></item>
//-----------------------------------------------------------------------------------------
<item>"mobile_hipri,5,0,3"</item>
+<item>"ethernet,9,9,1"</item>
</string-array>

五、移植packages部分
5.1.复制源路径packages/apps/Settings/src/com/android/settings/ethernet目录到目标路径packages/apps/Settings/src/com/android/settings/目录下;

5.2.复制源路径packages/apps/Settings/src/com/android/settings/EthernetSettings.java到目标路径packages/apps/Settings/src/com/android/settings/目录下;

5.3.复制源路径packages/apps/Settings/res/drawable-hdpi/ic_settings_ethernet.png到目标路径packages/apps/Settings/res/drawable-hdpi/目录下

5.4.复制源路径packages/apps/Settings/res/drawable-mdpi/ic_settings_ethernet.png到目标路径packages/apps/Settings/res/drawable-mdpi/目录下

5.5.复制源路径packages/apps/Settings/res/layout/eth_configure.xml到目标路径packages/apps/Settings/res/layout/目录下

5.6.复制源路径packages/apps/Settings/res/xml/ethernet_settings.xml到目标路径packages/apps/Settings/res/xml/目录下

5.7. 修改目标路径文件packages/apps/Settings/res/values/strings.xml
<string name="sound_category_feedback_title">Feedback</string>
+<!-- Ethernet configuration dialog -->  
+<string name="eth_config_title">Configure Ethernet device</string>  
+<string name="eth_setting">Ethernet setting</string>  
+<string name="eth_dev_list">Ethernet Devices:</string>  
+<string name="eth_con_type">Connection Type</string>  
+<string name="eth_con_type_dhcp">DHCP</string>  
+<string name="eth_con_type_manual">Static IP</string>  
+<string name="eth_dns">DNS address</string>  
+<string name="eth_gw">Default Gateway</string>  
+<string name="eth_ipaddr">IP address</string>  
+<string name="eth_quick_toggle_title">Ethernet</string>  
+<string name="eth_quick_toggle_summary">Turn on Ethernet</string>  
+<string name="eth_radio_ctrl_title">Ethernet configuration</string>  
+<string name="eth_conf_perf_title">Ethernet configuration</string>  
+<string name="eth_conf_summary">Configure Ethernet devices</string>  
+<string name="eth_mask">Netmask</string>  
+<string name="eth_toggle_summary_off">Turn off Ethernet</string>  
+<string name="eth_toggle_summary_on">Turn on Ethernet</string>  

5.8.修改目标路径packages/apps/Settings/res/values/arrays.xml
    <string-array name="screen_timeout_entries">
        <item>15 seconds</item>
        <item>30 seconds</item>
        <item>1 minute</item>
        <item>2 minutes</item>
        <item>10 minutes</item>
        <item>30 minutes</item>
+        <item>Never Timeout</item>
    </string-array>
//-----------------------------------------------------------------------------------------
    <!-- Do not translate. -->
    <string-array name="screen_timeout_values" translatable="false">
        <!-- Do not translate. -->
        <item>15000</item>
        <!-- Do not translate. -->
        <item>30000</item>
        <!-- Do not translate. -->
        <item>60000</item>
        <!-- Do not translate. -->
        <item>120000</item>
        <!-- Do not translate. -->
        <item>600000</item>
        <!-- Do not translate. -->
        <item>1800000</item>
+       <!-- Do not translate. -->
+       <item>-1</item>
</string-array>

5.9.修改目标路径文件packages/apps/Settings/res/values-zh-rCN/arrays.xml
  <string-array name="screen_timeout_entries">
    <item msgid="3342301044271143016">"15 秒"</item>
    <item msgid="8881760709354815449">"30 秒"</item>
    <item msgid="7589406073232279088">"1 分钟"</item>
    <item msgid="7001195990902244174">"2 分钟"</item>
    <item msgid="5721688686241190620">"10 分钟"</item>
    <item msgid="7156442995039264948">"30 分钟"</item>
+   <item msgid="1781492122915870416">"从不待机"</item>
  </string-array>

5.10.修改目标路径文件packages/apps/Settings/res/ values-zh-rCN-nokeys/strings.xml
<string name="applications_settings_summary" msgid="6616938758022986257">"管理应用程序"</string>
+    <!-- Ethernet configuration dialog -->  
+    <string name="eth_config_title">"设置以太网设备"</string>  
+    <string name="eth_setting">"以太网设置"</string>  
+    <string name="eth_dev_list">"以太网设置:"</string>  
+    <string name="eth_con_type">"连接类型"</string>  
+    <string name="eth_con_type_dhcp">"Dhcp动态分配IP"</string>  
+    <string name="eth_con_type_manual">"静态分配IP"</string>  
+    <string name="eth_dns">"DNS地址"</string>  
+    <string name="eth_gw">"网关"</string>  
+    <string name="eth_ipaddr">"IP地址"</string>  
+    <string name="eth_quick_toggle_title">"以太网"</string>  
+    <string name="eth_quick_toggle_summary">"打开以太网设备"</string>  
+    <string name="eth_radio_ctrl_title">"以太网设置"</string>  
+    <string name="eth_conf_perf_title">"以太网设置"</string>  
+    <string name="eth_conf_summary">"设置以太网设备"</string>  
+    <string name="eth_mask">"子网掩码"</string>  
+    <string name="eth_toggle_summary_off">"关闭以太网设备"</string>  
+    <string name="eth_toggle_summary_on">"打开以太网设备"</string>

5.11. 修改目标路径文件packages/apps/Settings/res/xml/settings.xml
<com.android.settings.IconPreferenceScreen
    android:title="@string/radio_controls_title"
    settings:icon="@drawable/ic_settings_wireless">
    <intent
    android:action="android.intent.action.MAIN"
    android:targetPackage="com.android.settings"
    android:targetClass="com.android.settings.WirelessSettings" />
</com.android.settings.IconPreferenceScreen>
+<com.android.settings.IconPreferenceScreen
+    android:title="@string/eth_radio_ctrl_title"  
+    settings:icon="@drawable/ic_settings_ethernet">  
+    <intent  
+    android:action="android.intent.action.MAIN"  
+    android:targetPackage="com.android.settings"  
+    android:targetClass="com.android.settings.EthernetSettings" />  
+</com.android.settings.IconPreferenceScreen>

5.12. 修改目标路径文件packages/apps/Settings/AndroidManifest.xml
+<!-- Ethernet controls -->  
+<activity android:name="EthernetSettings"  
+    android:label="@string/eth_radio_ctrl_title"  
+    >  
+    <intent-filter>  
+        <action android:name="android.intent.action.MAIN" />  
+        <action android:name="android.settings.ETHERNET_SETTINGS" />  
+        <category android:name="android.intent.category.DEFAULT" />  
+        <category android:name="android.intent.category.VOICE_LAUNCH" />  
+    </intent-filter>  
+</activity>  
+<activity android:name=".ethernet.EthernetEnabler" android:label="@string/eth_setting"  
+    android:clearTaskOnLaunch="true"  
+    >  
+    <intent-filter>  
+        <action android:name="android.intent.action.MAIN" />  
+        <action android:name="android.settings.ETHERNET_ENABLER_SETTINGS" />  
+        <category android:name="android.intent.category.DEFAULT" />  
+        <category android:name="android.intent.category.VOICE_LAUNCH" />  
+        <category android:name="com.android.settings.SHORTCUT" />  
+    </intent-filter>  
+</activity>  
+<activity android:name=".ethernet.EthernetConfigure" android:label="@string/eth_conf_perf_title"  
+    android:clearTaskOnLaunch="true"  
+    >  
+    <intent-filter>  
+        <action android:name="android.intent.action.MAIN" />  
+        <action android:name="android.settings.ETHERNET_CONFIGURE_SETTINGS" />  
+        <category android:name="android.intent.category.DEFAULT" />  
+        <category android:name="android.intent.category.VOICE_LAUNCH" />  
+        <category android:name="com.android.settings.SHORTCUT" />  
+    </intent-filter>  
+</activity>  
<!-- Wireless Controls -->

六、接下来要增加Ethernet的状态栏图标
6.1.复制源路径frameworks/base/packages/SystemUI/res/drawable-hdpi/connect_creating.png到目标路径对应目录下

6.2.复制源路径frameworks/base/packages/SystemUI/res/drawable-hdpi/connect_established.png到目标路径对应目录下

6.3.复制源路径frameworks/base/packages/SystemUI/res/drawable-hdpi/connect_no.png到目标路径对应目录下

6.4.复制源路径frameworks/base/packages/SystemUI/res/drawable-mdpi/connect_creating.png到目标路径对应目录下

6.5.复制源路径frameworks/base/packages/SystemUI/res/drawable-mdpi/connect_established.png到目标路径对应目录下

6.6.复制源路径frameworks/base/packages/SystemUI/res/drawable-mdpi/connect_no.png到目标路径对应目录下

6.7. 修改目标路径文件frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarPolicy.java
import android.net.wifi.WifiManager;
+import android.net.ethernet.EthernetManager;
+import android.net.ethernet.EthernetStateTracker;
import android.os.Binder;
//-----------------------------------------------------------------------------------------
import android.os.storage.StorageManager;
+import android.os.SystemProperties;
import android.provider.Settings;
//-----------------------------------------------------------------------------------------
private int mLastWifiSignalLevel = -1;
private boolean mIsWifiConnected = false;
// Ethernet
+private static final int[] sEthImages = {
+    R.drawable.connect_established,
+    R.drawable.connect_no,
+    R.drawable.connect_creating
+};
//-----------------------------------------------------------------------------------------
    else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION) ||
        action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION) ||
        action.equals(WifiManager.RSSI_CHANGED_ACTION)) {
            updateWifi(intent);
+    }  else if (action.equals(EthernetManager.ETHERNET_STATE_CHANGED_ACTION)) {
+        updateEth(intent);
    }
    else if (action.equals(LocationManager.GPS_ENABLED_CHANGE_ACTION) ||
        action.equals(LocationManager.GPS_FIX_CHANGE_ACTION)) {
            updateGps(intent);
    }
//-----------------------------------------------------------------------------------------
//如果不要2G/3G信号图标可如此更改,设置图标属性Visibility为false
mService.setIcon("phone_signal", mPhoneSignalIconId, 0);//在所有的这行下添加下面的一行,共4处
+mService.setIconVisibility("phone_signal", false);//此处是添加的
//-----------------------------------------------------------------------------------------
// wifi will get updated by the sticky intents
+// ethernet
+mService.setIcon("ethernet", sEthImages[0], 0);
+mService.setIconVisibility("ethernet", false);
//-----------------------------------------------------------------------------------------
filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
+filter.addAction(EthernetManager.ETHERNET_STATE_CHANGED_ACTION);
filter.addAction(LocationManager.GPS_ENABLED_CHANGE_ACTION);
//-----------------------------------------------------------------------------------------
updateSignalStrength(); // apply any change in mInetCondition
break;
+case ConnectivityManager.TYPE_ETHERNET:
+    if (info.isConnected()) {
+        mService.setIcon("ethernet", sEthImages[0], 0);
+        // Show the icon since ethernet is connected
+        mService.setIconVisibility("ethernet", true);
+    } else {
+        mService.setIcon("ethernet", sEthImages[1], 0);
+        // Hide the icon since we're not connected
+        mService.setIconVisibility("ethernet", false);
+    }
+    break;
case ConnectivityManager.TYPE_WIMAX:
            mInetCondition = inetCondition;
            if (info.isConnected()) {
                mIsWimaxConnected = true;
                mService.setIconVisibility("wimax", true);
            } else {
                mIsWimaxConnected = false;
            }
            updateWiMAX(intent);
            break;
//-----------------------------------------------------------------------------------------
mService.setIconVisibility("bluetooth", mBluetoothEnabled);
    }
+private final void updateEth(Intent intent) {
+    final int event = intent.getIntExtra(EthernetManager.EXTRA_ETHERNET_STATE, EthernetManager.ETHERNET_STATE_UNKNOWN);
+    int iconId;
+    switch (event) {
+            case EthernetStateTracker.EVENT_HW_CONNECTED:
+            case EthernetStateTracker.EVENT_INTERFACE_CONFIGURATION_SUCCEEDED:
+                mService.setIconVisibility("ethernet", true);
+                iconId = sEthImages[0];
+                break;
+            case EthernetStateTracker.EVENT_HW_DISCONNECTED:
+            case EthernetStateTracker.EVENT_INTERFACE_CONFIGURATION_FAILED:
+                mService.setIconVisibility("ethernet", false);
+                iconId = sEthImages[1];
+                return;
+            default:
+                iconId = sEthImages[2];
+    }
+    mService.setIcon("ethernet", iconId, 0);
+}
private final void updateWifi(Intent intent) {

6.8. 修改目标路径文件frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
//此步只是去除友善之臂添加的SeviceSocket服务而已,因为已经在系统中添加了Ethernet框架,所以SeviceSocket可以不要,但如果你还要使用友善提供的有线网络和3g网络的设置工具,那还是不要做此步骤以保留SeviceSocket服务。
package com.android.systemui.statusbar;
-import com.android.systemui.statusbar.SeviceSocket;
-import android.content.ComponentName;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import java.io.File;
-import java.io.FileReader;
-import java.util.Timer;
-import java.util.TimerTask;
import android.app.Service;
//-----------------------------------------------------------------------------------------
// for disabling the status bar
int mDisabled = 0;
-//F/r/i/e/n/d/l/y/A/R/M
-private static SeviceSocket seviceSocket = null;
-private NotificationManager myNotiManager;
//-----------------------------------------------------------------------------------------
// Put up the view
addStatusBarView();

// Lastly, call to the icon policy to install/update all the icons.
mIconPolicy = new StatusBarPolicy(this);

-//F/r/i/e/n/d/l/y/A/R/M
-myNotiManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
-seviceSocket = new SeviceSocket(new SeviceSocket.RecvCallBack() {
-    public void responseIncoming(String response) {
-        processNETStatusResponse(response);
-    }
-});
-timerToConnService.schedule(taskConnectService,1,8000);
-    }
-
-
-    //{{F-r-i-e-n-d-l-y-A-R-M
-    private void setStatusIcon(int iconId, String text) {
-        Intent notifyIntent=new Intent();
-        notifyIntent.setComponent(new ComponentName("com.friendlyarm.net3gdialup", "com.friendlyarm.net3gdialup.ActivityMain"));
-        notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        PendingIntent appIntent = PendingIntent.getActivity(this, 0,
-            notifyIntent, 0);
-        Notification myNoti = new Notification();
-        myNoti.icon = iconId;
-        myNoti.tickerText = text;
-        myNoti.defaults = Notification.DEFAULT_LIGHTS;
-        myNoti.setLatestEventInfo(this, "3G Network Status",text, appIntent);
-        myNotiManager.notify(0, myNoti);
-    }
-
-    private void removeStatusIcon() {
-        myNotiManager.cancelAll();
-    }
-
-    private int lastNetworkStatus = -1;
-    private boolean isConnectService = false;
-
-    private final int CONNECT_TO_SERVICE_MSG = 100;
-    private final int REQUEST_NETSTATUS_MSG = 101;
-
-    private Timer timerToConnService = new Timer();
-    private Timer timerToRequestStatus = new Timer();
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-            case CONNECT_TO_SERVICE_MSG:
-                timerToConnService.cancel();
-                seviceSocket.connectToService();
-                break;
-            case REQUEST_NETSTATUS_MSG:
-                seviceSocket.sendRequest("REQUEST NETSTATUS\n");
-                seviceSocket.recvResponse();
-                break;
-            }
-            super.handleMessage(msg);
-        }
-    };
-
-    private TimerTask taskConnectService = new TimerTask() {
-        public void run() {
-            Message message = new Message();
-            message.what = CONNECT_TO_SERVICE_MSG;
-            handler.sendMessage(message);
-        }
-    };
-
-    private TimerTask taskRequestNetStatus = new TimerTask() {
-        public void run() {
-            Message message = new Message();
-            message.what = REQUEST_NETSTATUS_MSG;
-            handler.sendMessage(message);
-        }
-    };
-
-    private void processNETStatusResponse(String response) {
-        String[] results = response.split(" ");
-
-        if (response.startsWith("RESPONSE CONNECT OK")) {
-            seviceSocket.sendRequest("REQUEST 3GAUTOCONNECT GETSTATUS");
-            seviceSocket.recvResponse();
-        } else if (response.startsWith(new String("RESPONSE 3GAUTOCONNECT")) && results.length == 6) {
-            if (Integer.parseInt(results[2]) == 1 && results[3].startsWith(new String("3GNET"))) {
-                timerToRequestStatus.schedule(taskRequestNetStatus,1,3000);
-            } else {
-                seviceSocket.disconnect();
-            }
-        } else if (response.startsWith(new String("RESPONSE NETSTATUS"))
-            && results.length >= 5) {
-                if (results[2].startsWith(new String("DOWN"))) {
-                    if (lastNetworkStatus != 0) {
-                        removeStatusIcon();
-                    }
-                    lastNetworkStatus = 0;
-                } else if (results[2].startsWith(new String("UP"))
-                    && results.length == 8) {
-                        if (lastNetworkStatus != 1) {
-                            setStatusIcon(com.android.internal.R.drawable.net3g, "Connected. (FriendlyARM-3G)");
-                        }
-                        lastNetworkStatus = 1;
-                }
-        }
-    }
-    //}}
}//这边增加一个括号
@Override
public void onDestroy() {
    // we're never destroyed
}

七、修改目标路径文件build/core/pathmap.mk
vpn \
+ethernet \
keystore \

八、编译并烧写 //如果编译出错,升级一下make程序:yum update make
注意:
如果对资源文件做了修改(添加/删除/修改),必须删掉临时编译文件,否则总是使用旧的临时文件编译;
针对APP,资源文件需删除的临时文件路径如下:
out/target/common/R/com/android;
out/target/common/obj/APPS;
out/target/product/tigger/obj/APPS;
然后make update-api
./build-android
最后记得修改init.rc,在最后增加DHCP服务
service dhcpcd_eth0 /system/bin/dhcpcd -ABKL
    disabled
oneshot
制作ROM烧写

九、使用
在自己的程序中,可以使用如下语句来转到以太网设置页面
Intent intent = new Intent("android.settings.ETHERNET_SETTINGS");
startActivity(intent);


这个是本文的源文档,因为是直接从这里复制粘贴过来的,如果看不清的话,可以下载到本地看
[attachment=3309]
这个是改好的源代码,只涉及有修改增加的部分
[attachment=3310]
[ 此帖被benjaminwan在2012-01-03 08:37重新编辑 ]
附件设置隐藏,需要回复后才能看到
级别: 骑士
UID: 29604
精华: 9
发帖: 171
金钱: 1830 两
威望: 366 点
贡献值: 9 点
综合积分: 522 分
注册时间: 2010-10-01
最后登录: 2016-04-13
1楼  发表于: 2012-01-03 08:42

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

沙发自己座
级别: 侠客
UID: 23173
精华: 0
发帖: 50
金钱: 250 两
威望: 50 点
贡献值: 0 点
综合积分: 100 分
注册时间: 2010-06-14
最后登录: 2017-03-05
2楼  发表于: 2012-01-04 14:16

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

正在考虑这个问题,就有高手解决了
级别: 荣誉会员
UID: 34761
精华: 0
发帖: 1349
金钱: 6835 两
威望: 1367 点
贡献值: 0 点
综合积分: 2698 分
注册时间: 2010-12-21
最后登录: 2017-06-02
3楼  发表于: 2012-01-04 16:49

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

太强大了
级别: 新手上路
UID: 61672
精华: 0
发帖: 1
金钱: 5 两
威望: 1 点
贡献值: 0 点
综合积分: 2 分
注册时间: 2012-01-04
最后登录: 2012-01-05
4楼  发表于: 2012-01-04 18:09

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

我看看 正需要这个。
级别: 骑士
UID: 42149
精华: 2
发帖: 201
金钱: 1115 两
威望: 223 点
贡献值: 2 点
综合积分: 442 分
注册时间: 2011-04-05
最后登录: 2013-03-29
5楼  发表于: 2012-01-11 14:51

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

参考学习一下。
级别: 新手上路
UID: 61134
精华: 0
发帖: 29
金钱: 145 两
威望: 29 点
贡献值: 0 点
综合积分: 58 分
注册时间: 2011-12-23
最后登录: 2012-02-17
6楼  发表于: 2012-01-11 22:14

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

牛X
级别: 新手上路
UID: 52575
精华: 0
发帖: 12
金钱: 60 两
威望: 12 点
贡献值: 0 点
综合积分: 24 分
注册时间: 2011-07-21
最后登录: 2012-07-20
7楼  发表于: 2012-01-12 17:00

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

    
级别: 侠客
UID: 9006
精华: 0
发帖: 89
金钱: 455 两
威望: 97 点
贡献值: 0 点
综合积分: 178 分
注册时间: 2009-09-14
最后登录: 2017-12-05
8楼  发表于: 2012-01-16 23:41

 Re:为Tiny6410Android2.3.4系统添加Ethernet框架支持(含去除状态栏信号图标及增加屏幕超时“永不关屏” ..

直接上补丁就好
级别: 侠客
UID: 51588
精华: 0
发帖: 124
金钱: 655 两
威望: 131 点
贡献值: 0 点
综合积分: 248 分
注册时间: 2011-07-05
最后登录: 2017-09-13
9楼  发表于: 2012-01-30 08:32

 回 楼主(benjaminwan) 的帖子

顶了啊啊啊啊啊啊啊啊