summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-09-22 23:48:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-22 23:48:29 +0000
commitf9b70ab87e8f26b57ac3d8dc3b77052e747cb888 (patch)
tree008f1e343244dae78fe88b5f62fc5a189e031359
parentdbfceb7ea0f2925fa2e9cce4a5eece0b72d9c093 (diff)
parent2be00933163bb2bfa6b43cf2e1ddde7c284c7c4c (diff)
downloadframeworks_base-f9b70ab87e8f26b57ac3d8dc3b77052e747cb888.zip
frameworks_base-f9b70ab87e8f26b57ac3d8dc3b77052e747cb888.tar.gz
frameworks_base-f9b70ab87e8f26b57ac3d8dc3b77052e747cb888.tar.bz2
Merge "Debug issue #10876433 java.lang.IllegalStateException..." into klp-dev
-rw-r--r--services/java/com/android/server/am/ActiveServices.java30
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java19
-rw-r--r--services/java/com/android/server/am/AppNotRespondingDialog.java1
-rw-r--r--services/java/com/android/server/am/ServiceRecord.java1
4 files changed, 33 insertions, 18 deletions
diff --git a/services/java/com/android/server/am/ActiveServices.java b/services/java/com/android/server/am/ActiveServices.java
index 4379c70..fa1769f 100644
--- a/services/java/com/android/server/am/ActiveServices.java
+++ b/services/java/com/android/server/am/ActiveServices.java
@@ -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++;
@@ -2144,7 +2136,7 @@ public final class ActiveServices {
ActivityManagerService.SERVICE_TIMEOUT_MSG);
msg.obj = proc;
mAm.mHandler.sendMessageAtTime(msg, proc.execServicesFg
- ? (nextTime+SERVICE_TIMEOUT) : (nextTime+ SERVICE_BACKGROUND_TIMEOUT));
+ ? (nextTime+SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
}
}
@@ -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)
*/
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 47297c0..cbe97d2 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -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) {
@@ -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) {
@@ -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);
}
}
@@ -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) {
diff --git a/services/java/com/android/server/am/AppNotRespondingDialog.java b/services/java/com/android/server/am/AppNotRespondingDialog.java
index b5e0715..d0a0441 100644
--- a/services/java/com/android/server/am/AppNotRespondingDialog.java
+++ b/services/java/com/android/server/am/AppNotRespondingDialog.java
@@ -128,6 +128,7 @@ final class AppNotRespondingDialog extends BaseErrorDialog {
if (app.anrDialog == AppNotRespondingDialog.this) {
app.anrDialog = null;
}
+ mService.mServices.scheduleServiceTimeoutLocked(app);
}
break;
}
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 448117e..ac14da9 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -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) {