Merge "Setup T style clear top transition animation for ActivityEmbedding." into tm-qpr-dev am: 37b3f06461
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18416106 Change-Id: Id6d017d790b39df793a82d2bfbe2f87dec61602f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -222,6 +222,12 @@ public class RemoteAnimationTarget implements Parcelable {
|
||||
*/
|
||||
public boolean hasAnimatingParent;
|
||||
|
||||
/**
|
||||
* Whether an activity has enabled {@link android.R.styleable#Animation_showBackdrop} for
|
||||
* transition.
|
||||
*/
|
||||
public boolean showBackdrop;
|
||||
|
||||
/**
|
||||
* The background color of animation in case the task info is not available if the transition
|
||||
* is activity level.
|
||||
@@ -287,6 +293,11 @@ public class RemoteAnimationTarget implements Parcelable {
|
||||
windowType = in.readInt();
|
||||
hasAnimatingParent = in.readBoolean();
|
||||
backgroundColor = in.readInt();
|
||||
showBackdrop = in.readBoolean();
|
||||
}
|
||||
|
||||
public void setShowBackdrop(boolean shouldShowBackdrop) {
|
||||
showBackdrop = shouldShowBackdrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,6 +327,7 @@ public class RemoteAnimationTarget implements Parcelable {
|
||||
dest.writeInt(windowType);
|
||||
dest.writeBoolean(hasAnimatingParent);
|
||||
dest.writeInt(backgroundColor);
|
||||
dest.writeBoolean(showBackdrop);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
@@ -337,6 +349,7 @@ public class RemoteAnimationTarget implements Parcelable {
|
||||
pw.print(prefix); pw.print("windowType="); pw.print(windowType);
|
||||
pw.print(prefix); pw.print("hasAnimatingParent="); pw.print(hasAnimatingParent);
|
||||
pw.print(prefix); pw.print("backgroundColor="); pw.print(backgroundColor);
|
||||
pw.print(prefix); pw.print("showBackdrop="); pw.print(showBackdrop);
|
||||
}
|
||||
|
||||
public void dumpDebug(ProtoOutputStream proto, long fieldId) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:showBackdrop="true">
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="100"
|
||||
android:duration="350" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="5%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
</set>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="0"
|
||||
android:duration="100" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-25%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
</set>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:showBackdrop="true">
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/linear"
|
||||
android:startOffset="100"
|
||||
android:duration="350" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="-5%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="450" />
|
||||
</set>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="100" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="25%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="450" />
|
||||
</set>
|
||||
@@ -17,7 +17,7 @@
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="0"
|
||||
|
||||
40
core/res/res/anim/task_fragment_clear_top_close_enter.xml
Normal file
40
core/res/res/anim/task_fragment_clear_top_close_enter.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:showBackdrop="true">
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_decelerate"
|
||||
android:startOffset="100"
|
||||
android:duration="350" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="-5%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
41
core/res/res/anim/task_fragment_clear_top_close_exit.xml
Normal file
41
core/res/res/anim/task_fragment_clear_top_close_exit.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="100" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="25%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
41
core/res/res/anim/task_fragment_clear_top_open_enter.xml
Normal file
41
core/res/res/anim/task_fragment_clear_top_open_enter.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false"
|
||||
android:showBackdrop="true">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_decelerate"
|
||||
android:startOffset="100"
|
||||
android:duration="350" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="5%"
|
||||
android:toXDelta="0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_slow_in"
|
||||
android:startOffset="0"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
40
core/res/res/anim/task_fragment_clear_top_open_exit.xml
Normal file
40
core/res/res/anim/task_fragment_clear_top_open_exit.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/standard_accelerate"
|
||||
android:startOffset="0"
|
||||
android:duration="100" />
|
||||
|
||||
<translate
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-25%"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="450" />
|
||||
|
||||
</set>
|
||||
@@ -16,7 +16,7 @@
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shareInterpolator="false">
|
||||
android:shareInterpolator="false">
|
||||
<alpha
|
||||
android:fromAlpha="0"
|
||||
android:toAlpha="1.0"
|
||||
|
||||
@@ -32,5 +32,5 @@
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:interpolator="@interpolator/fast_out_extra_slow_in"
|
||||
android:duration="400" />
|
||||
</set>
|
||||
android:duration="400"/>
|
||||
</set>
|
||||
|
||||
@@ -1701,6 +1701,10 @@
|
||||
<java-symbol type="anim" name="task_fragment_close_exit" />
|
||||
<java-symbol type="anim" name="task_fragment_open_enter" />
|
||||
<java-symbol type="anim" name="task_fragment_open_exit" />
|
||||
<java-symbol type="anim" name="task_fragment_clear_top_close_enter" />
|
||||
<java-symbol type="anim" name="task_fragment_clear_top_close_exit" />
|
||||
<java-symbol type="anim" name="task_fragment_clear_top_open_enter" />
|
||||
<java-symbol type="anim" name="task_fragment_clear_top_open_exit" />
|
||||
|
||||
<java-symbol type="array" name="config_autoRotationTiltTolerance" />
|
||||
<java-symbol type="array" name="config_longPressVibePattern" />
|
||||
|
||||
@@ -180,9 +180,18 @@ class TaskFragmentAnimationSpec {
|
||||
Animation loadOpenAnimation(@NonNull RemoteAnimationTarget target,
|
||||
@NonNull Rect wholeAnimationBounds) {
|
||||
final boolean isEnter = target.mode != MODE_CLOSING;
|
||||
final Animation animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
? com.android.internal.R.anim.task_fragment_open_enter
|
||||
: com.android.internal.R.anim.task_fragment_open_exit);
|
||||
final Animation animation;
|
||||
// Background color on TaskDisplayArea has already been set earlier in
|
||||
// WindowContainer#getAnimationAdapter.
|
||||
if (target.showBackdrop) {
|
||||
animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
? com.android.internal.R.anim.task_fragment_clear_top_open_enter
|
||||
: com.android.internal.R.anim.task_fragment_clear_top_open_exit);
|
||||
} else {
|
||||
animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
? com.android.internal.R.anim.task_fragment_open_enter
|
||||
: com.android.internal.R.anim.task_fragment_open_exit);
|
||||
}
|
||||
animation.initialize(target.localBounds.width(), target.localBounds.height(),
|
||||
wholeAnimationBounds.width(), wholeAnimationBounds.height());
|
||||
animation.scaleCurrentDuration(mTransitionAnimationScaleSetting);
|
||||
@@ -192,9 +201,16 @@ class TaskFragmentAnimationSpec {
|
||||
Animation loadCloseAnimation(@NonNull RemoteAnimationTarget target,
|
||||
@NonNull Rect wholeAnimationBounds) {
|
||||
final boolean isEnter = target.mode != MODE_CLOSING;
|
||||
final Animation animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
? com.android.internal.R.anim.task_fragment_close_enter
|
||||
: com.android.internal.R.anim.task_fragment_close_exit);
|
||||
final Animation animation;
|
||||
if (target.showBackdrop) {
|
||||
animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
? com.android.internal.R.anim.task_fragment_clear_top_close_enter
|
||||
: com.android.internal.R.anim.task_fragment_clear_top_close_exit);
|
||||
} else {
|
||||
animation = mTransitionAnimation.loadDefaultAnimationRes(isEnter
|
||||
? com.android.internal.R.anim.task_fragment_close_enter
|
||||
: com.android.internal.R.anim.task_fragment_close_exit);
|
||||
}
|
||||
animation.initialize(target.localBounds.width(), target.localBounds.height(),
|
||||
wholeAnimationBounds.width(), wholeAnimationBounds.height());
|
||||
animation.scaleCurrentDuration(mTransitionAnimationScaleSetting);
|
||||
|
||||
@@ -9735,6 +9735,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
false /*isNotInRecents*/,
|
||||
record.mThumbnailAdapter != null ? record.mThumbnailAdapter.mCapturedLeash : null,
|
||||
record.mStartBounds, task.getTaskInfo(), checkEnterPictureInPictureAppOpsState());
|
||||
target.setShowBackdrop(record.mShowBackdrop);
|
||||
target.hasAnimatingParent = record.hasAnimatingParent();
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -523,6 +523,95 @@ public class AppTransition implements Dump {
|
||||
return TransitionAnimation.loadAnimationSafely(context, resId, TAG);
|
||||
}
|
||||
|
||||
static int mapOpenCloseTransitTypes(int transit, boolean enter) {
|
||||
int animAttr = 0;
|
||||
switch (transit) {
|
||||
case TRANSIT_OLD_ACTIVITY_OPEN:
|
||||
case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityOpenEnterAnimation
|
||||
: WindowAnimation_activityOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_ACTIVITY_CLOSE:
|
||||
case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityCloseEnterAnimation
|
||||
: WindowAnimation_activityCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskOpenEnterAnimation
|
||||
: WindowAnimation_taskOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskCloseEnterAnimation
|
||||
: WindowAnimation_taskCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_TO_FRONT:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskToFrontEnterAnimation
|
||||
: WindowAnimation_taskToFrontExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_TO_BACK:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskToBackEnterAnimation
|
||||
: WindowAnimation_taskToBackExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperOpenEnterAnimation
|
||||
: WindowAnimation_wallpaperOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperCloseEnterAnimation
|
||||
: WindowAnimation_wallpaperCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_INTRA_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperIntraOpenEnterAnimation
|
||||
: WindowAnimation_wallpaperIntraOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_INTRA_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperIntraCloseEnterAnimation
|
||||
: WindowAnimation_wallpaperIntraCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_OPEN_BEHIND:
|
||||
animAttr = enter
|
||||
? WindowAnimation_launchTaskBehindSourceAnimation
|
||||
: WindowAnimation_launchTaskBehindTargetAnimation;
|
||||
break;
|
||||
// TODO(b/189386466): Use activity transition as the fallback. Investigate if we
|
||||
// need new TaskFragment transition.
|
||||
case TRANSIT_OLD_TASK_FRAGMENT_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityOpenEnterAnimation
|
||||
: WindowAnimation_activityOpenExitAnimation;
|
||||
break;
|
||||
// TODO(b/189386466): Use activity transition as the fallback. Investigate if we
|
||||
// need new TaskFragment transition.
|
||||
case TRANSIT_OLD_TASK_FRAGMENT_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityCloseEnterAnimation
|
||||
: WindowAnimation_activityCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_DREAM_ACTIVITY_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_dreamActivityOpenEnterAnimation
|
||||
: WindowAnimation_dreamActivityOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_DREAM_ACTIVITY_CLOSE:
|
||||
animAttr = enter
|
||||
? 0
|
||||
: WindowAnimation_dreamActivityCloseExitAnimation;
|
||||
break;
|
||||
}
|
||||
|
||||
return animAttr;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {
|
||||
return mTransitionAnimation.loadAnimationAttr(lp, animAttr, transit);
|
||||
@@ -773,94 +862,11 @@ public class AppTransition implements Dump {
|
||||
"applyAnimation: anim=%s transit=%s isEntrance=%b Callers=%s",
|
||||
a, appTransitionOldToString(transit), enter, Debug.getCallers(3));
|
||||
} else {
|
||||
int animAttr = 0;
|
||||
switch (transit) {
|
||||
case TRANSIT_OLD_ACTIVITY_OPEN:
|
||||
case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityOpenEnterAnimation
|
||||
: WindowAnimation_activityOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_ACTIVITY_CLOSE:
|
||||
case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityCloseEnterAnimation
|
||||
: WindowAnimation_activityCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskOpenEnterAnimation
|
||||
: WindowAnimation_taskOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskCloseEnterAnimation
|
||||
: WindowAnimation_taskCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_TO_FRONT:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskToFrontEnterAnimation
|
||||
: WindowAnimation_taskToFrontExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_TO_BACK:
|
||||
animAttr = enter
|
||||
? WindowAnimation_taskToBackEnterAnimation
|
||||
: WindowAnimation_taskToBackExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperOpenEnterAnimation
|
||||
: WindowAnimation_wallpaperOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperCloseEnterAnimation
|
||||
: WindowAnimation_wallpaperCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_INTRA_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperIntraOpenEnterAnimation
|
||||
: WindowAnimation_wallpaperIntraOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_WALLPAPER_INTRA_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_wallpaperIntraCloseEnterAnimation
|
||||
: WindowAnimation_wallpaperIntraCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_TASK_OPEN_BEHIND:
|
||||
animAttr = enter
|
||||
? WindowAnimation_launchTaskBehindSourceAnimation
|
||||
: WindowAnimation_launchTaskBehindTargetAnimation;
|
||||
break;
|
||||
// TODO(b/189386466): Use activity transition as the fallback. Investigate if we
|
||||
// need new TaskFragment transition.
|
||||
case TRANSIT_OLD_TASK_FRAGMENT_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityOpenEnterAnimation
|
||||
: WindowAnimation_activityOpenExitAnimation;
|
||||
break;
|
||||
// TODO(b/189386466): Use activity transition as the fallback. Investigate if we
|
||||
// need new TaskFragment transition.
|
||||
case TRANSIT_OLD_TASK_FRAGMENT_CLOSE:
|
||||
animAttr = enter
|
||||
? WindowAnimation_activityCloseEnterAnimation
|
||||
: WindowAnimation_activityCloseExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_DREAM_ACTIVITY_OPEN:
|
||||
animAttr = enter
|
||||
? WindowAnimation_dreamActivityOpenEnterAnimation
|
||||
: WindowAnimation_dreamActivityOpenExitAnimation;
|
||||
break;
|
||||
case TRANSIT_OLD_DREAM_ACTIVITY_CLOSE:
|
||||
animAttr = enter
|
||||
? 0
|
||||
: WindowAnimation_dreamActivityCloseExitAnimation;
|
||||
break;
|
||||
}
|
||||
|
||||
int animAttr = mapOpenCloseTransitTypes(transit, enter);
|
||||
a = animAttr == 0 ? null : (canCustomizeAppTransition
|
||||
? loadAnimationAttr(lp, animAttr, transit)
|
||||
: mTransitionAnimation.loadDefaultAnimationAttr(animAttr, transit));
|
||||
? loadAnimationAttr(lp, animAttr, transit)
|
||||
: mTransitionAnimation.loadDefaultAnimationAttr(animAttr, transit));
|
||||
|
||||
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
|
||||
"applyAnimation: anim=%s animAttr=0x%x transit=%s isEntrance=%b "
|
||||
+ " canCustomizeAppTransition=%b Callers=%s",
|
||||
@@ -1011,18 +1017,19 @@ public class AppTransition implements Dump {
|
||||
}
|
||||
|
||||
void overridePendingAppTransitionRemote(RemoteAnimationAdapter remoteAnimationAdapter) {
|
||||
overridePendingAppTransitionRemote(remoteAnimationAdapter, false /* sync */);
|
||||
overridePendingAppTransitionRemote(remoteAnimationAdapter, false /* sync */,
|
||||
false /* isActivityEmbedding*/);
|
||||
}
|
||||
|
||||
void overridePendingAppTransitionRemote(RemoteAnimationAdapter remoteAnimationAdapter,
|
||||
boolean sync) {
|
||||
boolean sync, boolean isActivityEmbedding) {
|
||||
ProtoLog.i(WM_DEBUG_APP_TRANSITIONS, "Override pending remote transitionSet=%b adapter=%s",
|
||||
isTransitionSet(), remoteAnimationAdapter);
|
||||
if (isTransitionSet() && !mNextAppTransitionIsSync) {
|
||||
clear();
|
||||
mNextAppTransitionType = NEXT_TRANSIT_TYPE_REMOTE;
|
||||
mRemoteAnimationController = new RemoteAnimationController(mService, mDisplayContent,
|
||||
remoteAnimationAdapter, mHandler);
|
||||
remoteAnimationAdapter, mHandler, isActivityEmbedding);
|
||||
mNextAppTransitionIsSync = sync;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,7 +693,8 @@ public class AppTransitionController {
|
||||
if (adapter == null) {
|
||||
return false;
|
||||
}
|
||||
mDisplayContent.mAppTransition.overridePendingAppTransitionRemote(adapter);
|
||||
mDisplayContent.mAppTransition.overridePendingAppTransitionRemote(
|
||||
adapter, false /* sync */, true /*isActivityEmbedding*/);
|
||||
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
|
||||
"Override with TaskFragment remote animation for transit=%s",
|
||||
AppTransition.appTransitionOldToString(transit));
|
||||
|
||||
@@ -57,7 +57,7 @@ import java.util.function.Consumer;
|
||||
*/
|
||||
class RemoteAnimationController implements DeathRecipient {
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME
|
||||
? "RemoteAnimationController" : TAG_WM;
|
||||
? "RemoteAnimationController" : TAG_WM;
|
||||
private static final long TIMEOUT_MS = 10000;
|
||||
|
||||
private final WindowManagerService mService;
|
||||
@@ -72,35 +72,40 @@ class RemoteAnimationController implements DeathRecipient {
|
||||
private final Runnable mTimeoutRunnable = () -> cancelAnimation("timeoutRunnable");
|
||||
|
||||
private FinishedCallback mFinishedCallback;
|
||||
private final boolean mIsActivityEmbedding;
|
||||
private boolean mCanceled;
|
||||
private boolean mLinkedToDeathOfRunner;
|
||||
@Nullable
|
||||
private Runnable mOnRemoteAnimationReady;
|
||||
|
||||
RemoteAnimationController(WindowManagerService service, DisplayContent displayContent,
|
||||
RemoteAnimationAdapter remoteAnimationAdapter, Handler handler) {
|
||||
RemoteAnimationAdapter remoteAnimationAdapter, Handler handler,
|
||||
boolean isActivityEmbedding) {
|
||||
mService = service;
|
||||
mDisplayContent = displayContent;
|
||||
mRemoteAnimationAdapter = remoteAnimationAdapter;
|
||||
mHandler = handler;
|
||||
mIsActivityEmbedding = isActivityEmbedding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an animation record for each individual {@link WindowContainer}.
|
||||
*
|
||||
* @param windowContainer The windows to animate.
|
||||
* @param position The position app bounds relative to its parent.
|
||||
* @param localBounds The bounds of the app relative to its parent.
|
||||
* @param endBounds The end bounds after the transition, in screen coordinates.
|
||||
* @param startBounds The start bounds before the transition, in screen coordinates.
|
||||
* @param position The position app bounds relative to its parent.
|
||||
* @param localBounds The bounds of the app relative to its parent.
|
||||
* @param endBounds The end bounds after the transition, in screen coordinates.
|
||||
* @param startBounds The start bounds before the transition, in screen coordinates.
|
||||
* @param showBackdrop To show background behind a window during animation.
|
||||
* @return The record representing animation(s) to run on the app.
|
||||
*/
|
||||
RemoteAnimationRecord createRemoteAnimationRecord(WindowContainer windowContainer,
|
||||
Point position, Rect localBounds, Rect endBounds, Rect startBounds) {
|
||||
Point position, Rect localBounds, Rect endBounds, Rect startBounds,
|
||||
boolean showBackdrop) {
|
||||
ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "createAnimationAdapter(): container=%s",
|
||||
windowContainer);
|
||||
final RemoteAnimationRecord adapters = new RemoteAnimationRecord(windowContainer, position,
|
||||
localBounds, endBounds, startBounds);
|
||||
localBounds, endBounds, startBounds, showBackdrop);
|
||||
mPendingAnimations.add(adapters);
|
||||
return adapters;
|
||||
}
|
||||
@@ -110,6 +115,15 @@ class RemoteAnimationController implements DeathRecipient {
|
||||
mOnRemoteAnimationReady = onRemoteAnimationReady;
|
||||
}
|
||||
|
||||
/**
|
||||
* We use isFromActivityEmbedding() in the server process to tell if we're running an
|
||||
* Activity Embedding type remote animation, where animations are driven by the client.
|
||||
* This is currently supporting features like showBackdrop where we need to load App XML.
|
||||
*/
|
||||
public boolean isFromActivityEmbedding() {
|
||||
return mIsActivityEmbedding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the transition is ready to be started, and all leashes have been set up.
|
||||
*/
|
||||
@@ -416,26 +430,28 @@ class RemoteAnimationController implements DeathRecipient {
|
||||
RemoteAnimationTarget mTarget;
|
||||
final WindowContainer mWindowContainer;
|
||||
final Rect mStartBounds;
|
||||
final boolean mShowBackdrop;
|
||||
private @RemoteAnimationTarget.Mode int mMode = RemoteAnimationTarget.MODE_CHANGING;
|
||||
|
||||
RemoteAnimationRecord(WindowContainer windowContainer, Point endPos, Rect localBounds,
|
||||
Rect endBounds, Rect startBounds) {
|
||||
Rect endBounds, Rect startBounds, boolean showBackdrop) {
|
||||
mWindowContainer = windowContainer;
|
||||
mShowBackdrop = showBackdrop;
|
||||
if (startBounds != null) {
|
||||
mStartBounds = new Rect(startBounds);
|
||||
mAdapter = new RemoteAnimationAdapterWrapper(this, endPos, localBounds, endBounds,
|
||||
mStartBounds);
|
||||
mStartBounds, mShowBackdrop);
|
||||
if (mRemoteAnimationAdapter.getChangeNeedsSnapshot()) {
|
||||
final Rect thumbnailLocalBounds = new Rect(startBounds);
|
||||
thumbnailLocalBounds.offsetTo(0, 0);
|
||||
// Snapshot is located at (0,0) of the animation leash. It doesn't have size
|
||||
// change, so the startBounds is its end bounds, and no start bounds for it.
|
||||
mThumbnailAdapter = new RemoteAnimationAdapterWrapper(this, new Point(0, 0),
|
||||
thumbnailLocalBounds, startBounds, new Rect());
|
||||
thumbnailLocalBounds, startBounds, new Rect(), mShowBackdrop);
|
||||
}
|
||||
} else {
|
||||
mAdapter = new RemoteAnimationAdapterWrapper(this, endPos, localBounds, endBounds,
|
||||
new Rect());
|
||||
new Rect(), mShowBackdrop);
|
||||
mStartBounds = null;
|
||||
}
|
||||
}
|
||||
@@ -481,14 +497,21 @@ class RemoteAnimationController implements DeathRecipient {
|
||||
final Rect mLocalBounds;
|
||||
final Rect mEndBounds = new Rect();
|
||||
final Rect mStartBounds = new Rect();
|
||||
final boolean mShowBackdrop;
|
||||
|
||||
RemoteAnimationAdapterWrapper(RemoteAnimationRecord record, Point position,
|
||||
Rect localBounds, Rect endBounds, Rect startBounds) {
|
||||
Rect localBounds, Rect endBounds, Rect startBounds, boolean showBackdrop) {
|
||||
mRecord = record;
|
||||
mPosition.set(position.x, position.y);
|
||||
mLocalBounds = localBounds;
|
||||
mEndBounds.set(endBounds);
|
||||
mStartBounds.set(startBounds);
|
||||
mShowBackdrop = showBackdrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShowBackground() {
|
||||
return mShowBackdrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2940,18 +2940,27 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
getAnimationPosition(mTmpPoint);
|
||||
mTmpRect.offsetTo(0, 0);
|
||||
|
||||
final RemoteAnimationController controller =
|
||||
getDisplayContent().mAppTransition.getRemoteAnimationController();
|
||||
final AppTransition appTransition = getDisplayContent().mAppTransition;
|
||||
final RemoteAnimationController controller = appTransition.getRemoteAnimationController();
|
||||
final boolean isChanging = AppTransition.isChangeTransitOld(transit) && enter
|
||||
&& isChangingAppTransition();
|
||||
|
||||
// Delaying animation start isn't compatible with remote animations at all.
|
||||
if (controller != null && !mSurfaceAnimator.isAnimationStartDelayed()) {
|
||||
// Here we load App XML in order to read com.android.R.styleable#Animation_showBackdrop.
|
||||
boolean showBackdrop = false;
|
||||
if (controller.isFromActivityEmbedding()) {
|
||||
final int animAttr = AppTransition.mapOpenCloseTransitTypes(transit, enter);
|
||||
final Animation a = animAttr != 0
|
||||
? appTransition.loadAnimationAttr(lp, animAttr, transit) : null;
|
||||
showBackdrop = a != null && a.getShowBackdrop();
|
||||
}
|
||||
final Rect localBounds = new Rect(mTmpRect);
|
||||
localBounds.offsetTo(mTmpPoint.x, mTmpPoint.y);
|
||||
final RemoteAnimationController.RemoteAnimationRecord adapters =
|
||||
controller.createRemoteAnimationRecord(this, mTmpPoint, localBounds,
|
||||
screenBounds, (isChanging ? mSurfaceFreezer.mFreezeBounds : null));
|
||||
controller.createRemoteAnimationRecord(
|
||||
this, mTmpPoint, localBounds, screenBounds,
|
||||
(isChanging ? mSurfaceFreezer.mFreezeBounds : null), showBackdrop);
|
||||
if (!isChanging) {
|
||||
adapters.setMode(enter
|
||||
? RemoteAnimationTarget.MODE_OPENING
|
||||
|
||||
@@ -328,7 +328,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
||||
}
|
||||
adapter.setCallingPidUid(caller.mPid, caller.mUid);
|
||||
dc.prepareAppTransition(type);
|
||||
dc.mAppTransition.overridePendingAppTransitionRemote(adapter, true /* sync */);
|
||||
dc.mAppTransition.overridePendingAppTransitionRemote(adapter, true /* sync */,
|
||||
false /* isActivityEmbedding */);
|
||||
syncId = startSyncWithOrganizer(callback);
|
||||
applyTransaction(t, syncId, null /* transition */, caller);
|
||||
setSyncReady(syncId);
|
||||
|
||||
@@ -78,19 +78,25 @@ import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Build/Install/Run:
|
||||
* atest WmTests:RemoteAnimationControllerTest
|
||||
* atest WmTests:RemoteAnimationControllerTest
|
||||
*/
|
||||
@SmallTest
|
||||
@Presubmit
|
||||
@RunWith(WindowTestRunner.class)
|
||||
public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
|
||||
@Mock SurfaceControl mMockLeash;
|
||||
@Mock SurfaceControl mMockThumbnailLeash;
|
||||
@Mock Transaction mMockTransaction;
|
||||
@Mock OnAnimationFinishedCallback mFinishedCallback;
|
||||
@Mock OnAnimationFinishedCallback mThumbnailFinishedCallback;
|
||||
@Mock IRemoteAnimationRunner mMockRunner;
|
||||
@Mock
|
||||
SurfaceControl mMockLeash;
|
||||
@Mock
|
||||
SurfaceControl mMockThumbnailLeash;
|
||||
@Mock
|
||||
Transaction mMockTransaction;
|
||||
@Mock
|
||||
OnAnimationFinishedCallback mFinishedCallback;
|
||||
@Mock
|
||||
OnAnimationFinishedCallback mThumbnailFinishedCallback;
|
||||
@Mock
|
||||
IRemoteAnimationRunner mMockRunner;
|
||||
private RemoteAnimationAdapter mAdapter;
|
||||
private RemoteAnimationController mController;
|
||||
private final OffsettableClock mClock = new OffsettableClock.Stopped();
|
||||
@@ -104,7 +110,8 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
mAdapter = new RemoteAnimationAdapter(mMockRunner, 100, 50, true /* changeNeedsSnapshot */);
|
||||
mAdapter.setCallingPidUid(123, 456);
|
||||
runWithScissors(mWm.mH, () -> mHandler = new TestHandler(null, mClock), 0);
|
||||
mController = new RemoteAnimationController(mWm, mDisplayContent, mAdapter, mHandler);
|
||||
mController = new RemoteAnimationController(mWm, mDisplayContent, mAdapter,
|
||||
mHandler, false /*isActivityEmbedding*/);
|
||||
}
|
||||
|
||||
private WindowState createAppOverlayWindow() {
|
||||
@@ -115,14 +122,48 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
return win;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForwardsShowBackdrop() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
mDisplayContent.mOpeningApps.add(win.mActivityRecord);
|
||||
final WindowState overlayWin = createAppOverlayWindow();
|
||||
try {
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null,
|
||||
true /* showBackdrop */).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
mWm.mAnimator.executeAfterPrepareSurfacesRunnables();
|
||||
final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor =
|
||||
ArgumentCaptor.forClass(RemoteAnimationTarget[].class);
|
||||
final ArgumentCaptor<RemoteAnimationTarget[]> wallpapersCaptor =
|
||||
ArgumentCaptor.forClass(RemoteAnimationTarget[].class);
|
||||
final ArgumentCaptor<RemoteAnimationTarget[]> nonAppsCaptor =
|
||||
ArgumentCaptor.forClass(RemoteAnimationTarget[].class);
|
||||
final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor =
|
||||
ArgumentCaptor.forClass(IRemoteAnimationFinishedCallback.class);
|
||||
verify(mMockRunner).onAnimationStart(eq(TRANSIT_OLD_ACTIVITY_OPEN),
|
||||
appsCaptor.capture(), wallpapersCaptor.capture(), nonAppsCaptor.capture(),
|
||||
finishedCaptor.capture());
|
||||
assertEquals(1, appsCaptor.getValue().length);
|
||||
final RemoteAnimationTarget app = appsCaptor.getValue()[0];
|
||||
assertTrue(app.showBackdrop);
|
||||
} finally {
|
||||
mDisplayContent.mOpeningApps.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRun() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
mDisplayContent.mOpeningApps.add(win.mActivityRecord);
|
||||
final WindowState overlayWin = createAppOverlayWindow();
|
||||
try {
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -161,8 +202,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
@Test
|
||||
public void testCancel() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -174,8 +216,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
@Test
|
||||
public void testTimeout() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -196,7 +239,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
"testWin");
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(50, 100), null, new Rect(50, 100, 150, 150),
|
||||
null).mAdapter;
|
||||
null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -228,7 +271,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
public void testNotReallyStarted() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null);
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
|
||||
verify(mMockRunner).onAnimationCancelled();
|
||||
@@ -239,9 +282,10 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
final WindowState win1 = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin1");
|
||||
final WindowState win2 = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin2");
|
||||
mController.createRemoteAnimationRecord(win1.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null);
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win2.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false);
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win2.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -264,8 +308,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
@Test
|
||||
public void testRemovedBeforeStarted() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
win.mActivityRecord.removeImmediately();
|
||||
@@ -309,7 +354,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
try {
|
||||
final RemoteAnimationRecord record = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(50, 100), null, new Rect(50, 100, 150, 150),
|
||||
new Rect(0, 0, 200, 200));
|
||||
new Rect(0, 0, 200, 200), false);
|
||||
assertNotNull(record.mThumbnailAdapter);
|
||||
((AnimationAdapter) record.mAdapter)
|
||||
.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_WINDOW_ANIMATION,
|
||||
@@ -363,7 +408,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
try {
|
||||
final RemoteAnimationRecord record = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(0, 0), null, new Rect(0, 0, 200, 200),
|
||||
new Rect(50, 100, 150, 150));
|
||||
new Rect(50, 100, 150, 150), false);
|
||||
assertNotNull(record.mThumbnailAdapter);
|
||||
((AnimationAdapter) record.mAdapter)
|
||||
.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_WINDOW_ANIMATION,
|
||||
@@ -417,7 +462,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
try {
|
||||
final RemoteAnimationRecord record = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(100, 100), null, new Rect(150, 150, 400, 400),
|
||||
new Rect(50, 100, 150, 150));
|
||||
new Rect(50, 100, 150, 150), false);
|
||||
assertNotNull(record.mThumbnailAdapter);
|
||||
((AnimationAdapter) record.mAdapter)
|
||||
.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_WINDOW_ANIMATION,
|
||||
@@ -474,8 +519,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
mDisplayContent.mOpeningApps.add(win.mActivityRecord);
|
||||
try {
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -506,8 +552,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
mDisplayContent.mOpeningApps.add(win.mActivityRecord);
|
||||
try {
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord,
|
||||
new Point(50, 100), null, new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
|
||||
@@ -543,7 +590,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
try {
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(50, 100), null,
|
||||
new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_KEYGUARD_GOING_AWAY);
|
||||
@@ -593,7 +640,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
try {
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(50, 100), null,
|
||||
new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER);
|
||||
@@ -727,7 +774,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
mDisplayContent.mOpeningApps.add(win2.mActivityRecord);
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win2.mActivityRecord, new Point(50, 100), null,
|
||||
new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
|
||||
@@ -757,7 +804,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
|
||||
final AnimationAdapter adapter = mController.createRemoteAnimationRecord(
|
||||
win.mActivityRecord, new Point(50, 100), null,
|
||||
new Rect(50, 100, 150, 150), null).mAdapter;
|
||||
new Rect(50, 100, 150, 150), null, false).mAdapter;
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_APP_TRANSITION,
|
||||
mFinishedCallback);
|
||||
mController.goodToGo(transit);
|
||||
|
||||
Reference in New Issue
Block a user