summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java4
-rw-r--r--services/java/com/android/server/am/ActivityStack.java49
-rw-r--r--services/java/com/android/server/am/ActivityStackSupervisor.java17
3 files changed, 45 insertions, 25 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index c750cad29c04..da06c030e83d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -2341,6 +2341,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
void updateUsageStats(ActivityRecord resumedComponent, boolean resumed) {
+ if (DEBUG_SWITCH) Slog.d(TAG, "updateUsageStats: comp=" + resumedComponent + "res="
+ + resumed);
if (resumed) {
mUsageStatsService.noteResumeComponent(resumedComponent.realActivity);
} else {
@@ -6782,7 +6784,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (DEBUG_PROVIDER) {
RuntimeException e = new RuntimeException("here");
- Slog.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + r.uid
+ Slog.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + (r != null ? r.uid : null)
+ " pruid " + cpr.appInfo.uid + "): " + cpr.info.name, e);
}
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 675823a0688c..f0333d877cf1 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -668,7 +668,6 @@ final class ActivityStack {
checkReadyForSleepLocked();
}
- // Checked.
void checkReadyForSleepLocked() {
if (!mService.isSleepingOrShuttingDown()) {
// Do not care.
@@ -1003,7 +1002,6 @@ final class ActivityStack {
prev.cpuTimeAtResume = 0; // reset it
}
- // Checked.
/**
* Once we know that we have asked an application to put an activity in
* the resumed state (either by launching it or explicitly telling it),
@@ -1034,13 +1032,28 @@ final class ActivityStack {
}
}
- // Checked.
+ /**
+ * Version of ensureActivitiesVisible that can easily be called anywhere.
+ */
+ final boolean ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) {
+ return ensureActivitiesVisibleLocked(starting, configChanges, false);
+ }
+
+ final boolean ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges,
+ boolean forceHomeShown) {
+ ActivityRecord r = topRunningActivityLocked(null);
+ if (r != null) {
+ return ensureActivitiesVisibleLocked(r, starting, null, configChanges, forceHomeShown);
+ }
+ return false;
+ }
+
/**
* Make sure that all activities that need to be visible (that is, they
* currently can be seen by the user) actually are.
*/
- final void ensureActivitiesVisibleLocked(ActivityRecord top,
- ActivityRecord starting, String onlyThisProcess, int configChanges) {
+ final boolean ensureActivitiesVisibleLocked(ActivityRecord top, ActivityRecord starting,
+ String onlyThisProcess, int configChanges, boolean forceHomeShown) {
if (DEBUG_VISBILITY) Slog.v(
TAG, "ensureActivitiesVisible behind " + top
+ " configChanges=0x" + Integer.toHexString(configChanges));
@@ -1048,7 +1061,9 @@ final class ActivityStack {
// If the top activity is not fullscreen, then we need to
// make sure any activities under it are now visible.
boolean aboveTop = true;
- boolean behindFullscreen = !mStackSupervisor.isFrontStack(this);
+ boolean showHomeBehindStack = false;
+ boolean behindFullscreen = !mStackSupervisor.isFrontStack(this) &&
+ !(forceHomeShown && isHomeStack());
int taskNdx;
for (taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
@@ -1129,8 +1144,11 @@ final class ActivityStack {
if (r.fullscreen) {
// At this point, nothing else needs to be shown
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Stopping: fullscreen at " + r);
+ if (DEBUG_VISBILITY) Slog.v(TAG, "Fullscreen: at " + r);
+ behindFullscreen = true;
+ } else if (r.mLaunchHomeTaskNext) {
+ if (DEBUG_VISBILITY) Slog.v(TAG, "Showing home: at " + r);
+ showHomeBehindStack = true;
behindFullscreen = true;
}
} else {
@@ -1163,18 +1181,7 @@ final class ActivityStack {
}
}
}
- }
-
- // Checked.
- /**
- * Version of ensureActivitiesVisible that can easily be called anywhere.
- */
- final void ensureActivitiesVisibleLocked(ActivityRecord starting,
- int configChanges) {
- ActivityRecord r = topRunningActivityLocked(null);
- if (r != null) {
- ensureActivitiesVisibleLocked(r, starting, null, configChanges);
- }
+ return showHomeBehindStack;
}
/**
@@ -1190,7 +1197,6 @@ final class ActivityStack {
return resumeTopActivityLocked(prev, null);
}
- // Checked.
final boolean resumeTopActivityLocked(ActivityRecord prev, Bundle options) {
// Find the first activity that is not finishing.
ActivityRecord next = topRunningActivityLocked(null);
@@ -2173,7 +2179,6 @@ final class ActivityStack {
}
}
- // Checked.
final ActivityRecord activityIdleInternalLocked(final IBinder token, boolean fromTimeout,
Configuration config) {
if (localLOGV) Slog.v(TAG, "Activity idle: " + token);
diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java
index 82944a96f717..4c9c19cf7250 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -346,7 +346,7 @@ public class ActivityStackSupervisor {
throw e;
}
} else {
- stack.ensureActivitiesVisibleLocked(hr, null, processName, 0);
+ stack.ensureActivitiesVisibleLocked(hr, null, processName, 0, false);
}
}
}
@@ -1941,8 +1941,21 @@ public class ActivityStackSupervisor {
}
void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) {
+ // First the front stacks. In case any are not fullscreen and are in front of home.
+ boolean showHomeBehindStack = false;
for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
- mStacks.get(stackNdx).ensureActivitiesVisibleLocked(starting, configChanges);
+ final ActivityStack stack = mStacks.get(stackNdx);
+ if (isFrontStack(stack)) {
+ showHomeBehindStack =
+ stack.ensureActivitiesVisibleLocked(starting, configChanges);
+ }
+ }
+ // Now do back stacks.
+ for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ final ActivityStack stack = mStacks.get(stackNdx);
+ if (!isFrontStack(stack)) {
+ stack.ensureActivitiesVisibleLocked(starting, configChanges, showHomeBehindStack);
+ }
}
}