Don't throw exception for duplicate stop
A double stop request is possible when display is being locked.
An activity may receive a "sleep" message followed by "stop",
both of which try to move it to stopped state.
An example when this happens: a keyguard is set up and the screen
is being locked. The keyguard will occlude the activity, which
causes a transition to paused state and, eventually, to stopped
state. A "sleep" message can be sent sometime before "stop" message
and will ignore that activity is in the process of becoming stopped.
Change-Id: I09e2c26004664b6e73ac5c2b6fe88bdf8271cf34
Fixes: 74967786
Test: FrameworksCoreTests:ActivityThreadTest
diff --git a/core/java/android/app/ClientTransactionHandler.java b/core/java/android/app/ClientTransactionHandler.java
index 206495d..961bca2 100644
--- a/core/java/android/app/ClientTransactionHandler.java
+++ b/core/java/android/app/ClientTransactionHandler.java
@@ -78,9 +78,19 @@
public abstract void handleResumeActivity(IBinder token, boolean finalStateRequest,
boolean isForward, String reason);
- /** Stop the activity. */
+ /**
+ * Stop the activity.
+ * @param token Target activity token.
+ * @param show Flag indicating whether activity is still shown.
+ * @param configChanges Activity configuration changes.
+ * @param pendingActions Pending actions to be used on this or later stages of activity
+ * transaction.
+ * @param finalStateRequest Flag indicating if this call is handling final lifecycle state
+ * request for a transaction.
+ * @param reason Reason for performing this operation.
+ */
public abstract void handleStopActivity(IBinder token, boolean show, int configChanges,
- PendingTransactionActions pendingActions, String reason);
+ PendingTransactionActions pendingActions, boolean finalStateRequest, String reason);
/** Report that activity was stopped to server. */
public abstract void reportStop(PendingTransactionActions pendingActions);