Merge "Revert "Internal API for cross-task Activity used by assistant."" into nyc-mr1-dev
am: fe3ecdab1b
* commit 'fe3ecdab1b461d811825ce363d7041f3c8c120c3':
Revert "Internal API for cross-task Activity used by assistant."
Change-Id: If16a43f4a17e71cc12ed7c912ed5e6a46c85e56c
This commit is contained in:
@@ -4219,7 +4219,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
public void startActivityForResult(@RequiresPermission Intent intent, int requestCode,
|
public void startActivityForResult(@RequiresPermission Intent intent, int requestCode,
|
||||||
@Nullable Bundle options) {
|
@Nullable Bundle options) {
|
||||||
if (mParent == null) {
|
if (mParent == null) {
|
||||||
options = transferSpringboardActivityOptions(options);
|
|
||||||
Instrumentation.ActivityResult ar =
|
Instrumentation.ActivityResult ar =
|
||||||
mInstrumentation.execStartActivity(
|
mInstrumentation.execStartActivity(
|
||||||
this, mMainThread.getApplicationThread(), mToken, this,
|
this, mMainThread.getApplicationThread(), mToken, this,
|
||||||
@@ -4268,14 +4267,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bundle transferSpringboardActivityOptions(Bundle options) {
|
|
||||||
if (options == null && (mWindow != null && !mWindow.isActive())) {
|
|
||||||
return mActivityTransitionState.transferEnterActivityOptions();
|
|
||||||
} else {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide Implement to provide correct calling token.
|
* @hide Implement to provide correct calling token.
|
||||||
*/
|
*/
|
||||||
@@ -4291,7 +4282,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
if (mParent != null) {
|
if (mParent != null) {
|
||||||
throw new RuntimeException("Can't be called from a child");
|
throw new RuntimeException("Can't be called from a child");
|
||||||
}
|
}
|
||||||
options = transferSpringboardActivityOptions(options);
|
|
||||||
Instrumentation.ActivityResult ar = mInstrumentation.execStartActivity(
|
Instrumentation.ActivityResult ar = mInstrumentation.execStartActivity(
|
||||||
this, mMainThread.getApplicationThread(), mToken, this, intent, requestCode,
|
this, mMainThread.getApplicationThread(), mToken, this, intent, requestCode,
|
||||||
options, user);
|
options, user);
|
||||||
@@ -4327,7 +4317,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
if (mParent != null) {
|
if (mParent != null) {
|
||||||
throw new RuntimeException("Can't be called from a child");
|
throw new RuntimeException("Can't be called from a child");
|
||||||
}
|
}
|
||||||
options = transferSpringboardActivityOptions(options);
|
|
||||||
Instrumentation.ActivityResult ar =
|
Instrumentation.ActivityResult ar =
|
||||||
mInstrumentation.execStartActivity(
|
mInstrumentation.execStartActivity(
|
||||||
this, mMainThread.getApplicationThread(), mToken, this,
|
this, mMainThread.getApplicationThread(), mToken, this,
|
||||||
@@ -4360,7 +4349,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
if (mParent != null) {
|
if (mParent != null) {
|
||||||
throw new RuntimeException("Can't be called from a child");
|
throw new RuntimeException("Can't be called from a child");
|
||||||
}
|
}
|
||||||
options = transferSpringboardActivityOptions(options);
|
|
||||||
Instrumentation.ActivityResult ar =
|
Instrumentation.ActivityResult ar =
|
||||||
mInstrumentation.execStartActivityAsCaller(
|
mInstrumentation.execStartActivityAsCaller(
|
||||||
this, mMainThread.getApplicationThread(), mToken, this,
|
this, mMainThread.getApplicationThread(), mToken, this,
|
||||||
@@ -4800,7 +4788,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
*/
|
*/
|
||||||
public void startActivityFromChild(@NonNull Activity child, @RequiresPermission Intent intent,
|
public void startActivityFromChild(@NonNull Activity child, @RequiresPermission Intent intent,
|
||||||
int requestCode, @Nullable Bundle options) {
|
int requestCode, @Nullable Bundle options) {
|
||||||
options = transferSpringboardActivityOptions(options);
|
|
||||||
Instrumentation.ActivityResult ar =
|
Instrumentation.ActivityResult ar =
|
||||||
mInstrumentation.execStartActivity(
|
mInstrumentation.execStartActivity(
|
||||||
this, mMainThread.getApplicationThread(), mToken, child,
|
this, mMainThread.getApplicationThread(), mToken, child,
|
||||||
@@ -4866,7 +4853,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
if (referrer != null) {
|
if (referrer != null) {
|
||||||
intent.putExtra(Intent.EXTRA_REFERRER, referrer);
|
intent.putExtra(Intent.EXTRA_REFERRER, referrer);
|
||||||
}
|
}
|
||||||
options = transferSpringboardActivityOptions(options);
|
|
||||||
Instrumentation.ActivityResult ar =
|
Instrumentation.ActivityResult ar =
|
||||||
mInstrumentation.execStartActivity(
|
mInstrumentation.execStartActivity(
|
||||||
this, mMainThread.getApplicationThread(), mToken, who,
|
this, mMainThread.getApplicationThread(), mToken, who,
|
||||||
@@ -6664,11 +6650,11 @@ public class Activity extends ContextThemeWrapper
|
|||||||
mVisibleFromClient = !mWindow.getWindowStyle().getBoolean(
|
mVisibleFromClient = !mWindow.getWindowStyle().getBoolean(
|
||||||
com.android.internal.R.styleable.Window_windowNoDisplay, false);
|
com.android.internal.R.styleable.Window_windowNoDisplay, false);
|
||||||
mFragments.dispatchActivityCreated();
|
mFragments.dispatchActivityCreated();
|
||||||
|
mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
final void performCreate(Bundle icicle) {
|
final void performCreate(Bundle icicle) {
|
||||||
restoreHasCurrentPermissionRequest(icicle);
|
restoreHasCurrentPermissionRequest(icicle);
|
||||||
mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
|
|
||||||
onCreate(icicle);
|
onCreate(icicle);
|
||||||
mActivityTransitionState.readState(icicle);
|
mActivityTransitionState.readState(icicle);
|
||||||
performCreateCommon();
|
performCreateCommon();
|
||||||
@@ -6676,7 +6662,6 @@ public class Activity extends ContextThemeWrapper
|
|||||||
|
|
||||||
final void performCreate(Bundle icicle, PersistableBundle persistentState) {
|
final void performCreate(Bundle icicle, PersistableBundle persistentState) {
|
||||||
restoreHasCurrentPermissionRequest(icicle);
|
restoreHasCurrentPermissionRequest(icicle);
|
||||||
mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
|
|
||||||
onCreate(icicle, persistentState);
|
onCreate(icicle, persistentState);
|
||||||
mActivityTransitionState.readState(icicle);
|
mActivityTransitionState.readState(icicle);
|
||||||
performCreateCommon();
|
performCreateCommon();
|
||||||
|
|||||||
@@ -31,13 +31,10 @@ import android.os.IRemoteCallback;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ResultReceiver;
|
import android.os.ResultReceiver;
|
||||||
import android.transition.Transition;
|
|
||||||
import android.transition.TransitionManager;
|
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.view.AppTransitionAnimationSpec;
|
import android.view.AppTransitionAnimationSpec;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -643,70 +640,9 @@ public class ActivityOptions {
|
|||||||
public static ActivityOptions makeSceneTransitionAnimation(Activity activity,
|
public static ActivityOptions makeSceneTransitionAnimation(Activity activity,
|
||||||
Pair<View, String>... sharedElements) {
|
Pair<View, String>... sharedElements) {
|
||||||
ActivityOptions opts = new ActivityOptions();
|
ActivityOptions opts = new ActivityOptions();
|
||||||
makeSceneTransitionAnimation(activity, activity.getWindow(), opts,
|
if (!activity.getWindow().hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)) {
|
||||||
activity.mExitTransitionListener, sharedElements);
|
|
||||||
return opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call this immediately prior to startActivity to begin a shared element transition
|
|
||||||
* from a non-Activity. The window must support Window.FEATURE_ACTIVITY_TRANSITIONS.
|
|
||||||
* The exit transition will start immediately and the shared element transition will
|
|
||||||
* start once the launched Activity's shared element is ready.
|
|
||||||
* <p>
|
|
||||||
* When all transitions have completed and the shared element has been transfered,
|
|
||||||
* the window's decor View will have its visibility set to View.GONE.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@SafeVarargs
|
|
||||||
public static ActivityOptions startSharedElementAnimation(Window window,
|
|
||||||
Pair<View, String>... sharedElements) {
|
|
||||||
ActivityOptions opts = new ActivityOptions();
|
|
||||||
final View decorView = window.getDecorView();
|
|
||||||
if (decorView == null) {
|
|
||||||
return opts;
|
|
||||||
}
|
|
||||||
final ExitTransitionCoordinator exit =
|
|
||||||
makeSceneTransitionAnimation(null, window, opts, null, sharedElements);
|
|
||||||
if (exit != null) {
|
|
||||||
HideWindowListener listener = new HideWindowListener(window, exit);
|
|
||||||
exit.setHideSharedElementsCallback(listener);
|
|
||||||
exit.startExit();
|
|
||||||
}
|
|
||||||
return opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should be called when the {@link #startSharedElementAnimation(Window, Pair[])}
|
|
||||||
* animation must be stopped and the Views reset. This can happen if there was an error
|
|
||||||
* from startActivity or a springboard activity and the animation should stop and reset.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static void stopSharedElementAnimation(Window window) {
|
|
||||||
final View decorView = window.getDecorView();
|
|
||||||
if (decorView == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final ExitTransitionCoordinator exit = (ExitTransitionCoordinator)
|
|
||||||
decorView.getTag(com.android.internal.R.id.cross_task_transition);
|
|
||||||
if (exit != null) {
|
|
||||||
exit.cancelPendingTransitions();
|
|
||||||
decorView.setTagInternal(com.android.internal.R.id.cross_task_transition, null);
|
|
||||||
TransitionManager.endTransitions((ViewGroup) decorView);
|
|
||||||
exit.resetViews();
|
|
||||||
exit.clearState();
|
|
||||||
decorView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static ExitTransitionCoordinator makeSceneTransitionAnimation(Activity activity, Window window,
|
|
||||||
ActivityOptions opts, SharedElementCallback callback,
|
|
||||||
Pair<View, String>[] sharedElements) {
|
|
||||||
if (!window.hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)) {
|
|
||||||
opts.mAnimationType = ANIM_DEFAULT;
|
opts.mAnimationType = ANIM_DEFAULT;
|
||||||
return null;
|
return opts;
|
||||||
}
|
}
|
||||||
opts.mAnimationType = ANIM_SCENE_TRANSITION;
|
opts.mAnimationType = ANIM_SCENE_TRANSITION;
|
||||||
|
|
||||||
@@ -729,22 +665,18 @@ public class ActivityOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitTransitionCoordinator exit = new ExitTransitionCoordinator(activity, window,
|
ExitTransitionCoordinator exit = new ExitTransitionCoordinator(activity, names, names,
|
||||||
callback, names, names, views, false);
|
views, false);
|
||||||
opts.mTransitionReceiver = exit;
|
opts.mTransitionReceiver = exit;
|
||||||
opts.mSharedElementNames = names;
|
opts.mSharedElementNames = names;
|
||||||
opts.mIsReturning = (activity == null);
|
opts.mIsReturning = false;
|
||||||
if (activity == null) {
|
opts.mExitCoordinatorIndex =
|
||||||
opts.mExitCoordinatorIndex = -1;
|
activity.mActivityTransitionState.addExitTransitionCoordinator(exit);
|
||||||
} else {
|
return opts;
|
||||||
opts.mExitCoordinatorIndex =
|
|
||||||
activity.mActivityTransitionState.addExitTransitionCoordinator(exit);
|
|
||||||
}
|
|
||||||
return exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
static ActivityOptions makeSceneTransitionAnimation(Activity activity,
|
public static ActivityOptions makeSceneTransitionAnimation(Activity activity,
|
||||||
ExitTransitionCoordinator exitCoordinator, ArrayList<String> sharedElementNames,
|
ExitTransitionCoordinator exitCoordinator, ArrayList<String> sharedElementNames,
|
||||||
int resultCode, Intent resultData) {
|
int resultCode, Intent resultData) {
|
||||||
ActivityOptions opts = new ActivityOptions();
|
ActivityOptions opts = new ActivityOptions();
|
||||||
@@ -968,16 +900,6 @@ public class ActivityOptions {
|
|||||||
return mIsReturning;
|
return mIsReturning;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not the ActivityOptions was created with
|
|
||||||
* {@link #startSharedElementAnimation(Window, Pair[])}.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
boolean isCrossTask() {
|
|
||||||
return mExitCoordinatorIndex < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public ArrayList<String> getSharedElementNames() {
|
public ArrayList<String> getSharedElementNames() {
|
||||||
return mSharedElementNames;
|
return mSharedElementNames;
|
||||||
@@ -1269,65 +1191,4 @@ public class ActivityOptions {
|
|||||||
+ ", mAnimationType=" + mAnimationType + ", mStartX=" + mStartX + ", mStartY="
|
+ ", mAnimationType=" + mAnimationType + ", mStartX=" + mStartX + ", mStartY="
|
||||||
+ mStartY + ", mWidth=" + mWidth + ", mHeight=" + mHeight;
|
+ mStartY + ", mWidth=" + mWidth + ", mHeight=" + mHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class HideWindowListener extends Transition.TransitionListenerAdapter
|
|
||||||
implements ExitTransitionCoordinator.HideSharedElementsCallback {
|
|
||||||
private final Window mWindow;
|
|
||||||
private final ExitTransitionCoordinator mExit;
|
|
||||||
private final boolean mWaitingForTransition;
|
|
||||||
private boolean mTransitionEnded;
|
|
||||||
private boolean mSharedElementHidden;
|
|
||||||
private ArrayList<View> mSharedElements;
|
|
||||||
|
|
||||||
public HideWindowListener(Window window, ExitTransitionCoordinator exit) {
|
|
||||||
mWindow = window;
|
|
||||||
mExit = exit;
|
|
||||||
mSharedElements = new ArrayList<>(exit.mSharedElements);
|
|
||||||
Transition transition = mWindow.getExitTransition();
|
|
||||||
if (transition != null) {
|
|
||||||
transition.addListener(this);
|
|
||||||
mWaitingForTransition = true;
|
|
||||||
} else {
|
|
||||||
mWaitingForTransition = false;
|
|
||||||
}
|
|
||||||
View decorView = mWindow.getDecorView();
|
|
||||||
if (decorView != null) {
|
|
||||||
if (decorView.getTag(com.android.internal.R.id.cross_task_transition) != null) {
|
|
||||||
throw new IllegalStateException(
|
|
||||||
"Cannot start a transition while one is running");
|
|
||||||
}
|
|
||||||
decorView.setTagInternal(com.android.internal.R.id.cross_task_transition, exit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTransitionEnd(Transition transition) {
|
|
||||||
mTransitionEnded = true;
|
|
||||||
hideWhenDone();
|
|
||||||
transition.removeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hideSharedElements() {
|
|
||||||
mSharedElementHidden = true;
|
|
||||||
hideWhenDone();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideWhenDone() {
|
|
||||||
if (mSharedElementHidden && (!mWaitingForTransition || mTransitionEnded)) {
|
|
||||||
mExit.resetViews();
|
|
||||||
int numSharedElements = mSharedElements.size();
|
|
||||||
for (int i = 0; i < numSharedElements; i++) {
|
|
||||||
View view = mSharedElements.get(i);
|
|
||||||
view.requestLayout();
|
|
||||||
}
|
|
||||||
View decorView = mWindow.getDecorView();
|
|
||||||
if (decorView != null) {
|
|
||||||
decorView.setTagInternal(
|
|
||||||
com.android.internal.R.id.cross_task_transition, null);
|
|
||||||
decorView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,12 +105,6 @@ class ActivityTransitionState {
|
|||||||
|
|
||||||
private boolean mIsEnterTriggered;
|
private boolean mIsEnterTriggered;
|
||||||
|
|
||||||
/**
|
|
||||||
* The ActivityOptions Bundle. This is used to transfer ActivityOptions through a
|
|
||||||
* springboard Activity.
|
|
||||||
*/
|
|
||||||
private Bundle mEnterBundle;
|
|
||||||
|
|
||||||
public ActivityTransitionState() {
|
public ActivityTransitionState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,10 +150,6 @@ class ActivityTransitionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setEnterActivityOptions(Activity activity, ActivityOptions options) {
|
public void setEnterActivityOptions(Activity activity, ActivityOptions options) {
|
||||||
if (options != null && mEnterBundle == null &&
|
|
||||||
options.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) {
|
|
||||||
mEnterBundle = options.toBundle();
|
|
||||||
}
|
|
||||||
final Window window = activity.getWindow();
|
final Window window = activity.getWindow();
|
||||||
if (window == null) {
|
if (window == null) {
|
||||||
return;
|
return;
|
||||||
@@ -195,12 +185,7 @@ class ActivityTransitionState {
|
|||||||
activity.getWindow().getDecorView().setVisibility(View.VISIBLE);
|
activity.getWindow().getDecorView().setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
mEnterTransitionCoordinator = new EnterTransitionCoordinator(activity,
|
mEnterTransitionCoordinator = new EnterTransitionCoordinator(activity,
|
||||||
resultReceiver, sharedElementNames, mEnterActivityOptions.isReturning(),
|
resultReceiver, sharedElementNames, mEnterActivityOptions.isReturning());
|
||||||
mEnterActivityOptions.isCrossTask());
|
|
||||||
if (mEnterActivityOptions.isCrossTask()) {
|
|
||||||
mExitingFrom = new ArrayList<>(mEnterActivityOptions.getSharedElementNames());
|
|
||||||
mExitingTo = new ArrayList<>(mEnterActivityOptions.getSharedElementNames());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mIsEnterPostponed) {
|
if (!mIsEnterPostponed) {
|
||||||
startEnter();
|
startEnter();
|
||||||
@@ -239,13 +224,6 @@ class ActivityTransitionState {
|
|||||||
mEnterActivityOptions = null;
|
mEnterActivityOptions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle transferEnterActivityOptions() {
|
|
||||||
mEnterActivityOptions = null;
|
|
||||||
Bundle options = mEnterBundle;
|
|
||||||
mEnterBundle = null;
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
restoreExitedViews();
|
restoreExitedViews();
|
||||||
if (mEnterTransitionCoordinator != null) {
|
if (mEnterTransitionCoordinator != null) {
|
||||||
@@ -297,8 +275,7 @@ class ActivityTransitionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void restoreReenteringViews() {
|
private void restoreReenteringViews() {
|
||||||
if (mEnterTransitionCoordinator != null && mEnterTransitionCoordinator.isReturning() &&
|
if (mEnterTransitionCoordinator != null && mEnterTransitionCoordinator.isReturning()) {
|
||||||
!mEnterTransitionCoordinator.isCrossTask()) {
|
|
||||||
mEnterTransitionCoordinator.forceViewsToAppear();
|
mEnterTransitionCoordinator.forceViewsToAppear();
|
||||||
mExitingFrom = null;
|
mExitingFrom = null;
|
||||||
mExitingTo = null;
|
mExitingTo = null;
|
||||||
@@ -325,9 +302,8 @@ class ActivityTransitionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mReturnExitCoordinator = new ExitTransitionCoordinator(activity,
|
mReturnExitCoordinator =
|
||||||
activity.getWindow(), activity.mEnterTransitionListener, mEnteringNames,
|
new ExitTransitionCoordinator(activity, mEnteringNames, null, null, true);
|
||||||
null, null, true);
|
|
||||||
if (enterViewsTransition != null && decor != null) {
|
if (enterViewsTransition != null && decor != null) {
|
||||||
enterViewsTransition.resume(decor);
|
enterViewsTransition.resume(decor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,14 +59,12 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
private boolean mIsViewsTransitionStarted;
|
private boolean mIsViewsTransitionStarted;
|
||||||
private Transition mEnterViewsTransition;
|
private Transition mEnterViewsTransition;
|
||||||
private OnPreDrawListener mViewsReadyListener;
|
private OnPreDrawListener mViewsReadyListener;
|
||||||
private final boolean mIsCrossTask;
|
|
||||||
|
|
||||||
public EnterTransitionCoordinator(Activity activity, ResultReceiver resultReceiver,
|
public EnterTransitionCoordinator(Activity activity, ResultReceiver resultReceiver,
|
||||||
ArrayList<String> sharedElementNames, boolean isReturning, boolean isCrossTask) {
|
ArrayList<String> sharedElementNames, boolean isReturning) {
|
||||||
super(activity.getWindow(), sharedElementNames,
|
super(activity.getWindow(), sharedElementNames,
|
||||||
getListener(activity, isReturning && !isCrossTask), isReturning);
|
getListener(activity, isReturning), isReturning);
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
mIsCrossTask = isCrossTask;
|
|
||||||
setResultReceiver(resultReceiver);
|
setResultReceiver(resultReceiver);
|
||||||
prepareEnter();
|
prepareEnter();
|
||||||
Bundle resultReceiverBundle = new Bundle();
|
Bundle resultReceiverBundle = new Bundle();
|
||||||
@@ -87,10 +85,6 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isCrossTask() {
|
|
||||||
return mIsCrossTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void viewInstancesReady(ArrayList<String> accepted, ArrayList<String> localNames,
|
public void viewInstancesReady(ArrayList<String> accepted, ArrayList<String> localNames,
|
||||||
ArrayList<View> localViews) {
|
ArrayList<View> localViews) {
|
||||||
boolean remap = false;
|
boolean remap = false;
|
||||||
@@ -331,9 +325,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
if (mActivity == null || decorView == null) {
|
if (mActivity == null || decorView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isCrossTask()) {
|
mActivity.overridePendingTransition(0, 0);
|
||||||
mActivity.overridePendingTransition(0, 0);
|
|
||||||
}
|
|
||||||
if (!mIsReturning) {
|
if (!mIsReturning) {
|
||||||
mWasOpaque = mActivity.convertToTranslucent(null, null);
|
mWasOpaque = mActivity.convertToTranslucent(null, null);
|
||||||
Drawable background = decorView.getBackground();
|
Drawable background = decorView.getBackground();
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import android.transition.TransitionManager;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.Window;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -60,20 +59,18 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
private Bundle mExitSharedElementBundle;
|
private Bundle mExitSharedElementBundle;
|
||||||
private boolean mIsExitStarted;
|
private boolean mIsExitStarted;
|
||||||
private boolean mSharedElementsHidden;
|
private boolean mSharedElementsHidden;
|
||||||
private HideSharedElementsCallback mHideSharedElementsCallback;
|
|
||||||
|
|
||||||
public ExitTransitionCoordinator(Activity activity, Window window,
|
public ExitTransitionCoordinator(Activity activity, ArrayList<String> names,
|
||||||
SharedElementCallback listener, ArrayList<String> names,
|
|
||||||
ArrayList<String> accepted, ArrayList<View> mapped, boolean isReturning) {
|
ArrayList<String> accepted, ArrayList<View> mapped, boolean isReturning) {
|
||||||
super(window, names, listener, isReturning);
|
super(activity.getWindow(), names, getListener(activity, isReturning), isReturning);
|
||||||
viewsReady(mapSharedElements(accepted, mapped));
|
viewsReady(mapSharedElements(accepted, mapped));
|
||||||
stripOffscreenViews();
|
stripOffscreenViews();
|
||||||
mIsBackgroundReady = !isReturning;
|
mIsBackgroundReady = !isReturning;
|
||||||
mActivity = activity;
|
mActivity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHideSharedElementsCallback(HideSharedElementsCallback callback) {
|
private static SharedElementCallback getListener(Activity activity, boolean isReturning) {
|
||||||
mHideSharedElementsCallback = callback;
|
return isReturning ? activity.mEnterTransitionListener : activity.mExitTransitionListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,9 +188,6 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
|
|
||||||
private void hideSharedElements() {
|
private void hideSharedElements() {
|
||||||
moveSharedElementsFromOverlay();
|
moveSharedElementsFromOverlay();
|
||||||
if (mHideSharedElementsCallback != null) {
|
|
||||||
mHideSharedElementsCallback.hideSharedElements();
|
|
||||||
}
|
|
||||||
if (!mIsHidden) {
|
if (!mIsHidden) {
|
||||||
hideViews(mSharedElements);
|
hideViews(mSharedElements);
|
||||||
}
|
}
|
||||||
@@ -213,11 +207,7 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
startTransition(new Runnable() {
|
startTransition(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mActivity != null) {
|
beginTransitions();
|
||||||
beginTransitions();
|
|
||||||
} else {
|
|
||||||
startExitTransition();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -518,8 +508,4 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
|
|||||||
return getWindow().getSharedElementExitTransition();
|
return getWindow().getSharedElementExitTransition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface HideSharedElementsCallback {
|
|
||||||
void hideSharedElements();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1940,26 +1940,6 @@ public abstract class Transition implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Force the transition to move to its end state, ending all the animators.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
void forceToEnd(ViewGroup sceneRoot) {
|
|
||||||
ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
|
|
||||||
int numOldAnims = runningAnimators.size();
|
|
||||||
if (sceneRoot != null) {
|
|
||||||
WindowId windowId = sceneRoot.getWindowId();
|
|
||||||
for (int i = numOldAnims - 1; i >= 0; i--) {
|
|
||||||
AnimationInfo info = runningAnimators.valueAt(i);
|
|
||||||
if (info.view != null && windowId != null && windowId.equals(info.windowId)) {
|
|
||||||
Animator anim = runningAnimators.keyAt(i);
|
|
||||||
anim.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method cancels a transition that is currently running.
|
* This method cancels a transition that is currently running.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ public class TransitionManager {
|
|||||||
ArrayList<Transition> copy = new ArrayList(runningTransitions);
|
ArrayList<Transition> copy = new ArrayList(runningTransitions);
|
||||||
for (int i = copy.size() - 1; i >= 0; i--) {
|
for (int i = copy.size() - 1; i >= 0; i--) {
|
||||||
final Transition transition = copy.get(i);
|
final Transition transition = copy.get(i);
|
||||||
transition.forceToEnd(sceneRoot);
|
transition.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.transition;
|
package android.transition;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
|
|
||||||
import android.animation.TimeInterpolator;
|
import android.animation.TimeInterpolator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
@@ -24,8 +26,6 @@ import android.util.AttributeSet;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.android.internal.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -498,16 +498,6 @@ public class TransitionSet extends Transition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
|
||||||
@Override
|
|
||||||
void forceToEnd(ViewGroup sceneRoot) {
|
|
||||||
super.forceToEnd(sceneRoot);
|
|
||||||
int numTransitions = mTransitions.size();
|
|
||||||
for (int i = 0; i < numTransitions; ++i) {
|
|
||||||
mTransitions.get(i).forceToEnd(sceneRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
TransitionSet setSceneRoot(ViewGroup sceneRoot) {
|
TransitionSet setSceneRoot(ViewGroup sceneRoot) {
|
||||||
super.setSceneRoot(sceneRoot);
|
super.setSceneRoot(sceneRoot);
|
||||||
|
|||||||
@@ -122,11 +122,9 @@
|
|||||||
|
|
||||||
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SET_PROGRESS}. -->
|
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_SET_PROGRESS}. -->
|
||||||
<item type="id" name="accessibilityActionSetProgress" />
|
<item type="id" name="accessibilityActionSetProgress" />
|
||||||
|
|
||||||
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_CONTEXT_CLICK}. -->
|
<!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_CONTEXT_CLICK}. -->
|
||||||
<item type="id" name="accessibilityActionContextClick" />
|
<item type="id" name="accessibilityActionContextClick" />
|
||||||
|
|
||||||
<item type="id" name="remote_input_tag" />
|
<item type="id" name="remote_input_tag" />
|
||||||
|
|
||||||
<item type="id" name="cross_task_transition" />
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -2612,7 +2612,4 @@
|
|||||||
<java-symbol type="array" name="config_defaultPinnerServiceFiles" />
|
<java-symbol type="array" name="config_defaultPinnerServiceFiles" />
|
||||||
|
|
||||||
<java-symbol type="string" name="suspended_widget_accessibility" />
|
<java-symbol type="string" name="suspended_widget_accessibility" />
|
||||||
|
|
||||||
<!-- Used internally for assistant to launch activity transitions -->
|
|
||||||
<java-symbol type="id" name="cross_task_transition" />
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user