Maybe fix issue #17614177 APR: system process restarting due to infinite loop
Also try to get rid of a huge wtf we are seeing across a lot of devices
where we incorrectly change real states on a service that is restarting,
and get rid of one of the noisier boot logs in the package manager.
Change-Id: I2510b6fb082eac3f6168cbd57bc3b70ad006114d
diff --git a/core/java/com/android/internal/app/ProcessStats.java b/core/java/com/android/internal/app/ProcessStats.java
index 4995ea1..a92cb74 100644
--- a/core/java/com/android/internal/app/ProcessStats.java
+++ b/core/java/com/android/internal/app/ProcessStats.java
@@ -3570,6 +3570,10 @@
return mOwner != null || mRestarting;
}
+ public boolean isRestarting() {
+ return mRestarting;
+ }
+
void add(ServiceState other) {
addDurations(other);
mRunCount += other.mRunCount;
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 1f537be..3589f04 100755
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -895,6 +895,11 @@
while (clist.size() > 0) {
ConnectionRecord r = clist.get(0);
removeConnectionLocked(r, null, null);
+ if (clist.size() > 0 && clist.get(0) == r) {
+ // In case it didn't get removed above, do it now.
+ Slog.wtf(TAG, "Connection " + r + " not removed for binder " + binder);
+ clist.remove(0);
+ }
if (r.binding.service.app != null) {
// This could have made the service less important.
diff --git a/services/core/java/com/android/server/am/ProcessStatsService.java b/services/core/java/com/android/server/am/ProcessStatsService.java
index 7ec14c2..28e46a4 100644
--- a/services/core/java/com/android/server/am/ProcessStatsService.java
+++ b/services/core/java/com/android/server/am/ProcessStatsService.java
@@ -146,7 +146,9 @@
final ArrayMap<String, ProcessStats.ServiceState> services = pkg.mServices;
for (int isvc=services.size()-1; isvc>=0; isvc--) {
final ProcessStats.ServiceState service = services.valueAt(isvc);
- if (service.isInUse()) {
+ if (service.isRestarting()) {
+ service.setRestarting(true, memFactor, now);
+ } else if (service.isInUse()) {
if (service.mStartedState != ProcessStats.STATE_NOTHING) {
service.setStarted(true, memFactor, now);
}
@@ -157,7 +159,6 @@
service.setExecuting(true, memFactor, now);
}
}
-
}
}
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 5a94f23..a61d621 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -5589,9 +5589,11 @@
// update the package settings accordingly.
pkg.cpuAbiOverride = cpuAbiOverride;
- Slog.d(TAG, "Resolved nativeLibraryRoot for " + pkg.applicationInfo.packageName
- + " to root=" + pkg.applicationInfo.nativeLibraryRootDir + ", isa="
- + pkg.applicationInfo.nativeLibraryRootRequiresIsa);
+ if (DEBUG_ABI_SELECTION) {
+ Slog.d(TAG, "Resolved nativeLibraryRoot for " + pkg.applicationInfo.packageName
+ + " to root=" + pkg.applicationInfo.nativeLibraryRootDir + ", isa="
+ + pkg.applicationInfo.nativeLibraryRootRequiresIsa);
+ }
// Push the derived path down into PackageSettings so we know what to
// clean up at uninstall time.