Platform: RK3288
OS: Android 7.1
Kernel: v4.4.83
现象:
手动去设置里面配置静态IP,保存后掉电开机,偶发无法进入系统的情况。
Log:
01-24 14:47:55.696 518 518 I EthernetServiceImpl: Creating EthernetConfigStore
01-24 14:47:55.697 518 518 E IpConfigStore: Bad version on IP configuration file, ignore read
01-24 14:47:55.697 518 518 E System : ******************************************
01-24 14:47:55.698 518 518 E System : ************ Failure starting system services
01-24 14:47:55.698 518 518 E System : java.lang.RuntimeException: Failed to create service com.android.server.ethernet.EthernetService: service constructor threw an exception
01-24 14:47:55.698 518 518 E System : at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:104)
01-24 14:47:55.698 518 518 E System : at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:67)
01-24 14:47:55.698 518 518 E System : at com.android.server.SystemServer.startOtherServices(SystemServer.java:880)
01-24 14:47:55.698 518 518 E System : at com.android.server.SystemServer.run(SystemServer.java:343)
01-24 14:47:55.698 518 518 E System : at com.android.server.SystemServer.main(SystemServer.java:225)
01-24 14:47:55.698 518 518 E System : at java.lang.reflect.Method.invoke(Native Method)
01-24 14:47:55.698 518 518 E System : at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
01-24 14:47:55.698 518 518 E System : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
01-24 14:47:55.698 518 518 E System : Caused by: java.lang.reflect.InvocationTargetException
01-24 14:47:55.698 518 518 E System : at java.lang.reflect.Constructor.newInstance0(Native Method)
01-24 14:47:55.698 518 518 E System : at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
01-24 14:47:55.698 518 518 E System : at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:93)
01-24 14:47:55.698 518 518 E System : ... 7 more
01-24 14:47:55.698 518 518 E System : Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.util.SparseArray.size()' on a null object reference
01-24 14:47:55.698 518 518 E System : at com.android.server.ethernet.EthernetConfigStore.readIpAndProxyConfigurations(EthernetConfigStore.java:44)
01-24 14:47:55.698 518 518 E System : at com.android.server.ethernet.EthernetServiceImpl.(EthernetServiceImpl.java:64)
01-24 14:47:55.698 518 518 E System : at com.android.server.ethernet.EthernetService.(EthernetService.java:30)
01-24 14:47:55.698 518 518 E System : ... 10 more
01-24 14:47:55.698 518 518 D AndroidRuntime: Shutting down VM
原因:
不能开机是因为以太网服务读到的ipconfig.txt文件异常而一直重启服务,导致系统卡住。
而ipconfig.txt异常是因为系统对文件缓存引起,掉电的时候文件内容还没有完全刷到文件中。
临时方案:
kris@eco:~/rk3288/frameworks/base
diff --git a/services/core/java/com/android/server/net/IpConfigStore.java b/services/core/java/com/an
index a1f12f4..ebad5ff 100644
--- a/services/core/java/com/android/server/net/IpConfigStore.java
+++ b/services/core/java/com/android/server/net/IpConfigStore.java
@@ -186,7 +186,8 @@ public class IpConfigStore {
int version = in.readInt();
if (version != 2 && version != 1) {
loge("Bad version on IP configuration file, ignore read");
- return null;
+ return networks;
}
此方法只能临时解决无法开机的问题,但是ip的缓存问题还需要更好的方法去解决。
关于缓存:
参考:
文件系统FAQ.pdf