Loading services/java/com/android/server/am/ActiveServices.java +17 −13 Original line number Diff line number Diff line Loading @@ -1009,23 +1009,15 @@ public final class ActiveServices { stracker.setExecuting(true, mAm.mProcessStats.getMemFactorLocked(), now); } if (r.app != null) { if (r.app.executingServices.size() == 0) { Message msg = mAm.mHandler.obtainMessage( ActivityManagerService.SERVICE_TIMEOUT_MSG); msg.obj = r.app; mAm.mHandler.sendMessageAtTime(msg, fg ? (now+SERVICE_TIMEOUT) : (now+ SERVICE_BACKGROUND_TIMEOUT)); } r.app.executingServices.add(r); r.app.execServicesFg |= fg; if (r.app.executingServices.size() == 1) { scheduleServiceTimeoutLocked(r.app); } } } else if (r.app != null && fg && !r.app.execServicesFg) { mAm.mHandler.removeMessages(ActivityManagerService.SERVICE_TIMEOUT_MSG); Message msg = mAm.mHandler.obtainMessage( ActivityManagerService.SERVICE_TIMEOUT_MSG); msg.obj = r.app; mAm.mHandler.sendMessageAtTime(msg,now+SERVICE_TIMEOUT); r.app.execServicesFg = true; scheduleServiceTimeoutLocked(r.app); } r.executeFg |= fg; r.executeNesting++; Loading Loading @@ -2153,6 +2145,18 @@ public final class ActiveServices { } } void scheduleServiceTimeoutLocked(ProcessRecord proc) { if (proc.executingServices.size() == 0 || proc.thread == null) { return; } long now = SystemClock.uptimeMillis(); Message msg = mAm.mHandler.obtainMessage( ActivityManagerService.SERVICE_TIMEOUT_MSG); msg.obj = proc; mAm.mHandler.sendMessageAtTime(msg, proc.execServicesFg ? (now+SERVICE_TIMEOUT) : (now+ SERVICE_BACKGROUND_TIMEOUT)); } /** * Prints a list of ServiceRecords (dumpsys activity services) */ Loading services/java/com/android/server/am/ActivityManagerService.java +14 −5 Original line number Diff line number Diff line Loading @@ -2230,7 +2230,8 @@ public final class ActivityManagerService extends ActivityManagerNative mHandler.sendMessage(msg); } private final int updateLruProcessInternalLocked(ProcessRecord app, long now, int index) { private final int updateLruProcessInternalLocked(ProcessRecord app, long now, int index, String what, Object obj, ProcessRecord srcApp) { app.lastActivityTime = now; if (app.activities.size() > 0) { Loading @@ -2241,7 +2242,7 @@ public final class ActivityManagerService extends ActivityManagerNative int lrui = mLruProcesses.lastIndexOf(app); if (lrui < 0) { throw new IllegalStateException("Adding dependent process " + app + " not on LRU list!"); + " not on LRU list: " + what + obj + " from " + srcApp); } if (lrui >= mLruProcessActivityStart) { Loading Loading @@ -2309,13 +2310,15 @@ public final class ActivityManagerService extends ActivityManagerNative if (cr.binding != null && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) { nextIndex = updateLruProcessInternalLocked(cr.binding.service.app, now, nextIndex); nextIndex = updateLruProcessInternalLocked(cr.binding.service.app, now, nextIndex, "service connection", cr, app); } } for (int j=app.conProviders.size()-1; j>=0; j--) { ContentProviderRecord cpr = app.conProviders.get(j).provider; if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) { nextIndex = updateLruProcessInternalLocked(cpr.proc, now, nextIndex); nextIndex = updateLruProcessInternalLocked(cpr.proc, now, nextIndex, "provider reference", cpr, app); } } Loading Loading @@ -3863,7 +3866,13 @@ public final class ActivityManagerService extends ActivityManagerNative // 0 == show dialog, 1 = keep waiting, -1 = kill process immediately int res = mController.appNotResponding(app.processName, app.pid, info.toString()); if (res != 0) { if (res < 0 && app.pid != MY_PID) Process.killProcess(app.pid); if (res < 0 && app.pid != MY_PID) { Process.killProcess(app.pid); } else { synchronized (this) { mServices.scheduleServiceTimeoutLocked(app); } } return; } } catch (RemoteException e) { Loading services/java/com/android/server/am/AppNotRespondingDialog.java +1 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ final class AppNotRespondingDialog extends BaseErrorDialog { if (app.anrDialog == AppNotRespondingDialog.this) { app.anrDialog = null; } mService.mServices.scheduleServiceTimeoutLocked(app); } break; } Loading services/java/com/android/server/am/ServiceRecord.java +1 −0 Original line number Diff line number Diff line Loading @@ -253,6 +253,7 @@ final class ServiceRecord extends Binder { pw.print(" executeFg="); pw.print(executeFg); pw.print(" executingStart="); TimeUtils.formatDuration(executingStart, now, pw); pw.println(); } if (crashCount != 0 || restartCount != 0 || restartDelay != 0 || nextRestartTime != 0) { Loading Loading
services/java/com/android/server/am/ActiveServices.java +17 −13 Original line number Diff line number Diff line Loading @@ -1009,23 +1009,15 @@ public final class ActiveServices { stracker.setExecuting(true, mAm.mProcessStats.getMemFactorLocked(), now); } if (r.app != null) { if (r.app.executingServices.size() == 0) { Message msg = mAm.mHandler.obtainMessage( ActivityManagerService.SERVICE_TIMEOUT_MSG); msg.obj = r.app; mAm.mHandler.sendMessageAtTime(msg, fg ? (now+SERVICE_TIMEOUT) : (now+ SERVICE_BACKGROUND_TIMEOUT)); } r.app.executingServices.add(r); r.app.execServicesFg |= fg; if (r.app.executingServices.size() == 1) { scheduleServiceTimeoutLocked(r.app); } } } else if (r.app != null && fg && !r.app.execServicesFg) { mAm.mHandler.removeMessages(ActivityManagerService.SERVICE_TIMEOUT_MSG); Message msg = mAm.mHandler.obtainMessage( ActivityManagerService.SERVICE_TIMEOUT_MSG); msg.obj = r.app; mAm.mHandler.sendMessageAtTime(msg,now+SERVICE_TIMEOUT); r.app.execServicesFg = true; scheduleServiceTimeoutLocked(r.app); } r.executeFg |= fg; r.executeNesting++; Loading Loading @@ -2153,6 +2145,18 @@ public final class ActiveServices { } } void scheduleServiceTimeoutLocked(ProcessRecord proc) { if (proc.executingServices.size() == 0 || proc.thread == null) { return; } long now = SystemClock.uptimeMillis(); Message msg = mAm.mHandler.obtainMessage( ActivityManagerService.SERVICE_TIMEOUT_MSG); msg.obj = proc; mAm.mHandler.sendMessageAtTime(msg, proc.execServicesFg ? (now+SERVICE_TIMEOUT) : (now+ SERVICE_BACKGROUND_TIMEOUT)); } /** * Prints a list of ServiceRecords (dumpsys activity services) */ Loading
services/java/com/android/server/am/ActivityManagerService.java +14 −5 Original line number Diff line number Diff line Loading @@ -2230,7 +2230,8 @@ public final class ActivityManagerService extends ActivityManagerNative mHandler.sendMessage(msg); } private final int updateLruProcessInternalLocked(ProcessRecord app, long now, int index) { private final int updateLruProcessInternalLocked(ProcessRecord app, long now, int index, String what, Object obj, ProcessRecord srcApp) { app.lastActivityTime = now; if (app.activities.size() > 0) { Loading @@ -2241,7 +2242,7 @@ public final class ActivityManagerService extends ActivityManagerNative int lrui = mLruProcesses.lastIndexOf(app); if (lrui < 0) { throw new IllegalStateException("Adding dependent process " + app + " not on LRU list!"); + " not on LRU list: " + what + obj + " from " + srcApp); } if (lrui >= mLruProcessActivityStart) { Loading Loading @@ -2309,13 +2310,15 @@ public final class ActivityManagerService extends ActivityManagerNative if (cr.binding != null && cr.binding.service != null && cr.binding.service.app != null && cr.binding.service.app.lruSeq != mLruSeq) { nextIndex = updateLruProcessInternalLocked(cr.binding.service.app, now, nextIndex); nextIndex = updateLruProcessInternalLocked(cr.binding.service.app, now, nextIndex, "service connection", cr, app); } } for (int j=app.conProviders.size()-1; j>=0; j--) { ContentProviderRecord cpr = app.conProviders.get(j).provider; if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) { nextIndex = updateLruProcessInternalLocked(cpr.proc, now, nextIndex); nextIndex = updateLruProcessInternalLocked(cpr.proc, now, nextIndex, "provider reference", cpr, app); } } Loading Loading @@ -3863,7 +3866,13 @@ public final class ActivityManagerService extends ActivityManagerNative // 0 == show dialog, 1 = keep waiting, -1 = kill process immediately int res = mController.appNotResponding(app.processName, app.pid, info.toString()); if (res != 0) { if (res < 0 && app.pid != MY_PID) Process.killProcess(app.pid); if (res < 0 && app.pid != MY_PID) { Process.killProcess(app.pid); } else { synchronized (this) { mServices.scheduleServiceTimeoutLocked(app); } } return; } } catch (RemoteException e) { Loading
services/java/com/android/server/am/AppNotRespondingDialog.java +1 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ final class AppNotRespondingDialog extends BaseErrorDialog { if (app.anrDialog == AppNotRespondingDialog.this) { app.anrDialog = null; } mService.mServices.scheduleServiceTimeoutLocked(app); } break; } Loading
services/java/com/android/server/am/ServiceRecord.java +1 −0 Original line number Diff line number Diff line Loading @@ -253,6 +253,7 @@ final class ServiceRecord extends Binder { pw.print(" executeFg="); pw.print(executeFg); pw.print(" executingStart="); TimeUtils.formatDuration(executingStart, now, pw); pw.println(); } if (crashCount != 0 || restartCount != 0 || restartDelay != 0 || nextRestartTime != 0) { Loading