Fix bug 3058324

PopupWindow now responds to the style attribute popupAnimationStyle
instead of windowAnimationStyle. The latter was being overridden with
undesired values. Animation.PopupWindow style added as a special
default sentinel value, which switches animation styles based on
whether the window is showing above or below an anchor.

Change-Id: Id7cc81f089b6053f2d3a495b1046002548ecf125
diff --git a/api/current.xml b/api/current.xml
index 8c164c1..03fc03a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -5806,17 +5806,6 @@
  visibility="public"
 >
 </field>
-<field name="kraken_resource_pad56"
- type="int"
- transient="false"
- volatile="false"
- value="16843465"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
 <field name="kraken_resource_pad6"
  type="int"
  transient="false"
@@ -7170,6 +7159,17 @@
  visibility="public"
 >
 </field>
+<field name="popupAnimationStyle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843465"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="popupBackground"
  type="int"
  transient="false"
@@ -79217,7 +79217,7 @@
  type="float"
  transient="false"
  volatile="false"
- value="0.001f"
+ value="0.0010f"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -225166,7 +225166,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index ed15e25..055ba87 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -167,7 +167,10 @@
                 attrs, com.android.internal.R.styleable.PopupWindow, defStyle, 0);
 
         mBackground = a.getDrawable(R.styleable.PopupWindow_popupBackground);
-        mAnimationStyle = a.getResourceId(R.styleable.PopupWindow_windowAnimationStyle, -1);
+
+        final int animStyle = a.getResourceId(R.styleable.PopupWindow_popupAnimationStyle, -1);
+        mAnimationStyle = animStyle == com.android.internal.R.style.Animation_PopupWindow ? -1 :
+                animStyle;
 
         // If this is a StateListDrawable, try to find and store the drawable to be
         // used when the drop-down is placed above its anchor view, and the one to be
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 7b0a502..6f0ce71 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2239,7 +2239,7 @@
     </declare-styleable>
     <declare-styleable name="PopupWindow">
         <attr name="popupBackground" format="reference|color" />
-        <attr name="windowAnimationStyle" />
+        <attr name="popupAnimationStyle" format="reference" />
     </declare-styleable>
     <declare-styleable name="ViewAnimator">
         <attr name="inAnimation" format="reference" />
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 3fc93e7..10cb446 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1259,6 +1259,7 @@
   <public type="attr" name="textSelectHandleRight" id="0x010102c6" />
   <public type="attr" name="textSelectHandle" id="0x010102c7" />
   <public type="attr" name="textSelectHandleWindowStyle" id="0x010102c8" />
+  <public type="attr" name="popupAnimationStyle" id="0x010102c9" />
 
   <public-padding type="attr" name="kraken_resource_pad" end="0x01010300" />
   
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 02524bf..c92fc8c 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -185,6 +185,9 @@
         <item name="windowExitAnimation">@anim/fade_out</item>
     </style>
 
+    <!-- A special animation value used internally for popup windows. -->
+    <style name="Animation.PopupWindow" />
+
     <!-- Status Bar Styles -->
 
     <style name="TextAppearance.StatusBar">
@@ -550,6 +553,7 @@
     
     <style name="Widget.PopupWindow">
         <item name="android:popupBackground">@android:drawable/editbox_dropdown_background_dark</item>
+        <item name="android:popupAnimationStyle">@android:style/Animation.PopupWindow</item>
     </style>
 
     <style name="Widget.KeyboardView" parent="android:Widget">
@@ -863,7 +867,7 @@
 
     <!-- Style for the small popup windows that contain text selection anchors. -->
     <style name="Widget.TextSelectHandle">
-        <item name="android:windowAnimationStyle">@android:style/Animation.TextSelectHandle</item>
+        <item name="android:popupAnimationStyle">@android:style/Animation.TextSelectHandle</item>
     </style>
 
     <!-- Style for animating text selection handles. -->