Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fefc0743 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Auto-show IME for dialogs on large screens."

parents af4bf400 7d3a5bcf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −2
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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>
+25 −11
Original line number Diff line number Diff line
@@ -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 &
                        } 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;