Move app transition constants

Move app transition constants from WindowManagerPolicy to
AppTransition.

Change-Id: I8ae6c4d0da1db826c44eb4ea0c6b85016b50b1a3
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 1cd370a..62af91e 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -28,6 +28,7 @@
 import com.android.server.Watchdog;
 import com.android.server.am.ActivityStack.ActivityState;
 import com.android.server.pm.UserManagerService;
+import com.android.server.wm.AppTransition;
 import com.android.server.wm.WindowManagerService;
 
 import dalvik.system.Zygote;
@@ -130,7 +131,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.WindowManager;
-import android.view.WindowManagerPolicy;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
@@ -1970,9 +1970,9 @@
     
     boolean isNextTransitionForward() {
         int transit = mWindowManager.getPendingAppTransition();
-        return transit == WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN
-                || transit == WindowManagerPolicy.TRANSIT_TASK_OPEN
-                || transit == WindowManagerPolicy.TRANSIT_TASK_TO_FRONT;
+        return transit == AppTransition.TRANSIT_ACTIVITY_OPEN
+                || transit == AppTransition.TRANSIT_TASK_OPEN
+                || transit == AppTransition.TRANSIT_TASK_TO_FRONT;
     }
     
     final ProcessRecord startProcessLocked(String processName,
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 0e01e4c..c1b10cf 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -22,6 +22,7 @@
 import com.android.internal.app.HeavyWeightSwitcherActivity;
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
+import com.android.server.wm.AppTransition;
 
 import android.app.Activity;
 import android.app.ActivityManager;
@@ -61,7 +62,6 @@
 import android.util.Log;
 import android.util.Slog;
 import android.view.Display;
-import android.view.WindowManagerPolicy;
 
 import java.io.IOException;
 import java.lang.ref.WeakReference;
@@ -423,8 +423,8 @@
                 }
             }
         }
-    };
-    
+    }
+
     ActivityStack(ActivityManagerService service, Context context, boolean mainStack, Looper looper) {
         mHandler = new ActivityStackHandler(looper);
         mService = service;
@@ -1612,11 +1612,11 @@
                         "Prepare close transition: prev=" + prev);
                 if (mNoAnimActivities.contains(prev)) {
                     mService.mWindowManager.prepareAppTransition(
-                            WindowManagerPolicy.TRANSIT_NONE, false);
+                            AppTransition.TRANSIT_NONE, false);
                 } else {
                     mService.mWindowManager.prepareAppTransition(prev.task == next.task
-                            ? WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE
-                            : WindowManagerPolicy.TRANSIT_TASK_CLOSE, false);
+                            ? AppTransition.TRANSIT_ACTIVITY_CLOSE
+                            : AppTransition.TRANSIT_TASK_CLOSE, false);
                 }
                 mService.mWindowManager.setAppWillBeHidden(prev.appToken);
                 mService.mWindowManager.setAppVisibility(prev.appToken, false);
@@ -1626,11 +1626,11 @@
                 if (mNoAnimActivities.contains(next)) {
                     noAnim = true;
                     mService.mWindowManager.prepareAppTransition(
-                            WindowManagerPolicy.TRANSIT_NONE, false);
+                            AppTransition.TRANSIT_NONE, false);
                 } else {
                     mService.mWindowManager.prepareAppTransition(prev.task == next.task
-                            ? WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN
-                            : WindowManagerPolicy.TRANSIT_TASK_OPEN, false);
+                            ? AppTransition.TRANSIT_ACTIVITY_OPEN
+                            : AppTransition.TRANSIT_TASK_OPEN, false);
                 }
             }
             if (false) {
@@ -1643,10 +1643,10 @@
             if (mNoAnimActivities.contains(next)) {
                 noAnim = true;
                 mService.mWindowManager.prepareAppTransition(
-                        WindowManagerPolicy.TRANSIT_NONE, false);
+                        AppTransition.TRANSIT_NONE, false);
             } else {
                 mService.mWindowManager.prepareAppTransition(
-                        WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN, false);
+                        AppTransition.TRANSIT_ACTIVITY_OPEN, false);
             }
         }
         if (!noAnim) {
@@ -1890,12 +1890,12 @@
                     "Prepare open transition: starting " + r);
             if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
                 mService.mWindowManager.prepareAppTransition(
-                        WindowManagerPolicy.TRANSIT_NONE, keepCurTransition);
+                        AppTransition.TRANSIT_NONE, keepCurTransition);
                 mNoAnimActivities.add(r);
             } else {
                 mService.mWindowManager.prepareAppTransition(newTask
-                        ? WindowManagerPolicy.TRANSIT_TASK_OPEN
-                        : WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN, keepCurTransition);
+                        ? AppTransition.TRANSIT_TASK_OPEN
+                        : AppTransition.TRANSIT_ACTIVITY_OPEN, keepCurTransition);
                 mNoAnimActivities.remove(r);
             }
             r.updateOptionsLocked(options);
@@ -3812,8 +3812,8 @@
             if (DEBUG_TRANSITION) Slog.v(TAG,
                     "Prepare close transition: finishing " + r);
             mService.mWindowManager.prepareAppTransition(endTask
-                    ? WindowManagerPolicy.TRANSIT_TASK_CLOSE
-                    : WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE, false);
+                    ? AppTransition.TRANSIT_TASK_CLOSE
+                    : AppTransition.TRANSIT_ACTIVITY_CLOSE, false);
     
             // Tell window manager to prepare for this one to be removed.
             mService.mWindowManager.setAppVisibility(r.appToken, false);
@@ -4300,7 +4300,7 @@
                     (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
                 ActivityOptions.abort(options);
             } else {
-                updateTransitLocked(WindowManagerPolicy.TRANSIT_TASK_TO_FRONT, options);
+                updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options);
             }
             return;
         }
@@ -4338,14 +4338,14 @@
         if (reason != null &&
                 (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
             mService.mWindowManager.prepareAppTransition(
-                    WindowManagerPolicy.TRANSIT_NONE, false);
+                    AppTransition.TRANSIT_NONE, false);
             ActivityRecord r = topRunningActivityLocked(null);
             if (r != null) {
                 mNoAnimActivities.add(r);
             }
             ActivityOptions.abort(options);
         } else {
-            updateTransitLocked(WindowManagerPolicy.TRANSIT_TASK_TO_FRONT, options);
+            updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options);
         }
         
         mService.mWindowManager.moveAppTokensToTop(moved);
@@ -4431,14 +4431,14 @@
         if (reason != null &&
                 (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
             mService.mWindowManager.prepareAppTransition(
-                    WindowManagerPolicy.TRANSIT_NONE, false);
+                    AppTransition.TRANSIT_NONE, false);
             ActivityRecord r = topRunningActivityLocked(null);
             if (r != null) {
                 mNoAnimActivities.add(r);
             }
         } else {
             mService.mWindowManager.prepareAppTransition(
-                    WindowManagerPolicy.TRANSIT_TASK_TO_BACK, false);
+                    AppTransition.TRANSIT_TASK_TO_BACK, false);
         }
         mService.mWindowManager.moveAppTokensToBottom(moved);
         if (VALIDATE_TOKENS) {
diff --git a/services/java/com/android/server/wm/AppTransition.java b/services/java/com/android/server/wm/AppTransition.java
index 7736c93..b96119b 100644
--- a/services/java/com/android/server/wm/AppTransition.java
+++ b/services/java/com/android/server/wm/AppTransition.java
@@ -25,7 +25,6 @@
 import android.os.IRemoteCallback;
 import android.util.Slog;
 import android.view.WindowManager;
-import android.view.WindowManagerPolicy;
 import android.view.animation.AlphaAnimation;
 import android.view.animation.Animation;
 import android.view.animation.AnimationSet;
@@ -39,9 +38,6 @@
 
 import java.io.PrintWriter;
 
-import static android.view.WindowManagerPolicy.TRANSIT_NONE;
-import static android.view.WindowManagerPolicy.TRANSIT_UNSET;
-
 // State management of app transitions.  When we are preparing for a
 // transition, mNextAppTransition will be the kind of transition to
 // perform or TRANSIT_NONE if we are not waiting.  If we are waiting,
@@ -53,6 +49,50 @@
             WindowManagerService.DEBUG_APP_TRANSITIONS;
     private static final boolean DEBUG_ANIM = WindowManagerService.DEBUG_ANIM;
 
+    /**
+     * Bit mask that is set for all enter transition.
+     */
+    public static final int TRANSIT_ENTER_MASK = 0x1000;
+    
+    /**
+     * Bit mask that is set for all exit transitions.
+     */
+    public static final int TRANSIT_EXIT_MASK = 0x2000;
+    
+    /** Not set up for a transition. */
+    public static final int TRANSIT_UNSET = -1;
+    /** No animation for transition. */
+    public static final int TRANSIT_NONE = 0;
+    /** A window in a new activity is being opened on top of an existing one in the same task. */
+    public static final int TRANSIT_ACTIVITY_OPEN = 6 | TRANSIT_ENTER_MASK;
+    /** The window in the top-most activity is being closed to reveal the
+     * previous activity in the same task. */
+    public static final int TRANSIT_ACTIVITY_CLOSE = 7 | TRANSIT_EXIT_MASK;
+    /** A window in a new task is being opened on top of an existing one
+     * in another activity's task. */
+    public static final int TRANSIT_TASK_OPEN = 8 | TRANSIT_ENTER_MASK;
+    /** A window in the top-most activity is being closed to reveal the
+     * previous activity in a different task. */
+    public static final int TRANSIT_TASK_CLOSE = 9 | TRANSIT_EXIT_MASK;
+    /** A window in an existing task is being displayed on top of an existing one
+     * in another activity's task. */
+    public static final int TRANSIT_TASK_TO_FRONT = 10 | TRANSIT_ENTER_MASK;
+    /** A window in an existing task is being put below all other tasks. */
+    public static final int TRANSIT_TASK_TO_BACK = 11 | TRANSIT_EXIT_MASK;
+    /** A window in a new activity that doesn't have a wallpaper is being
+     * opened on top of one that does, effectively closing the wallpaper. */
+    public static final int TRANSIT_WALLPAPER_CLOSE = 12 | TRANSIT_EXIT_MASK;
+    /** A window in a new activity that does have a wallpaper is being
+     * opened on one that didn't, effectively opening the wallpaper. */
+    public static final int TRANSIT_WALLPAPER_OPEN = 13 | TRANSIT_ENTER_MASK;
+    /** A window in a new activity is being opened on top of an existing one,
+     * and both are on top of the wallpaper. */
+    public static final int TRANSIT_WALLPAPER_INTRA_OPEN = 14 | TRANSIT_ENTER_MASK;
+    /** The window in the top-most activity is being closed to reveal the
+     * previous activity, and both are on top of he wallpaper. */
+    public static final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15 | TRANSIT_EXIT_MASK;
+    
+
     /** Fraction of animation at which the recents thumbnail becomes completely transparent */
     static final float RECENTS_THUMBNAIL_FADEOUT_FRACTION = 0.25f;
 
@@ -164,7 +204,7 @@
     }
 
     void goodToGo() {
-        mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
+        mNextAppTransition = TRANSIT_UNSET;
         mAppTransitionReady = false;
         mAppTransitionRunning = true;
         mAppTransitionTimeout = false;
@@ -282,8 +322,8 @@
             set.addAnimation(alpha);
             set.setDetachWallpaper(true);
             a = set;
-        } else  if (transit == WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN ||
-                    transit == WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE) {
+        } else  if (transit == TRANSIT_WALLPAPER_INTRA_OPEN ||
+                    transit == TRANSIT_WALLPAPER_INTRA_CLOSE) {
             // If we are on top of the wallpaper, we need an animation that
             // correctly handles the wallpaper staying static behind all of
             // the animated elements.  To do this, will just have the existing
@@ -300,8 +340,8 @@
         // task transition duration.
         final long duration;
         switch (transit) {
-            case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
-            case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
+            case TRANSIT_ACTIVITY_OPEN:
+            case TRANSIT_ACTIVITY_CLOSE:
                 duration = mConfigShortAnimTime;
                 break;
             default:
@@ -363,7 +403,7 @@
         } else {
             // Exiting app
             if (mNextAppTransitionScaleUp) {
-                if (transit == WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN) {
+                if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
                     // Fade out while bringing up selected activity. This keeps the
                     // current activity from showing through a launching wallpaper
                     // activity.
@@ -394,8 +434,8 @@
         // task transition duration.
         final long duration;
         switch (transit) {
-            case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
-            case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
+            case TRANSIT_ACTIVITY_OPEN:
+            case TRANSIT_ACTIVITY_CLOSE:
                 duration = mConfigShortAnimTime;
                 break;
             default:
@@ -444,52 +484,52 @@
         } else {
             int animAttr = 0;
             switch (transit) {
-                case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
+                case TRANSIT_ACTIVITY_OPEN:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
+                case TRANSIT_ACTIVITY_CLOSE:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_TASK_OPEN:
+                case TRANSIT_TASK_OPEN:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_TASK_CLOSE:
+                case TRANSIT_TASK_CLOSE:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_TASK_TO_FRONT:
+                case TRANSIT_TASK_TO_FRONT:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_TASK_TO_BACK:
+                case TRANSIT_TASK_TO_BACK:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN:
+                case TRANSIT_WALLPAPER_OPEN:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE:
+                case TRANSIT_WALLPAPER_CLOSE:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN:
+                case TRANSIT_WALLPAPER_INTRA_OPEN:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation;
                     break;
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE:
+                case TRANSIT_WALLPAPER_INTRA_CLOSE:
                     animAttr = enter
                             ? com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation
                             : com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation;
@@ -565,6 +605,59 @@
         return "mNextAppTransition=0x" + Integer.toHexString(mNextAppTransition);
     }
 
+    /**
+     * Returns the human readable name of a window transition.
+     *
+     * @param transition The window transition.
+     * @return The transition symbolic name.
+     */
+    public static String appTransitionToString(int transition) {
+        switch (transition) {
+            case TRANSIT_UNSET: {
+                return "TRANSIT_UNSET";
+            }
+            case TRANSIT_NONE: {
+                return "TRANSIT_NONE";
+            }
+            case TRANSIT_EXIT_MASK: {
+                return "TRANSIT_EXIT_MASK";
+            }
+            case TRANSIT_ACTIVITY_OPEN: {
+                return "TRANSIT_ACTIVITY_OPEN";
+            }
+            case TRANSIT_ACTIVITY_CLOSE: {
+                return "TRANSIT_ACTIVITY_CLOSE";
+            }
+            case TRANSIT_TASK_OPEN: {
+                return "TRANSIT_TASK_OPEN";
+            }
+            case TRANSIT_TASK_CLOSE: {
+                return "TRANSIT_TASK_CLOSE";
+            }
+            case TRANSIT_TASK_TO_FRONT: {
+                return "TRANSIT_TASK_TO_FRONT";
+            }
+            case TRANSIT_TASK_TO_BACK: {
+                return "TRANSIT_TASK_TO_BACK";
+            }
+            case TRANSIT_WALLPAPER_CLOSE: {
+                return "TRANSIT_WALLPAPER_CLOSE";
+            }
+            case TRANSIT_WALLPAPER_OPEN: {
+                return "TRANSIT_WALLPAPER_OPEN";
+            }
+            case TRANSIT_WALLPAPER_INTRA_OPEN: {
+                return "TRANSIT_WALLPAPER_INTRA_OPEN";
+            }
+            case TRANSIT_WALLPAPER_INTRA_CLOSE: {
+                return "TRANSIT_WALLPAPER_INTRA_CLOSE";
+            }
+            default: {
+                return "<UNKNOWN>";
+            }
+        }
+    }
+
     @Override
     public void dump(PrintWriter pw) {
         pw.print(" " + this);
diff --git a/services/java/com/android/server/wm/DisplayMagnifier.java b/services/java/com/android/server/wm/DisplayMagnifier.java
index cd5ae4b..d3c01f0 100644
--- a/services/java/com/android/server/wm/DisplayMagnifier.java
+++ b/services/java/com/android/server/wm/DisplayMagnifier.java
@@ -50,7 +50,6 @@
 
 import com.android.internal.R;
 import com.android.internal.os.SomeArgs;
-import com.android.internal.policy.impl.PhoneWindowManager;
 
 /**
  * This class is a part of the window manager and encapsulates the
@@ -137,25 +136,34 @@
         mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_ROTATION_CHANGED);
     }
 
-    public void onWindowTransitionLocked(WindowState windowState, int transition) {
+    public void onAppWindowTransitionLocked(WindowState windowState, int transition) {
         if (DEBUG_WINDOW_TRANSITIONS) {
             Slog.i(LOG_TAG, "Window transition: "
-                    + PhoneWindowManager.windowTransitionToString(transition)
+                    + AppTransition.appTransitionToString(transition)
                     + " displayId: " + windowState.getDisplayId());
         }
         final boolean magnifying = mMagnifedViewport.isMagnifyingLocked();
         if (magnifying) {
             switch (transition) {
-                case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
-                case WindowManagerPolicy.TRANSIT_TASK_OPEN:
-                case WindowManagerPolicy.TRANSIT_TASK_TO_FRONT:
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN:
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE:
-                case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN: {
+                case AppTransition.TRANSIT_ACTIVITY_OPEN:
+                case AppTransition.TRANSIT_TASK_OPEN:
+                case AppTransition.TRANSIT_TASK_TO_FRONT:
+                case AppTransition.TRANSIT_WALLPAPER_OPEN:
+                case AppTransition.TRANSIT_WALLPAPER_CLOSE:
+                case AppTransition.TRANSIT_WALLPAPER_INTRA_OPEN: {
                     mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_USER_CONTEXT_CHANGED);
                 }
             }
         }
+    }
+
+    public void onWindowTransitionLocked(WindowState windowState, int transition) {
+        if (DEBUG_WINDOW_TRANSITIONS) {
+            Slog.i(LOG_TAG, "Window transition: "
+                    + AppTransition.appTransitionToString(transition)
+                    + " displayId: " + windowState.getDisplayId());
+        }
+        final boolean magnifying = mMagnifedViewport.isMagnifyingLocked();
         final int type = windowState.mAttrs.type;
         switch (transition) {
             case WindowManagerPolicy.TRANSIT_ENTER:
@@ -459,7 +467,6 @@
             private static final int MIN_ALPHA = 0;
             private static final int MAX_ALPHA = 255;
 
-            private final Point mTempPoint = new Point();
             private final Region mBounds = new Region();
             private final Rect mDirtyRect = new Rect();
             private final Paint mPaint = new Paint();
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index c67a465..5cfd79e 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -3622,14 +3622,14 @@
                 if (!mAppTransition.isTransitionSet() || mAppTransition.isTransitionNone()) {
                     mAppTransition.setAppTransition(transit);
                 } else if (!alwaysKeepCurrent) {
-                    if (transit == WindowManagerPolicy.TRANSIT_TASK_OPEN
+                    if (transit == AppTransition.TRANSIT_TASK_OPEN
                             && mAppTransition.isTransitionEqual(
-                                    WindowManagerPolicy.TRANSIT_TASK_CLOSE)) {
+                                    AppTransition.TRANSIT_TASK_CLOSE)) {
                         // Opening a new task always supersedes a close for the anim.
                         mAppTransition.setAppTransition(transit);
-                    } else if (transit == WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN
+                    } else if (transit == AppTransition.TRANSIT_ACTIVITY_OPEN
                             && mAppTransition.isTransitionEqual(
-                                WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE)) {
+                                AppTransition.TRANSIT_ACTIVITY_CLOSE)) {
                         // Opening a new activity always supersedes a close for the anim.
                         mAppTransition.setAppTransition(transit);
                     }
@@ -3948,7 +3948,7 @@
 
             boolean runningAppAnimation = false;
 
-            if (transit != WindowManagerPolicy.TRANSIT_UNSET) {
+            if (transit != AppTransition.TRANSIT_UNSET) {
                 if (wtoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation) {
                     wtoken.mAppAnimator.animation = null;
                 }
@@ -3959,7 +3959,7 @@
                 //TODO (multidisplay): Magnification is supported only for the default display.
                 if (window != null && mDisplayMagnifier != null
                         && window.getDisplayId() == Display.DEFAULT_DISPLAY) {
-                    mDisplayMagnifier.onWindowTransitionLocked(window, transit);
+                    mDisplayMagnifier.onAppWindowTransitionLocked(window, transit);
                 }
                 changed = true;
             }
@@ -4127,7 +4127,7 @@
             }
 
             final long origId = Binder.clearCallingIdentity();
-            setTokenVisibilityLocked(wtoken, null, visible, WindowManagerPolicy.TRANSIT_UNSET,
+            setTokenVisibilityLocked(wtoken, null, visible, AppTransition.TRANSIT_UNSET,
                     true);
             wtoken.updateReportedVisibilityLocked();
             Binder.restoreCallingIdentity(origId);
@@ -4259,7 +4259,7 @@
             if (basewtoken != null && (wtoken=basewtoken.appWindowToken) != null) {
                 if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Removing app token: " + wtoken);
                 delayed = setTokenVisibilityLocked(wtoken, null, false,
-                        WindowManagerPolicy.TRANSIT_UNSET, true);
+                        AppTransition.TRANSIT_UNSET, true);
                 wtoken.inPendingTransaction = false;
                 mOpeningApps.remove(wtoken);
                 wtoken.waitingToShow = false;
@@ -4812,6 +4812,7 @@
         mH.sendEmptyMessage(H.PERSIST_ANIMATION_SCALE);
     }
 
+    @Override
     public void setAnimationScales(float[] scales) {
         if (!checkCallingPermission(android.Manifest.permission.SET_ANIMATION_SCALE,
                 "setAnimationScale()")) {
@@ -4839,6 +4840,7 @@
         ValueAnimator.setDurationScale(scale);
     }
 
+    @Override
     public float getAnimationScale(int which) {
         switch (which) {
             case 0: return mWindowAnimationScale;
@@ -4848,6 +4850,7 @@
         return 0;
     }
 
+    @Override
     public float[] getAnimationScales() {
         return new float[] { mWindowAnimationScale, mTransitionAnimationScale,
                 mAnimatorDurationScale };
@@ -7813,7 +7816,7 @@
             if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "**** GOOD TO GO");
             int transit = mAppTransition.getAppTransition();
             if (mSkipAppTransitionAnimation) {
-                transit = WindowManagerPolicy.TRANSIT_UNSET;
+                transit = AppTransition.TRANSIT_UNSET;
             }
             mAppTransition.goodToGo();
             mStartingIconInTransition = false;
@@ -7901,28 +7904,28 @@
             if (closingAppHasWallpaper && openingAppHasWallpaper) {
                 if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Wallpaper animation!");
                 switch (transit) {
-                    case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
-                    case WindowManagerPolicy.TRANSIT_TASK_OPEN:
-                    case WindowManagerPolicy.TRANSIT_TASK_TO_FRONT:
-                        transit = WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN;
+                    case AppTransition.TRANSIT_ACTIVITY_OPEN:
+                    case AppTransition.TRANSIT_TASK_OPEN:
+                    case AppTransition.TRANSIT_TASK_TO_FRONT:
+                        transit = AppTransition.TRANSIT_WALLPAPER_INTRA_OPEN;
                         break;
-                    case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
-                    case WindowManagerPolicy.TRANSIT_TASK_CLOSE:
-                    case WindowManagerPolicy.TRANSIT_TASK_TO_BACK:
-                        transit = WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE;
+                    case AppTransition.TRANSIT_ACTIVITY_CLOSE:
+                    case AppTransition.TRANSIT_TASK_CLOSE:
+                    case AppTransition.TRANSIT_TASK_TO_BACK:
+                        transit = AppTransition.TRANSIT_WALLPAPER_INTRA_CLOSE;
                         break;
                 }
                 if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "New transit: " + transit);
             } else if ((oldWallpaper != null) && !mOpeningApps.contains(oldWallpaper.mAppToken)) {
                 // We are transitioning from an activity with
                 // a wallpaper to one without.
-                transit = WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE;
+                transit = AppTransition.TRANSIT_WALLPAPER_CLOSE;
                 if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
                         "New transit away from wallpaper: " + transit);
             } else if (mWallpaperTarget != null && mWallpaperTarget.isVisibleLw()) {
                 // We are transitioning from an activity without
                 // a wallpaper to now showing the wallpaper
-                transit = WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN;
+                transit = AppTransition.TRANSIT_WALLPAPER_OPEN;
                 if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
                         "New transit into wallpaper: " + transit);
             }
@@ -9250,7 +9253,7 @@
         mPolicy.setLastInputMethodWindowLw(null, null);
 
         if (mAppTransition.isTransitionSet()) {
-            mAppTransition.setAppTransition(WindowManagerPolicy.TRANSIT_UNSET);
+            mAppTransition.setAppTransition(AppTransition.TRANSIT_UNSET);
             mAppTransition.clear();
             mAppTransition.setReady();
         }
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 5b7cb99..cc58ad8e 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -1511,10 +1511,9 @@
         }
     }
 
-    // TODO(cmautner): Move back to WindowState?
     /**
      * Choose the correct animation and set it to the passed WindowState.
-     * @param transit If WindowManagerPolicy.TRANSIT_PREVIEW_DONE and the app window has been drawn
+     * @param transit If AppTransition.TRANSIT_PREVIEW_DONE and the app window has been drawn
      *      then the animation will be app_starting_exit. Any other value loads the animation from
      *      the switch statement below.
      * @param isEntrance The animation type the last time this was called. Used to keep from