Implement nice transitions for light status bar

- When the flag changes, apply an animation from the current value
- When the flag change is caused by an app transition, synchronize
  the status bar animation with the app transition animation.
  PhoneWindowManager calculates the timings based on some heuristics
  of the app transition animations and supplies these timings to
  StatusBarService.

Bug: 19233606
Change-Id: I4f99afba8f1eebb3524699ed4d7fbafee5463a37
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index b90d263..f691b4e 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -74,6 +74,7 @@
 import android.util.DisplayMetrics;
 import android.util.EventLog;
 import android.util.Log;
+import android.util.Pair;
 import android.util.Slog;
 import android.util.SparseArray;
 import android.view.Display;
@@ -103,6 +104,8 @@
 import android.view.animation.Animation;
 import android.view.animation.AnimationSet;
 import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.view.animation.TranslateAnimation;
 
 import com.android.internal.R;
 import com.android.internal.statusbar.IStatusBarService;
@@ -724,12 +727,7 @@
     }
     MyOrientationListener mOrientationListener;
 
-    private final BarController mStatusBarController = new BarController("StatusBar",
-            View.STATUS_BAR_TRANSIENT,
-            View.STATUS_BAR_UNHIDE,
-            View.STATUS_BAR_TRANSLUCENT,
-            StatusBarManager.WINDOW_STATUS_BAR,
-            WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+    private final StatusBarController mStatusBarController = new StatusBarController();
 
     private final BarController mNavigationBarController = new BarController("NavigationBar",
             View.NAVIGATION_BAR_TRANSIENT,
@@ -1359,6 +1357,9 @@
         if (!mPowerManager.isInteractive()) {
             goingToSleep(WindowManagerPolicy.OFF_BECAUSE_OF_USER);
         }
+
+        mWindowManagerInternal.registerAppTransitionListener(
+                mStatusBarController.getAppTransitionListener());
     }
 
     /**