Merge "Fix bug 5133509 - Align holo menu panel windows along the bottom of the screen"
diff --git a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png
new file mode 100644
index 0000000..53871a05
--- /dev/null
+++ b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png
new file mode 100644
index 0000000..e3a0313
--- /dev/null
+++ b/core/res/res/drawable-hdpi/menu_hardkey_panel_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png
new file mode 100644
index 0000000..9d80b77
--- /dev/null
+++ b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png
new file mode 100644
index 0000000..efa4325
--- /dev/null
+++ b/core/res/res/drawable-mdpi/menu_hardkey_panel_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png
new file mode 100644
index 0000000..521e2d9
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png
new file mode 100644
index 0000000..92e117d
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/menu_hardkey_panel_holo_light.9.png
Binary files differ
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 04e510b..57e9bbf 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -163,6 +163,8 @@
        <item>@drawable/list_selector_holo_light</item>
        <item>@drawable/menu_background</item>
        <item>@drawable/menu_background_fill_parent_width</item>
+       <item>@drawable/menu_hardkey_panel_holo_dark</item>
+       <item>@drawable/menu_hardkey_panel_holo_light</item>
        <item>@drawable/menu_submenu_background</item>
        <item>@drawable/menu_selector</item>
        <item>@drawable/overscroll_edge</item>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 903fc04..f8866f2 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -980,7 +980,7 @@
         <item name="toastFrameBackground">@android:drawable/toast_frame_holo</item>
         
         <!-- Panel attributes -->
-        <item name="panelBackground">@android:drawable/menu_dropdown_panel_holo_dark</item>
+        <item name="panelBackground">@android:drawable/menu_hardkey_panel_holo_dark</item>
         <item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>
         <!-- These three attributes do not seems to be used by the framework. Declared public though -->
         <item name="panelColorBackground">#000</item>
@@ -1283,7 +1283,7 @@
         <item name="toastFrameBackground">@android:drawable/toast_frame_holo</item>
         
         <!-- Panel attributes -->
-        <item name="panelBackground">@android:drawable/menu_dropdown_panel_holo_light</item>
+        <item name="panelBackground">@android:drawable/menu_hardkey_panel_holo_light</item>
         <item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>
         <!-- These three attributes do not seems to be used by the framework. Declared public though -->
         <item name="panelColorBackground">#000</item>
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index e258b1a..192d32b 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -5291,24 +5291,24 @@
                     case Surface.ROTATION_0:
                         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                     case Surface.ROTATION_90:
-                        return Gravity.RIGHT | Gravity.CENTER_VERTICAL;
+                        return Gravity.RIGHT | Gravity.BOTTOM;
                     case Surface.ROTATION_180:
-                        return Gravity.CENTER_HORIZONTAL | Gravity.TOP;
+                        return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                     case Surface.ROTATION_270:
-                        return Gravity.LEFT | Gravity.CENTER_VERTICAL;
+                        return Gravity.LEFT | Gravity.BOTTOM;
                 }
             } else {
                 // On devices with a natural orientation of landscape
                 switch (rotation) {
                     default:
                     case Surface.ROTATION_0:
-                        return Gravity.RIGHT | Gravity.CENTER_VERTICAL;
+                        return Gravity.RIGHT | Gravity.BOTTOM;
                     case Surface.ROTATION_90:
                         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                     case Surface.ROTATION_180:
-                        return Gravity.LEFT | Gravity.CENTER_VERTICAL;
+                        return Gravity.LEFT | Gravity.BOTTOM;
                     case Surface.ROTATION_270:
-                        return Gravity.CENTER_HORIZONTAL | Gravity.TOP;
+                        return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
                 }
             }
         }