diff options
| author | 2012-10-24 11:01:07 -0700 | |
|---|---|---|
| committer | 2012-10-24 11:01:07 -0700 | |
| commit | cc9106bb7ae91affb4c5cd489a29f1971eca5974 (patch) | |
| tree | b41d0e243a9267edd8f35f46ca14bacb426d3c82 | |
| parent | 4d56a16728b21b2825500c24b5af1b4e0573a15e (diff) | |
| parent | ecf4725ef4e753a2ef08205c922391753eb3803f (diff) | |
am ecf4725e: Merge "Fix issue #7401818: Wrong transition animation when clearing task" into jb-mr1-dev
* commit 'ecf4725ef4e753a2ef08205c922391753eb3803f':
Fix issue #7401818: Wrong transition animation when clearing task
| -rw-r--r-- | services/java/com/android/server/am/ActivityRecord.java | 15 | ||||
| -rwxr-xr-x | services/java/com/android/server/am/ActivityStack.java | 34 |
2 files changed, 48 insertions, 1 deletions
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index b9f5b5b2a780..749dc6651d38 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -602,6 +602,15 @@ final class ActivityRecord { } } + void updateOptionsLocked(ActivityOptions options) { + if (options != null) { + if (pendingOptions != null) { + pendingOptions.abort(); + } + pendingOptions = options; + } + } + void applyOptionsLocked() { if (pendingOptions != null) { final int animationType = pendingOptions.getAnimationType(); @@ -653,6 +662,12 @@ final class ActivityRecord { } } + ActivityOptions takeOptionsLocked() { + ActivityOptions opts = pendingOptions; + pendingOptions = null; + return opts; + } + void removeUriPermissionsLocked() { if (uriPermissions != null) { uriPermissions.removeUriPermissionsLocked(); diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 4bcb339b1479..4546dc3a8290 100755 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -1963,6 +1963,8 @@ final class ActivityStack { int taskTopI = -1; int replyChainEnd = -1; int lastReparentPos = -1; + ActivityOptions topOptions = null; + boolean canMoveOptions = true; for (int i=mHistory.size()-1; i>=-1; i--) { ActivityRecord below = i >= 0 ? mHistory.get(i) : null; @@ -2048,6 +2050,7 @@ final class ActivityStack { } int dstPos = 0; ThumbnailHolder curThumbHolder = target.thumbHolder; + boolean gotOptions = !canMoveOptions; for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { p = mHistory.get(srcPos); if (p.finishing) { @@ -2057,6 +2060,13 @@ final class ActivityStack { + " out to target's task " + target.task); p.setTask(target.task, curThumbHolder, false); curThumbHolder = p.thumbHolder; + canMoveOptions = false; + if (!gotOptions && topOptions == null) { + topOptions = p.takeOptionsLocked(); + if (topOptions != null) { + gotOptions = true; + } + } if (DEBUG_ADD_REMOVE) { RuntimeException here = new RuntimeException("here"); here.fillInStackTrace(); @@ -2101,11 +2111,19 @@ final class ActivityStack { replyChainEnd = targetI; } ActivityRecord p = null; + boolean gotOptions = !canMoveOptions; for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) { p = mHistory.get(srcPos); if (p.finishing) { continue; } + canMoveOptions = false; + if (!gotOptions && topOptions == null) { + topOptions = p.takeOptionsLocked(); + if (topOptions != null) { + gotOptions = true; + } + } if (finishActivityLocked(p, srcPos, Activity.RESULT_CANCELED, null, "reset", false)) { replyChainEnd--; @@ -2245,7 +2263,17 @@ final class ActivityStack { target = below; targetI = i; } - + + if (topOptions != null) { + // If we got some ActivityOptions from an activity on top that + // was removed from the task, propagate them to the new real top. + if (taskTop != null) { + taskTop.updateOptionsLocked(topOptions); + } else { + topOptions.abort(); + } + } + return taskTop; } @@ -2296,6 +2324,10 @@ final class ActivityStack { if (r.finishing) { continue; } + ActivityOptions opts = r.takeOptionsLocked(); + if (opts != null) { + ret.updateOptionsLocked(opts); + } if (finishActivityLocked(r, i, Activity.RESULT_CANCELED, null, "clear", false)) { i--; |