Merge change 25875 into eclair

* changes:
  Add fast track window animations.
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6f6e3cd..97dad56 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -258,7 +258,7 @@
              temporary hack until we add better framework support. -->
         <activity
             android:name=".ui.FastTrackActivity"
-            android:theme="@style/FullyTranslucent">
+            android:theme="@style/FullyTranslucent.FastTrack">
 
             <intent-filter>
                 <action android:name="com.android.contacts.action.FAST_TRACK" />
diff --git a/res/anim/dummy_animation.xml b/res/anim/dummy_animation.xml
new file mode 100644
index 0000000..5b42f24
--- /dev/null
+++ b/res/anim/dummy_animation.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<translate
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:fromXDelta="0"
+    android:toXDelta="0"
+    android:duration="@android:integer/config_shortAnimTime" />
diff --git a/res/anim/fasttrack_above_enter.xml b/res/anim/fasttrack_above_enter.xml
new file mode 100644
index 0000000..dc2d053
--- /dev/null
+++ b/res/anim/fasttrack_above_enter.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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">
+    <scale android:interpolator="@android:anim/decelerate_interpolator"
+            android:fromXScale="0.75" android:toXScale="1.0"
+            android:fromYScale="0.75" android:toYScale="1.0"
+            android:pivotX="50%" android:pivotY="100%"
+            android:duration="@android:integer/config_shortAnimTime" />
+    <alpha android:interpolator="@android:anim/decelerate_interpolator"
+            android:fromAlpha="0.0" android:toAlpha="1.0"
+            android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/anim/fasttrack_above_exit.xml b/res/anim/fasttrack_above_exit.xml
new file mode 100644
index 0000000..dd34f87
--- /dev/null
+++ b/res/anim/fasttrack_above_exit.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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:interpolator="@android:anim/accelerate_interpolator">
+    <scale android:fromXScale="1.0" android:toXScale=".5"
+            android:fromYScale="1.0" android:toYScale=".5"
+            android:pivotX="50%" android:pivotY="100%"
+            android:duration="@android:integer/config_shortAnimTime" />
+    <alpha android:fromAlpha="1.0" android:toAlpha="0"
+            android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/anim/fasttrack_below_enter.xml b/res/anim/fasttrack_below_enter.xml
new file mode 100644
index 0000000..9a1a577
--- /dev/null
+++ b/res/anim/fasttrack_below_enter.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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">
+    <scale android:interpolator="@android:anim/decelerate_interpolator"
+            android:fromXScale="0.75" android:toXScale="1.0"
+            android:fromYScale="0.75" android:toYScale="1.0"
+            android:pivotX="50%" android:pivotY="0%"
+            android:duration="@android:integer/config_shortAnimTime" />
+    <alpha android:interpolator="@android:anim/decelerate_interpolator"
+            android:fromAlpha="0.0" android:toAlpha="1.0"
+            android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/anim/fasttrack_below_exit.xml b/res/anim/fasttrack_below_exit.xml
new file mode 100644
index 0000000..7587c7a
--- /dev/null
+++ b/res/anim/fasttrack_below_exit.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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:interpolator="@android:anim/accelerate_interpolator">
+    <scale android:fromXScale="1.0" android:toXScale=".5"
+            android:fromYScale="1.0" android:toYScale=".5"
+            android:pivotX="50%" android:pivotY="0%"
+            android:duration="@android:integer/config_shortAnimTime" />
+    <alpha android:fromAlpha="1.0" android:toAlpha="0"
+            android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index b656160..ad44b34 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -48,6 +48,14 @@
         <item name="android:windowContentOverlay">@null</item>
     </style>
 
+    <style name="FullyTranslucent.FastTrack">
+        <!-- This is a hack because we want to be able to animate away the
+             FastTrack window, and we close its containing activity at the
+             same time.  So put in a dummy animation so this guy sticks around
+             while the fast track window is animating. -->
+        <item name="android:windowAnimationStyle">@style/DummyAnimation</item>
+    </style>
+
     <style name="FastTrack">
         <item name="android:windowFrame">@null</item>
         <item name="android:windowBackground">@android:color/transparent</item>
@@ -59,4 +67,18 @@
         -->
     </style>
 
+    <style name="FastTrackAboveAnimation">
+        <item name="android:windowEnterAnimation">@anim/fasttrack_above_enter</item>
+        <item name="android:windowExitAnimation">@anim/fasttrack_above_exit</item>
+    </style>
+
+    <style name="FastTrackBelowAnimation">
+        <item name="android:windowEnterAnimation">@anim/fasttrack_below_enter</item>
+        <item name="android:windowExitAnimation">@anim/fasttrack_below_exit</item>
+    </style>
+
+    <style name="DummyAnimation">
+        <item name="android:windowExitAnimation">@anim/dummy_animation</item>
+    </style>
+
 </resources>
diff --git a/src/com/android/contacts/ui/FastTrackWindow.java b/src/com/android/contacts/ui/FastTrackWindow.java
index 630ecc4..d4aad19 100644
--- a/src/com/android/contacts/ui/FastTrackWindow.java
+++ b/src/com/android/contacts/ui/FastTrackWindow.java
@@ -310,12 +310,14 @@
             // edge with top of anchor area, and adjusting to inset arrow.
             showArrow(R.id.arrow_down, mAnchor.centerX());
             l.y = mAnchor.top - blockHeight + mShadowHeight;
+            l.windowAnimations = R.style.FastTrackAboveAnimation;
 
         } else {
             // Otherwise show upwards callout, aligning block top with bottom of
             // anchor area, and adjusting to inset arrow.
             showArrow(R.id.arrow_up, mAnchor.centerX());
             l.y = mAnchor.bottom - mShadowHeight;
+            l.windowAnimations = R.style.FastTrackBelowAnimation;
 
         }
 
@@ -338,6 +340,14 @@
             return;
         }
 
+        boolean hadDecor = mDecor != null;
+        
+        if (hadDecor) {
+            mWindowManager.removeView(mDecor);
+            mDecor = null;
+            mWindow.closeAllPanels();
+        }
+
         // Completely hide header from current mode
         mHeader.setVisibility(View.GONE);
 
@@ -360,16 +370,13 @@
         mHasSocial = false;
         mHasActions = false;
 
-        if (mDecor == null || !mShowing) {
+        if (!hadDecor || !mShowing) {
             Log.d(TAG, "not showing, ignore");
             return;
         }
 
-        mWindowManager.removeView(mDecor);
-        mDecor = null;
-        mWindow.closeAllPanels();
         mShowing = false;
-
+        
         // Notify any listeners that we've been dismissed
         if (mDismissListener != null) {
             mDismissListener.onDismiss(this);