Auto-show IME for dialogs on large screens.

On a large screen the IME is not going to as significantly
cover a pan & scan window, so allow it to auto-show if the
app hasn't otherwise specified its visibility.

Also some fixes here and there.

Change-Id: I10227ec59c43454e06e6870633f53426f4d78b83
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 761c5d9..cb7d0e2 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -54,7 +54,6 @@
 import android.util.Slog;
 import android.util.SparseArray;
 import android.util.TypedValue;
-import android.view.InputQueue.FinishedCallback;
 import android.view.View.MeasureSpec;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
@@ -775,7 +774,7 @@
                     baseSize = (int)mTmpValue.getDimension(packageMetrics);
                 }
                 if (DEBUG_DIALOG) Log.v(TAG, "Window " + mView + ": baseSize=" + baseSize);
-                if (desiredWindowWidth > baseSize) {
+                if (baseSize != 0 && desiredWindowWidth > baseSize) {
                     int maxHeight = (desiredWindowHeight*2)/3;
                     childWidthMeasureSpec = getRootMeasureSpec(baseSize, lp.width);
                     childHeightMeasureSpec = getRootMeasureSpec(desiredWindowHeight, lp.height);