Loading services/java/com/android/server/am/ActiveServices.java +14 −4 Original line number Diff line number Diff line Loading @@ -141,6 +141,12 @@ public final class ActiveServices { long timeoout; } int mAdditionalBootStartingBackground; public void onBootCompleted() { mAdditionalBootStartingBackground = 0; } /** * Information about services for a single user. */ Loading Loading @@ -206,7 +212,7 @@ public final class ActiveServices { } } while (mDelayedStartList.size() > 0 && mStartingBackground.size() < mMaxStartingBackground) { && mStartingBackground.size() < mMaxStartingBackground + mAdditionalBootStartingBackground) { ServiceRecord r = mDelayedStartList.remove(0); if (DEBUG_DELAYED_STATS) Slog.v(TAG, "REM FR DELAY LIST (exec next): " + r); if (r.pendingStarts.size() <= 0) { Loading @@ -232,7 +238,7 @@ public final class ActiveServices { Message msg = obtainMessage(MSG_BG_START_TIMEOUT); sendMessageAtTime(msg, when); } if (mStartingBackground.size() < mMaxStartingBackground) { if (mStartingBackground.size() < mMaxStartingBackground + mAdditionalBootStartingBackground) { mAm.backgroundServicesFinishedLocked(mUserId); } } Loading @@ -245,6 +251,10 @@ public final class ActiveServices { maxBg = Integer.parseInt(SystemProperties.get("ro.config.max_starting_bg", "0")); } catch(RuntimeException e) { } try { mAdditionalBootStartingBackground = Integer.parseInt(SystemProperties.get("persist.added_boot_bgservices", "0")); } catch(RuntimeException e) { } mMaxStartingBackground = maxBg > 0 ? maxBg : ActivityManager.isLowRamDeviceStatic() ? 1 : 3; } Loading @@ -257,7 +267,7 @@ public final class ActiveServices { boolean hasBackgroundServices(int callingUser) { ServiceMap smap = mServiceMap.get(callingUser); return smap != null ? smap.mStartingBackground.size() >= mMaxStartingBackground : false; return smap != null ? smap.mStartingBackground.size() >= mMaxStartingBackground + mAdditionalBootStartingBackground : false; } private ServiceMap getServiceMap(int callingUser) { Loading Loading @@ -339,7 +349,7 @@ public final class ActiveServices { if (DEBUG_DELAYED_STATS) Slog.v(TAG, "Continuing to delay: " + r); return r.name; } if (smap.mStartingBackground.size() >= mMaxStartingBackground) { if (smap.mStartingBackground.size() >= mMaxStartingBackground + mAdditionalBootStartingBackground) { // Something else is starting, delay! Slog.i(TAG, "Delaying start of: " + r); smap.mDelayedStartList.add(r); Loading services/java/com/android/server/am/ActivityManagerService.java +10 −0 Original line number Diff line number Diff line Loading @@ -9346,6 +9346,16 @@ public final class ActivityManagerService extends ActivityManagerNative IntentFilter bootFilter = new IntentFilter(AppInterface.CHECK_SCREEN_IDLE_ACTION); mContext.registerReceiver(new ScreenStatusReceiver(), bootFilter); // Register system boot completed event, set max serial background services num threshold to normal IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_BOOT_COMPLETED); mContext.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mServices.onBootCompleted(); } }, filter); synchronized(this) { // Make sure we have no pre-ready processes sitting around. Loading Loading
services/java/com/android/server/am/ActiveServices.java +14 −4 Original line number Diff line number Diff line Loading @@ -141,6 +141,12 @@ public final class ActiveServices { long timeoout; } int mAdditionalBootStartingBackground; public void onBootCompleted() { mAdditionalBootStartingBackground = 0; } /** * Information about services for a single user. */ Loading Loading @@ -206,7 +212,7 @@ public final class ActiveServices { } } while (mDelayedStartList.size() > 0 && mStartingBackground.size() < mMaxStartingBackground) { && mStartingBackground.size() < mMaxStartingBackground + mAdditionalBootStartingBackground) { ServiceRecord r = mDelayedStartList.remove(0); if (DEBUG_DELAYED_STATS) Slog.v(TAG, "REM FR DELAY LIST (exec next): " + r); if (r.pendingStarts.size() <= 0) { Loading @@ -232,7 +238,7 @@ public final class ActiveServices { Message msg = obtainMessage(MSG_BG_START_TIMEOUT); sendMessageAtTime(msg, when); } if (mStartingBackground.size() < mMaxStartingBackground) { if (mStartingBackground.size() < mMaxStartingBackground + mAdditionalBootStartingBackground) { mAm.backgroundServicesFinishedLocked(mUserId); } } Loading @@ -245,6 +251,10 @@ public final class ActiveServices { maxBg = Integer.parseInt(SystemProperties.get("ro.config.max_starting_bg", "0")); } catch(RuntimeException e) { } try { mAdditionalBootStartingBackground = Integer.parseInt(SystemProperties.get("persist.added_boot_bgservices", "0")); } catch(RuntimeException e) { } mMaxStartingBackground = maxBg > 0 ? maxBg : ActivityManager.isLowRamDeviceStatic() ? 1 : 3; } Loading @@ -257,7 +267,7 @@ public final class ActiveServices { boolean hasBackgroundServices(int callingUser) { ServiceMap smap = mServiceMap.get(callingUser); return smap != null ? smap.mStartingBackground.size() >= mMaxStartingBackground : false; return smap != null ? smap.mStartingBackground.size() >= mMaxStartingBackground + mAdditionalBootStartingBackground : false; } private ServiceMap getServiceMap(int callingUser) { Loading Loading @@ -339,7 +349,7 @@ public final class ActiveServices { if (DEBUG_DELAYED_STATS) Slog.v(TAG, "Continuing to delay: " + r); return r.name; } if (smap.mStartingBackground.size() >= mMaxStartingBackground) { if (smap.mStartingBackground.size() >= mMaxStartingBackground + mAdditionalBootStartingBackground) { // Something else is starting, delay! Slog.i(TAG, "Delaying start of: " + r); smap.mDelayedStartList.add(r); Loading
services/java/com/android/server/am/ActivityManagerService.java +10 −0 Original line number Diff line number Diff line Loading @@ -9346,6 +9346,16 @@ public final class ActivityManagerService extends ActivityManagerNative IntentFilter bootFilter = new IntentFilter(AppInterface.CHECK_SCREEN_IDLE_ACTION); mContext.registerReceiver(new ScreenStatusReceiver(), bootFilter); // Register system boot completed event, set max serial background services num threshold to normal IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_BOOT_COMPLETED); mContext.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mServices.onBootCompleted(); } }, filter); synchronized(this) { // Make sure we have no pre-ready processes sitting around. Loading