OSDN Git Service

Finish already paused activity if it should be finished after pausing
authorWale Ogunwale <ogunwale@google.com>
Wed, 8 Jul 2015 21:19:44 +0000 (14:19 -0700)
committerWale Ogunwale <ogunwale@google.com>
Wed, 8 Jul 2015 21:19:44 +0000 (14:19 -0700)
If the app requests its activity to be finished allow it to be finished
immediately if the activity is already paused.

Bug: 22170595
Change-Id: I1ecc0d5f3b85fd80cbe8cdc1d4e32d5c6a50b20c

services/core/java/com/android/server/am/ActivityStack.java

index 8c3a950..31cdcd5 100644 (file)
@@ -2963,6 +2963,7 @@ final class ActivityStack {
         r.state = ActivityState.FINISHING;
 
         if (mode == FINISH_IMMEDIATELY
+                || (mode == FINISH_AFTER_PAUSE && prevState == ActivityState.PAUSED)
                 || prevState == ActivityState.STOPPED
                 || prevState == ActivityState.INITIALIZING) {
             // If this activity is already stopped, we can just finish