Merge "If resume occurs, force finish of exiting activity." into nyc-dev
This commit is contained in:
@@ -1249,7 +1249,7 @@ public class Activity extends ContextThemeWrapper
|
||||
protected void onResume() {
|
||||
if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this);
|
||||
getApplication().dispatchActivityResumed(this);
|
||||
mActivityTransitionState.onResume();
|
||||
mActivityTransitionState.onResume(this, isTopOfTask());
|
||||
mCalled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -236,9 +236,27 @@ class ActivityTransitionState {
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
restoreExitedViews();
|
||||
restoreReenteringViews();
|
||||
public void onResume(Activity activity, boolean isTopOfTask) {
|
||||
// After orientation change, the onResume can come in before the top Activity has
|
||||
// left, so if the Activity is not top, wait a second for the top Activity to exit.
|
||||
if (mCalledExitCoordinator == null) {
|
||||
return; // This is the called activity
|
||||
}
|
||||
if (isTopOfTask || mEnterTransitionCoordinator == null) {
|
||||
restoreExitedViews();
|
||||
restoreReenteringViews();
|
||||
} else {
|
||||
activity.mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mEnterTransitionCoordinator == null ||
|
||||
mEnterTransitionCoordinator.isWaitingForRemoteExit()) {
|
||||
restoreExitedViews();
|
||||
restoreReenteringViews();
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
||||
@@ -244,6 +244,10 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWaitingForRemoteExit() {
|
||||
return mIsReturning && mResultReceiver != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called onResume. If an Activity is resuming and the transitions
|
||||
* haven't started yet, force the views to appear. This is likely to be
|
||||
@@ -288,6 +292,10 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
|
||||
cancelPendingTransitions();
|
||||
}
|
||||
mAreViewsReady = true;
|
||||
if (mResultReceiver != null) {
|
||||
mResultReceiver.send(MSG_CANCEL, null);
|
||||
mResultReceiver = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
|
||||
@@ -100,6 +100,10 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
|
||||
mExitSharedElementBundle = resultData;
|
||||
sharedElementExitBack();
|
||||
break;
|
||||
case MSG_CANCEL:
|
||||
mIsCanceled = true;
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user