AppTransition
loadAnimation: to change the default animation .
system default xml is : activity_open_enter.xml activity_open_exit.xml .
like this :
if(animAttr == WindowAnimation_activityOpenEnterAnimation){
a = new TranslateXAnimation(500,0);
a.setDuration(350);
}
if(animAttr == WindowAnimation_activityOpenExitAnimation){
a = new AlphaAnimation(1,0);
a.setDuration(350);
}
AppTransitionController
applyAnimations(openingWcs, openingApps, transit, true /* visible */, animLp,
voiceInteraction);
applyAnimations(closingWcs, closingApps, transit, false /* visible */, animLp,
voiceInteraction);
private void applyAnimations(ArraySet<WindowContainer> wcs, ArraySet<ActivityRecord> apps,
@TransitionOldType int transit, boolean visible, LayoutParams animLp,
boolean voiceInteraction) {
final int wcsCount = wcs.size();
for (int i = 0; i < wcsCount; i++) {
final WindowContainer wc = wcs.valueAt(i);
// If app transition animation target is promoted to higher level, SurfaceAnimator
// triggers WC#onAnimationFinished only on the promoted target. So we need to take care
// of triggering AR#onAnimationFinished on each ActivityRecord which is a part of the
// app transition.
final ArrayList<ActivityRecord> transitioningDescendants = new ArrayList<>();
for (int j = 0; j < apps.size(); ++j) {
final ActivityRecord app = apps.valueAt(j);
if (app.isDescendantOf(wc)) {
transitioningDescendants.add(app);
}
}
wc.applyAnimation(animLp, transit, visible, voiceInteraction, transitioningDescendants);
}
}
TransitionAnimation: one TransitionAnimation per DisplayContent.
has 4 states:
private final static int APP_STATE_IDLE = 0;
private final static int APP_STATE_READY = 1;
private final static int APP_STATE_RUNNING = 2;
private final static int APP_STATE_TIMEOUT = 3;