diff options
| author | 2013-10-23 15:14:22 -0700 | |
|---|---|---|
| committer | 2013-10-23 15:14:22 -0700 | |
| commit | 39e1c5a75ed850a78f3848628bcc336dd5776c4e (patch) | |
| tree | 63c0b88126bfb63e514e265094c86a86202a41e2 | |
| parent | 40006309990c40f5b4b26646b98df222d8d27922 (diff) | |
Search further than one task for fullscreen.
When a non-fullscreen task over home launches another non-fullscreen
task then the home task might not be displayed. Looking all the way
down the task stacks until reaching a visible, fullscreen activity or
home provides the right information.
Fixes bug 11273803.
Change-Id: I8dab0956c1cda06ddb7850ea3ffac7f6a223c6ad
| -rw-r--r-- | services/java/com/android/server/am/ActivityStack.java | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 22daaf315f92..497d48c56a41 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -977,6 +977,40 @@ final class ActivityStack { } /** + * Determine if home should be visible below the passed record. + * @param record activity we are querying for. + * @return true if home is visible below the passed activity, false otherwise. + */ + boolean isActivityOverHome(ActivityRecord record) { + // Start at record and go down, look for either home or a visible fullscreen activity. + final TaskRecord recordTask = record.task; + for (int taskNdx = mTaskHistory.indexOf(recordTask); taskNdx >= 0; --taskNdx) { + TaskRecord task = mTaskHistory.get(taskNdx); + final ArrayList<ActivityRecord> activities = task.mActivities; + final int startNdx = + task == recordTask ? activities.indexOf(record) : activities.size() - 1; + for (int activityNdx = startNdx; activityNdx >= 0; --activityNdx) { + final ActivityRecord r = activities.get(activityNdx); + if (r.isHomeActivity()) { + return true; + } + if (!r.finishing && r.visible && r.fullscreen) { + // Passed activity is over a visible fullscreen activity. + return false; + } + } + if (task.mOnTopOfHome) { + // Got to the bottom of a task on top of home without finding a visible fullscreen + // activity. Home is visible. + return true; + } + } + // Got to the bottom of this stack and still don't know. If this is over the home stack + // then record is over home. May not work if we ever get more than two layers. + return mStackSupervisor.isFrontStack(this); + } + + /** * Version of ensureActivitiesVisible that can easily be called anywhere. */ final boolean ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) { @@ -1101,24 +1135,10 @@ final class ActivityStack { // At this point, nothing else needs to be shown if (DEBUG_VISBILITY) Slog.v(TAG, "Fullscreen: at " + r); behindFullscreen = true; - } else if (task.mOnTopOfHome) { - // Work our way down from r to bottom of task and see if there are any - // visible activities below r. - int rIndex = task.mActivities.indexOf(r); - for ( --rIndex; rIndex >= 0; --rIndex) { - final ActivityRecord blocker = task.mActivities.get(rIndex); - if (!blocker.finishing) { - if (DEBUG_VISBILITY) Slog.v(TAG, "Home visibility for " + - r + " blocked by " + blocker); - break; - } - } - if (rIndex < 0) { - // Got to task bottom without finding a visible activity, show home. - if (DEBUG_VISBILITY) Slog.v(TAG, "Showing home: at " + r); - showHomeBehindStack = true; - behindFullscreen = true; - } + } else if (isActivityOverHome(r)) { + if (DEBUG_VISBILITY) Slog.v(TAG, "Showing home: at " + r); + showHomeBehindStack = true; + behindFullscreen = true; } } else { if (DEBUG_VISBILITY) Slog.v( |