Merge "Fix bug 5011824 - New Holo overflow menu for physical menu key devices"
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index f057d07..307959b 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1092,7 +1092,7 @@
         }
 
         final int listContent = mDropDownList.measureHeightOfChildren(MeasureSpec.UNSPECIFIED,
-                0, ListView.NO_POSITION, maxHeight - otherHeights, 2);
+                0, ListView.NO_POSITION, maxHeight - otherHeights, -1);
         // add padding only if the list has items in it, that way we don't show
         // the popup if it is not needed
         if (listContent > 0) otherHeights += padding;
diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml
index c2536b7..452b982 100644
--- a/core/res/res/layout/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_password_landscape.xml
@@ -24,15 +24,17 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
-    android:rowCount="7"
+    android:rowCount="8"
     android:id="@+id/root"
-    android:clipChildren="false">
+    android:clipChildren="false"
+    android:rowOrderPreserved="false">
 
     <!-- Column 0 -->
     <com.android.internal.widget.DigitalClock android:id="@+id/time"
         android:layout_marginTop="8dip"
         android:layout_marginBottom="8dip"
-        android:layout_gravity="right">
+        android:layout_gravity="right"
+        android:layout_rowSpan="2">
 
        <!-- Because we can't have multi-tone fonts, we render two TextViews, one on
         top of the other. Hence the redundant layout... -->
@@ -118,24 +120,33 @@
     />
 
     <!-- Column 1 -->
-    <Space android:layout_width="16dip" android:layout_rowSpan="7" />
+    <Space
+        android:layout_width="16dip"
+        android:layout_rowSpan="8"
+        android:layout_gravity="fill_vertical" />
 
     <!-- Column 2 - password entry field and PIN keyboard -->
-    <EditText android:id="@+id/passwordEntry"
-        android:layout_height="wrap_content"
-        android:layout_width="wrap_content"
-        android:layout_gravity="fill"
-        android:gravity="center"
-        android:singleLine="true"
-        android:textStyle="normal"
-        android:inputType="textPassword"
-        android:textSize="24sp"
-        android:minEms="8"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:background="@drawable/lockscreen_password_field_dark"
-        android:textColor="?android:attr/textColorPrimary"
-        android:imeOptions="flagNoFullscreen|actionDone"
-        />
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="270dip"
+        android:layout_gravity="center_vertical">
+
+        <EditText android:id="@+id/passwordEntry"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:gravity="center"
+            android:singleLine="true"
+            android:textStyle="normal"
+            android:inputType="textPassword"
+            android:textSize="24sp"
+            android:minEms="8"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:background="@drawable/lockscreen_password_field_dark"
+            android:textColor="?android:attr/textColorPrimary"
+            android:imeOptions="flagNoFullscreen|actionDone"
+            />
+
+    </LinearLayout>
 
     <!-- Numeric keyboard -->
     <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
@@ -146,7 +157,7 @@
         android:layout_marginTop="5dip"
         android:keyBackground="@*android:drawable/btn_keyboard_key_ics"
         android:visibility="gone"
-        android:layout_rowSpan="6"
+        android:layout_rowSpan="7"
     />
 
     <!-- Music transport control -->
@@ -154,7 +165,7 @@
         layout="@layout/keyguard_transport_control"
         android:layout_row="0"
         android:layout_column="0"
-        android:layout_rowSpan="5"
+        android:layout_rowSpan="6"
         android:layout_columnSpan="1"
         android:layout_gravity="fill"
         />
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
index 21a8c14..afa92f1 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -266,7 +266,7 @@
                 case OWNER_INFO:
                 case CARRIER_TEXT:
                 default:
-                    Log.w(TAG, "Not showing message id " + what + ", str=" + string);
+                    if (DEBUG) Log.w(TAG, "Not showing message id " + what + ", str=" + string);
             }
         } else {
             updateStatusLines(mShowingStatus);
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 7faf1a4..77f1932 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -20,7 +20,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.content.res.Configuration;
 import android.database.ContentObserver;
 import static android.os.BatteryManager.BATTERY_STATUS_CHARGING;
 import static android.os.BatteryManager.BATTERY_STATUS_FULL;
@@ -29,7 +28,6 @@
 import android.os.BatteryManager;
 import android.os.Handler;
 import android.os.Message;
-import android.os.SystemClock;
 import android.provider.Settings;
 import android.provider.Telephony;
 import static android.provider.Telephony.Intents.EXTRA_PLMN;
@@ -503,7 +501,8 @@
         if (!mSimStateCallbacks.contains(callback)) {
             mSimStateCallbacks.add(callback);
         } else {
-            Log.e(TAG, "Object tried to add another SIM callback", new Exception("Whoops"));
+            if (DEBUG) Log.e(TAG, "Object tried to add another SIM callback",
+                    new Exception("Whoops"));
         }
     }
 
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
index e5a7d64..6ee5861 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
@@ -127,10 +127,10 @@
         }
 
         if (enableScreenRotation) {
-            Log.d(TAG, "Rotation sensor for lock screen On!");
+            if (DEBUG) Log.d(TAG, "Rotation sensor for lock screen On!");
             mWindowLayoutParams.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
         } else {
-            Log.d(TAG, "Rotation sensor for lock screen Off!");
+            if (DEBUG) Log.d(TAG, "Rotation sensor for lock screen Off!");
             mWindowLayoutParams.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
         }
 
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 47d34b3..ee6d2ee 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -646,7 +646,7 @@
      * @see #onWakeKeyWhenKeyguardShowingTq(int)
      */
     private void wakeWhenReadyLocked(int keyCode) {
-        if (true || DBG_WAKE) Log.d(TAG, "wakeWhenReadyLocked(" + keyCode + ")");
+        if (DBG_WAKE) Log.d(TAG, "wakeWhenReadyLocked(" + keyCode + ")");
 
         /**
          * acquire the handoff lock that will keep the cpu running.  this will
@@ -741,7 +741,7 @@
 
                 int sequence = intent.getIntExtra("seq", 0);
 
-                if (false) Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = "
+                if (DEBUG) Log.d(TAG, "received DELAYED_KEYGUARD_ACTION with seq = "
                         + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence);
 
                 if (mDelayedShowingSequence == sequence) {
@@ -1033,13 +1033,15 @@
                         sfx.setStreamType(AudioManager.STREAM_SYSTEM);
                         sfx.play();
                     } else {
-                        Log.d(TAG, "playSounds: failed to load ringtone from uri: " + soundUri);
+                        if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: "
+                                + soundUri);
                     }
                 } else {
-                    Log.d(TAG, "playSounds: could not parse Uri: " + soundPath);
+                    if (DEBUG) Log.d(TAG, "playSounds: could not parse Uri: " + soundPath);
                 }
             } else {
-                Log.d(TAG, "playSounds: whichSound = " + whichSound + "; soundPath was null");
+                if (DEBUG) Log.d(TAG, "playSounds: whichSound = " + whichSound
+                        + "; soundPath was null");
             }
         }
     }