summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-11-29 22:56:03 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-29 22:56:03 -0800
commitfefc0743f8b0e8a936f0d138de20eca025ffe8c7 (patch)
tree64866da45fc71fad944c4eea64f58e6fff23ff1b
parentaf4bf400abab86baee44dacbcdf13444d06ee46e (diff)
parent7d3a5bcf300aea7bffb1d46f28e244ca807f5e82 (diff)
downloadframeworks_base-fefc0743f8b0e8a936f0d138de20eca025ffe8c7.zip
frameworks_base-fefc0743f8b0e8a936f0d138de20eca025ffe8c7.tar.gz
frameworks_base-fefc0743f8b0e8a936f0d138de20eca025ffe8c7.tar.bz2
Merge "Auto-show IME for dialogs on large screens."
-rw-r--r--core/java/android/content/res/Configuration.java2
-rw-r--r--core/java/android/view/ViewRoot.java3
-rw-r--r--core/res/res/values-xlarge/config.xml2
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java36
4 files changed, 28 insertions, 15 deletions
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 935d234..31119d7 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -104,7 +104,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
public boolean isLayoutSizeAtLeast(int size) {
int cur = screenLayout&SCREENLAYOUT_SIZE_MASK;
if (cur == SCREENLAYOUT_SIZE_UNDEFINED) return false;
- return size >= cur;
+ return cur >= size;
}
public static final int TOUCHSCREEN_UNDEFINED = 0;
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.Log;
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 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn
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);
diff --git a/core/res/res/values-xlarge/config.xml b/core/res/res/values-xlarge/config.xml
index 2f1f4cf..4c8bbe6 100644
--- a/core/res/res/values-xlarge/config.xml
+++ b/core/res/res/values-xlarge/config.xml
@@ -34,7 +34,7 @@
<integer name="config_longPressOnHomeBehavior">0</integer>
<!-- see comment in values/config.xml -->
- <dimen name="config_prefDialogWidth">440dp</dimen>
+ <dimen name="config_prefDialogWidth">580dp</dimen>
</resources>
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index c7bfdc8..95200fa 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -55,7 +55,6 @@ import android.os.IBinder;
import android.os.IInterface;
import android.os.Message;
import android.os.Parcel;
-import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
@@ -125,6 +124,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private static final String SUBTYPE_MODE_VOICE = "voice";
final Context mContext;
+ final Resources mRes;
final Handler mHandler;
final InputMethodSettings mSettings;
final SettingsObserver mSettingsObserver;
@@ -468,6 +468,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
public InputMethodManagerService(Context context, StatusBarManagerService statusBar) {
mContext = context;
+ mRes = context.getResources();
mHandler = new Handler(this);
mIWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
@@ -1214,11 +1215,22 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
mCurFocusedWindow = windowToken;
+ // Should we auto-show the IME even if the caller has not
+ // specified what should be done with it?
+ // We only do this automatically if the window can resize
+ // to accommodate the IME (so what the user sees will give
+ // them good context without input information being obscured
+ // by the IME) or if running on a large screen where there
+ // is more room for the target window + IME.
+ final boolean doAutoShow =
+ (softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST)
+ == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
+ || mRes.getConfiguration().isLayoutSizeAtLeast(
+ Configuration.SCREENLAYOUT_SIZE_LARGE);
+
switch (softInputMode&WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE) {
case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED:
- if (!isTextEditor || (softInputMode &
- WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST)
- != WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
+ if (!isTextEditor || !doAutoShow) {
if (WindowManager.LayoutParams.mayUseInputMethod(windowFlags)) {
// There is no focus view, and this window will
// be behind any soft input window, so hide the
@@ -1226,13 +1238,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
if (DEBUG) Slog.v(TAG, "Unspecified window will hide input");
hideCurrentInputLocked(InputMethodManager.HIDE_NOT_ALWAYS, null);
}
- } else if (isTextEditor && (softInputMode &
- WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST)
- == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
- && (softInputMode &
- WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
+ } else if (isTextEditor && doAutoShow && (softInputMode &
+ WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
// There is a focus view, and we are navigating forward
// into the window, so show the input window for the user.
+ // We only do this automatically if the window an resize
+ // to accomodate the IME (so what the user sees will give
+ // them good context without input information being obscured
+ // by the IME) or if running on a large screen where there
+ // is more room for the target window + IME.
if (DEBUG) Slog.v(TAG, "Unspecified window will show input");
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
}
@@ -1544,7 +1558,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
map.clear();
PackageManager pm = mContext.getPackageManager();
- final Configuration config = mContext.getResources().getConfiguration();
+ final Configuration config = mRes.getConfiguration();
final boolean haveHardKeyboard = config.keyboard == Configuration.KEYBOARD_QWERTY;
String disabledSysImes = Settings.Secure.getString(mContext.getContentResolver(),
Secure.DISABLED_SYSTEM_INPUT_METHODS);
@@ -1944,7 +1958,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
return null;
}
if (TextUtils.isEmpty(locale)) {
- locale = mContext.getResources().getConfiguration().locale.toString();
+ locale = mRes.getConfiguration().locale.toString();
}
final String language = locale.substring(0, 2);
boolean partialMatchFound = false;