From fcc95a6d2c749d6b77eca14bf301d665d858a840 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Mon, 2 Nov 2015 13:43:29 -0800 Subject: Fix issue #25357209: Could not send SMS or MMS messages, had to reboot I think what probably happened is that since we only report an app going in to the "interaction" state as an interaction event to usage stats, apps that sit around in that state forever will only see one interaction at the start and never again. So usage stats could start thinking they are idle. Fix this by having the activity manager report an interaction event for such long running applications at least once a day. Also, because it is correct and for paranoia by protected us another way, system uids should never go in to standby. Change-Id: I8a3805bfca86cbe78560488a649ecd07427da99a --- services/core/java/com/android/server/am/ProcessRecord.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'services/core/java/com/android/server/am/ProcessRecord.java') diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java index bd31a21..697b4e2 100644 --- a/services/core/java/com/android/server/am/ProcessRecord.java +++ b/services/core/java/com/android/server/am/ProcessRecord.java @@ -114,6 +114,7 @@ final class ProcessRecord { boolean killed; // True once we know the process has been killed boolean procStateChanged; // Keep track of whether we changed 'setAdj'. boolean reportedInteraction;// Whether we have told usage stats about it being an interaction + long interactionEventTime; // The time we sent the last interaction event long fgInteractionTime; // When we became foreground for interaction purposes String waitingToKill; // Process is waiting to be killed when in the bg, and reason IBinder forcingToForeground;// Token that is forcing this process to be foreground @@ -297,6 +298,10 @@ final class ProcessRecord { if (reportedInteraction || fgInteractionTime != 0) { pw.print(prefix); pw.print("reportedInteraction="); pw.print(reportedInteraction); + if (interactionEventTime != 0) { + pw.print(" time="); + TimeUtils.formatDuration(interactionEventTime, SystemClock.elapsedRealtime(), pw); + } if (fgInteractionTime != 0) { pw.print(" fgInteractionTime="); TimeUtils.formatDuration(fgInteractionTime, SystemClock.elapsedRealtime(), pw); -- cgit v1.1 From 022c748f54626f77f01079595a0100d1d145f383 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 4 Nov 2015 12:32:45 -0800 Subject: Work on issue #25467052: System lagged out Add a new mechanism where we retain previously used provided processes in the "last activity" oom adj state for 20 seconds, before allowing them to fall down to a regular cached process. This should help reduce thrashing when something is acquiring and releasing a provider repeatedly. Change-Id: I889472de7bb4da574b46f07e36a99978813643cb --- services/core/java/com/android/server/am/ProcessRecord.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'services/core/java/com/android/server/am/ProcessRecord.java') diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java index 697b4e2..4e42c5c 100644 --- a/services/core/java/com/android/server/am/ProcessRecord.java +++ b/services/core/java/com/android/server/am/ProcessRecord.java @@ -136,6 +136,7 @@ final class ProcessRecord { long curCpuTime; // How long proc has run CPU most recently long lastRequestedGc; // When we last asked the app to do a gc long lastLowMemory; // When we last told the app that memory is low + long lastProviderTime; // The last time someone else was using a provider in this process. boolean reportLowMemory; // Set to true when waiting to report low mem boolean empty; // Is this an empty background process? boolean cached; // Is this a cached process? @@ -317,6 +318,11 @@ final class ProcessRecord { pw.print(" foregroundActivities="); pw.print(foregroundActivities); pw.print(" (rep="); pw.print(repForegroundActivities); pw.println(")"); } + if (lastProviderTime > 0) { + pw.print(prefix); pw.print("lastProviderTime="); + TimeUtils.formatDuration(lastProviderTime, now, pw); + pw.println(); + } if (hasStartedServices) { pw.print(prefix); pw.print("hasStartedServices="); pw.println(hasStartedServices); } -- cgit v1.1