Amlogic优化开机时间--提前网络连接
--- a/main.cpp +++ b/main.cpp @@ -35,6 +35,10 @@ #include "DnsProxyListener.h" #include "MDnsSdListener.h" #include "UidMarkMap.h" +extern "C" { +int ifc_enable(const char *ifname); +int ifc_disable(const char *ifname); +} static void coldboot(const char *path); static void sigchld_handler(int sig); @@ -51,7 +55,8 @@ int main() { // signal(SIGCHLD, sigchld_handler); blockSigpipe(); - + //enable eth early + ifc_enable("eth0"); if (!(nm = NetlinkManager::Instance())) { ALOGE("Unable to create NetlinkManager"); exit(1); -- --- a/services/java/com/android/server/EthernetService.java +++ b/services/java/com/android/server/EthernetService.java @@ -93,6 +93,8 @@ public class EthernetService<syncronized> extends IEthernetManager.Stub{ public EthernetService(Context context, EthernetStateTracker Tracker){ mTracker = Tracker; mContext = context; + + initEth(); mWakeLock = ((PowerManager)mContext.getSystemService(Context.POWER_SERVICE)).newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, TAG); @@ -113,9 +115,18 @@ public class EthernetService<syncronized> extends IEthernetManager.Stub{ Slog.v(TAG, "Trigger the ethernet monitor"); mTracker.StartPolling(); mDelayedHandler = new Handler(); + + checkIfNeddStart(); parserConf(createAuthFileName()); } - + + private void initEth() { + int state = getPersistedState(); + if (state == 1) { + NetworkUtils.disableInterface("eth0"); + } + } + public void checkIfNeddStart(){ isEthEnabled = getPersistedState(); Slog.v(TAG,"Ethernet dev enabled " + isEthEnabled ); --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -9908,30 +9907,67 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized (this) { readGrantedUriPermissionsLocked(); } - if (goingCallback != null) goingCallback.run(); synchronized (this) { - if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { - try { - List apps = AppGlobals.getPackageManager(). - getPersistentApplications(STOCK_PM_FLAGS); - if (apps != null) { - int N = apps.size(); - int i; - for (i=0; i<N; i++) { - ApplicationInfo info - = (ApplicationInfo)apps.get(i); - if (info != null && - !info.packageName.equals("android")) { - addAppLocked(info, false); + Thread thrd = new Thread( new Runnable() { + public void run() { + if ("mobile".equals(SystemProperties.get("sys.proj.type", null))) { + // first add bestv and washu apk for improved starup time. + try { + ApplicationInfo launch = mSelf.mContext.getPackageManager().getApplicationInfo( + "com.bestv.ott.baseservices", PackageManager.GET_UNINSTALLED_PACKAGES); + if(launch != null) { + //Slog.d(TAG,"add bestv apk to applock"); + synchronized(ActivityManagerService.this) { + addAppLocked(launch, false); + } } + } catch (NameNotFoundException e) { + //Slog.w(TAG,"get bestv apk error"); + } + + //add washu apk + try { + ApplicationInfo launch = mSelf.mContext.getPackageManager().getApplicationInfo( + "net.sunniwell.app.ott.chinamobile", PackageManager.GET_UNINSTALLED_PACKAGES); + if(launch != null) { + //Slog.d(TAG,"add washu apk to applock"); + synchronized(ActivityManagerService.this){ + addAppLocked(launch, false); + } + } + } catch (NameNotFoundException e) { + //Slog.w(TAG,"get washu apk error"); + } + } + + if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { + try { + List apps = AppGlobals.getPackageManager(). + getPersistentApplications(STOCK_PM_FLAGS); + if (apps != null) { + int N = apps.size(); + int i; + for (i=0; i<N; i++) { + ApplicationInfo info + = (ApplicationInfo)apps.get(i); + //Slog.d(TAG,"N="+N+",packageName="+info.packageName); + if (info != null && + !info.packageName.equals("android")) { + synchronized(ActivityManagerService.this){ + addAppLocked(info, false); + } + } + } + } + } catch (RemoteException ex) { + // pm is in same process, this will never happen. } } - } catch (RemoteException ex) { - // pm is in same process, this will never happen. } - } + }); + thrd.start(); // Start up initial activity. mBooting = true;
posted on 2018-10-24 16:56 world_hello!!!! 阅读(419) 评论(0) 编辑 收藏 举报