From 778b784eb6f78a467d010dbfb2ecd2ee0b3ac3fc Mon Sep 17 00:00:00 2001 From: HUANG Menghuai Date: Mon, 1 Apr 2013 12:40:51 +0800 Subject: [PATCH] [CB-2908] Fix the DroidGap activity Lifecycle broken issue Attempting to invoke the Activity's finish() onDestroy breaks an Activity's lifecycle flag. OnDestroy can be called by the system, for instance, on restarting an Activity, it's definitely different from a normal finish(). Finish() incorrectly in onDestroy results in another DroidGap derived activity is started, while the original one is not yet onDestroy. This issue could be found when the system is trying to restart the activity upon, for instance, receiving immediately successive device Config changes. --- framework/src/org/apache/cordova/DroidGap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index a9efc93e..bb895e25 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -718,7 +718,7 @@ public class DroidGap extends Activity implements CordovaInterface { appView.handleDestroy(); } else { - this.endActivity(); + this.activityState = ACTIVITY_EXITING; } }