Try again to fix issue #6912004:tap on gmail notification sends me to home screen
Add a new call to the activity manager to tell it when the activity
is resumed, so it can mark its state as dirty then instead of when
it first tries to create it.
Also tweak things to update the LRU list for the upcoming activity
at the point we start pausing the current activity, to avoid an
inefficiency where we may decide to kill the process of the upcoming
activity if it is at the end of the LRU list.
Change-Id: Ia6dc8c34dc6d4b085a1efbe3a5d5f47721d55078
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 989477f..db042b5 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1794,7 +1794,7 @@
}
private final void updateLruProcessInternalLocked(ProcessRecord app,
- boolean oomAdj, boolean updateActivityTime, int bestPos) {
+ boolean updateActivityTime, int bestPos) {
// put it on the LRU to keep track of when it should be exited.
int lrui = mLruProcesses.indexOf(app);
if (lrui >= 0) mLruProcesses.remove(lrui);
@@ -1851,7 +1851,7 @@
if (cr.binding != null && cr.binding.service != null
&& cr.binding.service.app != null
&& cr.binding.service.app.lruSeq != mLruSeq) {
- updateLruProcessInternalLocked(cr.binding.service.app, false,
+ updateLruProcessInternalLocked(cr.binding.service.app,
updateActivityTime, i+1);
}
}
@@ -1859,21 +1859,21 @@
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) {
- updateLruProcessInternalLocked(cpr.proc, false,
+ updateLruProcessInternalLocked(cpr.proc,
updateActivityTime, i+1);
}
}
-
- //Slog.i(TAG, "Putting proc to front: " + app.processName);
- if (oomAdj) {
- updateOomAdjLocked();
- }
}
final void updateLruProcessLocked(ProcessRecord app,
boolean oomAdj, boolean updateActivityTime) {
mLruSeq++;
- updateLruProcessInternalLocked(app, oomAdj, updateActivityTime, 0);
+ updateLruProcessInternalLocked(app, updateActivityTime, 0);
+
+ //Slog.i(TAG, "Putting proc to front: " + app.processName);
+ if (oomAdj) {
+ updateOomAdjLocked();
+ }
}
final ProcessRecord getProcessRecordLocked(
@@ -4455,7 +4455,13 @@
enableScreenAfterBoot();
}
}
-
+
+ public final void activityResumed(IBinder token) {
+ final long origId = Binder.clearCallingIdentity();
+ mMainStack.activityResumed(token);
+ Binder.restoreCallingIdentity(origId);
+ }
+
public final void activityPaused(IBinder token) {
final long origId = Binder.clearCallingIdentity();
mMainStack.activityPaused(token, false);