diff options
author | Craig Mautner <cmautner@google.com> | 2012-12-27 17:20:01 -0800 |
---|---|---|
committer | Craig Mautner <cmautner@google.com> | 2013-01-07 23:38:57 -0800 |
commit | 4b71aa1f8a1a3b7189fd29241ea7c594ce01623c (patch) | |
tree | 2df032d5fff2a76836cb210c2e29c8f1259563a0 | |
parent | ecba50e528b99b581a9d1016bb8790709363699d (diff) | |
download | frameworks_base-4b71aa1f8a1a3b7189fd29241ea7c594ce01623c.zip frameworks_base-4b71aa1f8a1a3b7189fd29241ea7c594ce01623c.tar.gz frameworks_base-4b71aa1f8a1a3b7189fd29241ea7c594ce01623c.tar.bz2 |
Move app transition constants
Move app transition constants from WindowManagerPolicy to
AppTransition.
Change-Id: I8ae6c4d0da1db826c44eb4ea0c6b85016b50b1a3
8 files changed, 205 insertions, 201 deletions
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 47ef638..9377cfa 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -401,61 +401,19 @@ public interface WindowManagerPolicy { public void rebootSafeMode(boolean confirm); } - /** - * Bit mask that is set for all enter transition. - */ - public final int TRANSIT_ENTER_MASK = 0x1000; - - /** - * Bit mask that is set for all exit transitions. - */ - public final int TRANSIT_EXIT_MASK = 0x2000; - - /** Not set up for a transition. */ - public final int TRANSIT_UNSET = -1; - /** No animation for transition. */ - public final int TRANSIT_NONE = 0; /** Window has been added to the screen. */ - public final int TRANSIT_ENTER = 1 | TRANSIT_ENTER_MASK; + public static final int TRANSIT_ENTER = 1; /** Window has been removed from the screen. */ - public final int TRANSIT_EXIT = 2 | TRANSIT_EXIT_MASK; + public static final int TRANSIT_EXIT = 2; /** Window has been made visible. */ - public final int TRANSIT_SHOW = 3 | TRANSIT_ENTER_MASK; - /** Window has been made invisible. */ - public final int TRANSIT_HIDE = 4 | TRANSIT_EXIT_MASK; + public static final int TRANSIT_SHOW = 3; + /** Window has been made invisible. + * TODO: Consider removal as this is unused. */ + public static final int TRANSIT_HIDE = 4; /** The "application starting" preview window is no longer needed, and will * animate away to show the real window. */ - public final int TRANSIT_PREVIEW_DONE = 5; - /** A window in a new activity is being opened on top of an existing one - * in the same task. */ - public 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 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 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 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 final int TRANSIT_TASK_TO_FRONT = 10 | TRANSIT_ENTER_MASK; - /** A window in an existing task is being put below all other tasks. */ - public 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 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 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 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 final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15 | TRANSIT_EXIT_MASK; - + public static final int TRANSIT_PREVIEW_DONE = 5; + // NOTE: screen off reasons are in order of significance, with more // important ones lower than less important ones. diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 5bf7e21..dfc9044 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1711,31 +1711,40 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final boolean PRINT_ANIM = false; /** {@inheritDoc} */ + @Override public int selectAnimationLw(WindowState win, int transit) { if (PRINT_ANIM) Log.i(TAG, "selectAnimation in " + win + ": transit=" + transit); if (win == mStatusBar) { - if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { + if (transit == TRANSIT_EXIT + || transit == TRANSIT_HIDE) { return R.anim.dock_top_exit; - } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { + } else if (transit == TRANSIT_ENTER + || transit == TRANSIT_SHOW) { return R.anim.dock_top_enter; } } else if (win == mNavigationBar) { // This can be on either the bottom or the right. if (mNavigationBarOnBottom) { - if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { + if (transit == TRANSIT_EXIT + || transit == TRANSIT_HIDE) { return R.anim.dock_bottom_exit; - } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { + } else if (transit == TRANSIT_ENTER + || transit == TRANSIT_SHOW) { return R.anim.dock_bottom_enter; } } else { - if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { + if (transit == TRANSIT_EXIT + || transit == TRANSIT_HIDE) { return R.anim.dock_right_exit; - } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { + } else if (transit == TRANSIT_ENTER + || transit == TRANSIT_SHOW) { return R.anim.dock_right_enter; } } - } if (transit == TRANSIT_PREVIEW_DONE) { + } + + if (transit == TRANSIT_PREVIEW_DONE) { if (win.hasAppShownWindows()) { if (PRINT_ANIM) Log.i(TAG, "**** STARTING EXIT"); return com.android.internal.R.anim.app_starting_exit; @@ -4568,71 +4577,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } - /** - * Returns the human readable name of a window transition. - * - * @param transition The window transition. - * @return The transition symbolic name. - */ - public static String windowTransitionToString(int transition) { - switch (transition) { - case WindowManagerPolicy.TRANSIT_UNSET: { - return "TRANSIT_UNSET"; - } - case WindowManagerPolicy.TRANSIT_NONE: { - return "TRANSIT_NONE"; - } - case WindowManagerPolicy.TRANSIT_ENTER: { - return "TRANSIT_ENTER"; - } - case WindowManagerPolicy.TRANSIT_EXIT: { - return "TRANSIT_EXIT"; - } - case WindowManagerPolicy.TRANSIT_SHOW: { - return "TRANSIT_SHOW"; - } - case WindowManagerPolicy.TRANSIT_EXIT_MASK: { - return "TRANSIT_EXIT_MASK"; - } - case WindowManagerPolicy.TRANSIT_PREVIEW_DONE: { - return "TRANSIT_PREVIEW_DONE"; - } - case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN: { - return "TRANSIT_ACTIVITY_OPEN"; - } - case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE: { - return "TRANSIT_ACTIVITY_CLOSE"; - } - case WindowManagerPolicy.TRANSIT_TASK_OPEN: { - return "TRANSIT_TASK_OPEN"; - } - case WindowManagerPolicy.TRANSIT_TASK_CLOSE: { - return "TRANSIT_TASK_CLOSE"; - } - case WindowManagerPolicy.TRANSIT_TASK_TO_FRONT: { - return "TRANSIT_TASK_TO_FRONT"; - } - case WindowManagerPolicy.TRANSIT_TASK_TO_BACK: { - return "TRANSIT_TASK_TO_BACK"; - } - case WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE: { - return "TRANSIT_WALLPAPER_CLOSE"; - } - case WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN: { - return "TRANSIT_WALLPAPER_OPEN"; - } - case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN: { - return "TRANSIT_WALLPAPER_INTRA_OPEN"; - } - case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE: { - return "TRANSIT_WALLPAPER_INTRA_CLOSE"; - } - default: { - return "<UNKNOWN>"; - } - } - } - @Override public void dump(String prefix, PrintWriter pw, String[] args) { pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode); 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.SystemServer; 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.Gravity; 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 @@ public final class ActivityManagerService extends ActivityManagerNative 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 static android.content.pm.PackageManager.PERMISSION_GRANTED; 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.EventLog; 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 @@ final class ActivityStack { } } } - }; - + } + ActivityStack(ActivityManagerService service, Context context, boolean mainStack, Looper looper) { mHandler = new ActivityStackHandler(looper); mService = service; @@ -1612,11 +1612,11 @@ final class ActivityStack { "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 @@ final class ActivityStack { 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 @@ final class ActivityStack { 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 @@ final class ActivityStack { "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 @@ final class ActivityStack { 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 @@ final class ActivityStack { (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 @@ final class ActivityStack { 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 @@ final class ActivityStack { 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.Handler; 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 com.android.server.wm.WindowManagerService.H; 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 @@ public class AppTransition implements Dump { 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 @@ public class AppTransition implements Dump { } void goodToGo() { - mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET; + mNextAppTransition = TRANSIT_UNSET; mAppTransitionReady = false; mAppTransitionRunning = true; mAppTransitionTimeout = false; @@ -282,8 +322,8 @@ public class AppTransition implements Dump { 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 @@ public class AppTransition implements Dump { // 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 @@ public class AppTransition implements Dump { } 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 @@ public class AppTransition implements Dump { // 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 @@ public class AppTransition implements Dump { } 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 @@ public class AppTransition implements Dump { 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 android.view.animation.Interpolator; 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 @@ final class DisplayMagnifier { 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 @@ final class DisplayMagnifier { 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub //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 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub ValueAnimator.setDurationScale(scale); } + @Override public float getAnimationScale(int which) { switch (which) { case 0: return mWindowAnimationScale; @@ -4848,6 +4850,7 @@ public class WindowManagerService extends IWindowManager.Stub return 0; } + @Override public float[] getAnimationScales() { return new float[] { mWindowAnimationScale, mTransitionAnimationScale, mAnimatorDurationScale }; @@ -7813,7 +7816,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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..cc58ad8 100644 --- a/services/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/java/com/android/server/wm/WindowStateAnimator.java @@ -1511,10 +1511,9 @@ class WindowStateAnimator { } } - // 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 |