Merge "Disable soft keyboard when keyboard attached." into honeycomb
This commit is contained in:
@ -353,8 +353,7 @@ public class MenuBuilder implements Menu {
|
|||||||
mNonActionItems = new ArrayList<MenuItemImpl>();
|
mNonActionItems = new ArrayList<MenuItemImpl>();
|
||||||
mIsActionItemsStale = true;
|
mIsActionItemsStale = true;
|
||||||
|
|
||||||
mShortcutsVisible =
|
setShortcutsVisibleInner(true);
|
||||||
(mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuBuilder setDefaultShowAsAction(int defaultShowAsAction) {
|
public MenuBuilder setDefaultShowAsAction(int defaultShowAsAction) {
|
||||||
@ -782,14 +781,18 @@ public class MenuBuilder implements Menu {
|
|||||||
*/
|
*/
|
||||||
public void setShortcutsVisible(boolean shortcutsVisible) {
|
public void setShortcutsVisible(boolean shortcutsVisible) {
|
||||||
if (mShortcutsVisible == shortcutsVisible) return;
|
if (mShortcutsVisible == shortcutsVisible) return;
|
||||||
|
|
||||||
mShortcutsVisible =
|
setShortcutsVisibleInner(shortcutsVisible);
|
||||||
(mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS)
|
|
||||||
&& shortcutsVisible;
|
|
||||||
|
|
||||||
refreshShortcuts(mShortcutsVisible, isQwertyMode());
|
refreshShortcuts(mShortcutsVisible, isQwertyMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setShortcutsVisibleInner(boolean shortcutsVisible) {
|
||||||
|
mShortcutsVisible = shortcutsVisible
|
||||||
|
&& mResources.getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS
|
||||||
|
&& mResources.getBoolean(
|
||||||
|
com.android.internal.R.bool.config_showMenuShortcutsWhenKeyboardPresent);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether shortcuts should be visible on menus.
|
* @return Whether shortcuts should be visible on menus.
|
||||||
*/
|
*/
|
||||||
|
@ -529,4 +529,8 @@
|
|||||||
<!-- When a database query is executed, the results retuned are paginated
|
<!-- When a database query is executed, the results retuned are paginated
|
||||||
in pages of size (in KB) indicated by this value -->
|
in pages of size (in KB) indicated by this value -->
|
||||||
<integer name="config_cursorWindowSize">2048</integer>
|
<integer name="config_cursorWindowSize">2048</integer>
|
||||||
|
|
||||||
|
<!-- Sets whether menu shortcuts should be displayed on panel menus when
|
||||||
|
a keyboard is present. -->
|
||||||
|
<bool name="config_showMenuShortcutsWhenKeyboardPresent">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1624,24 +1624,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
// First handle chording of panel key: if a panel key is held
|
// First handle chording of panel key: if a panel key is held
|
||||||
// but not released, try to execute a shortcut in it.
|
// but not released, try to execute a shortcut in it.
|
||||||
if ((mPanelChordingKey > 0) && (mPanelChordingKey != keyCode)) {
|
if ((mPanelChordingKey > 0) && (mPanelChordingKey != keyCode)) {
|
||||||
// Perform the shortcut (mPreparedPanel can be null since
|
boolean handled = dispatchKeyShortcutEvent(event);
|
||||||
// global shortcuts (such as search) don't rely on a
|
|
||||||
// prepared panel or menu).
|
|
||||||
boolean handled = performPanelShortcut(mPreparedPanel, keyCode, event,
|
|
||||||
Menu.FLAG_PERFORM_NO_CLOSE);
|
|
||||||
|
|
||||||
if (!handled) {
|
|
||||||
/*
|
|
||||||
* If not handled, then pass it to the view hierarchy
|
|
||||||
* and anyone else that may be interested.
|
|
||||||
*/
|
|
||||||
handled = dispatchKeyShortcutEvent(event);
|
|
||||||
|
|
||||||
if (handled && mPreparedPanel != null) {
|
|
||||||
mPreparedPanel.isHandled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (handled) {
|
if (handled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1676,6 +1659,19 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyShortcutEvent(KeyEvent ev) {
|
public boolean dispatchKeyShortcutEvent(KeyEvent ev) {
|
||||||
|
// Perform the shortcut (mPreparedPanel can be null since
|
||||||
|
// global shortcuts (such as search) don't rely on a
|
||||||
|
// prepared panel or menu).
|
||||||
|
boolean handled = performPanelShortcut(mPreparedPanel, ev.getKeyCode(), ev,
|
||||||
|
Menu.FLAG_PERFORM_NO_CLOSE);
|
||||||
|
if (handled) {
|
||||||
|
if (mPreparedPanel != null) {
|
||||||
|
mPreparedPanel.isHandled = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shortcut not handled by the panel. Dispatch to the view hierarchy.
|
||||||
final Callback cb = getCallback();
|
final Callback cb = getCallback();
|
||||||
return cb != null && mFeatureId < 0 ? cb.dispatchKeyShortcutEvent(ev) : super
|
return cb != null && mFeatureId < 0 ? cb.dispatchKeyShortcutEvent(ev) : super
|
||||||
.dispatchKeyShortcutEvent(ev);
|
.dispatchKeyShortcutEvent(ev);
|
||||||
|
@ -239,9 +239,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
volatile boolean mPowerKeyHandled;
|
volatile boolean mPowerKeyHandled;
|
||||||
RecentApplicationsDialog mRecentAppsDialog;
|
RecentApplicationsDialog mRecentAppsDialog;
|
||||||
Handler mHandler;
|
Handler mHandler;
|
||||||
|
|
||||||
|
private static final int LID_ABSENT = -1;
|
||||||
|
private static final int LID_CLOSED = 0;
|
||||||
|
private static final int LID_OPEN = 1;
|
||||||
|
|
||||||
|
int mLidOpen = LID_ABSENT;
|
||||||
|
|
||||||
boolean mSystemReady;
|
boolean mSystemReady;
|
||||||
boolean mLidOpen;
|
|
||||||
boolean mHdmiPlugged;
|
boolean mHdmiPlugged;
|
||||||
int mUiMode = Configuration.UI_MODE_TYPE_NORMAL;
|
int mUiMode = Configuration.UI_MODE_TYPE_NORMAL;
|
||||||
int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
|
int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
|
||||||
@ -896,21 +901,31 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
void readLidState() {
|
void readLidState() {
|
||||||
try {
|
try {
|
||||||
int sw = mWindowManager.getSwitchState(SW_LID);
|
int sw = mWindowManager.getSwitchState(SW_LID);
|
||||||
if (sw >= 0) {
|
if (sw > 0) {
|
||||||
mLidOpen = sw == 0;
|
mLidOpen = LID_OPEN;
|
||||||
|
} else if (sw == 0) {
|
||||||
|
mLidOpen = LID_CLOSED;
|
||||||
|
} else {
|
||||||
|
mLidOpen = LID_ABSENT;
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int determineHiddenState(boolean lidOpen,
|
private int determineHiddenState(int mode, int hiddenValue, int visibleValue) {
|
||||||
int mode, int hiddenValue, int visibleValue) {
|
if (KEYBOARD_ALWAYS_HIDDEN) {
|
||||||
|
return hiddenValue;
|
||||||
|
}
|
||||||
|
if (mLidOpen == LID_ABSENT) {
|
||||||
|
return visibleValue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 1:
|
case 1:
|
||||||
return lidOpen ? visibleValue : hiddenValue;
|
return mLidOpen == LID_OPEN ? visibleValue : hiddenValue;
|
||||||
case 2:
|
case 2:
|
||||||
return lidOpen ? hiddenValue : visibleValue;
|
return mLidOpen == LID_OPEN ? hiddenValue : visibleValue;
|
||||||
}
|
}
|
||||||
return visibleValue;
|
return visibleValue;
|
||||||
}
|
}
|
||||||
@ -918,12 +933,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void adjustConfigurationLw(Configuration config) {
|
public void adjustConfigurationLw(Configuration config) {
|
||||||
readLidState();
|
readLidState();
|
||||||
final boolean lidOpen = !KEYBOARD_ALWAYS_HIDDEN && mLidOpen;
|
mPowerManager.setKeyboardVisibility(mLidOpen == LID_OPEN);
|
||||||
mPowerManager.setKeyboardVisibility(lidOpen);
|
config.hardKeyboardHidden = determineHiddenState(
|
||||||
config.hardKeyboardHidden = determineHiddenState(lidOpen,
|
|
||||||
mLidKeyboardAccessibility, Configuration.HARDKEYBOARDHIDDEN_YES,
|
mLidKeyboardAccessibility, Configuration.HARDKEYBOARDHIDDEN_YES,
|
||||||
Configuration.HARDKEYBOARDHIDDEN_NO);
|
Configuration.HARDKEYBOARDHIDDEN_NO);
|
||||||
config.navigationHidden = determineHiddenState(lidOpen,
|
config.navigationHidden = determineHiddenState(
|
||||||
mLidNavigationAccessibility, Configuration.NAVIGATIONHIDDEN_YES,
|
mLidNavigationAccessibility, Configuration.NAVIGATIONHIDDEN_YES,
|
||||||
Configuration.NAVIGATIONHIDDEN_NO);
|
Configuration.NAVIGATIONHIDDEN_NO);
|
||||||
config.keyboardHidden = (config.hardKeyboardHidden
|
config.keyboardHidden = (config.hardKeyboardHidden
|
||||||
@ -1973,8 +1987,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
|
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
|
||||||
// lid changed state
|
// lid changed state
|
||||||
mLidOpen = lidOpen;
|
mLidOpen = lidOpen ? LID_OPEN : LID_CLOSED;
|
||||||
boolean awakeNow = mKeyguardMediator.doLidChangeTq(mLidOpen);
|
boolean awakeNow = mKeyguardMediator.doLidChangeTq(lidOpen);
|
||||||
updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
|
updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
|
||||||
if (awakeNow) {
|
if (awakeNow) {
|
||||||
// If the lid is opening and we don't have to keep the
|
// If the lid is opening and we don't have to keep the
|
||||||
@ -1982,7 +1996,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// immediately.
|
// immediately.
|
||||||
mKeyguardMediator.pokeWakelock();
|
mKeyguardMediator.pokeWakelock();
|
||||||
} else if (keyguardIsShowingTq()) {
|
} else if (keyguardIsShowingTq()) {
|
||||||
if (mLidOpen) {
|
if (lidOpen) {
|
||||||
// If we are opening the lid and not hiding the
|
// If we are opening the lid and not hiding the
|
||||||
// keyguard, then we need to have it turn on the
|
// keyguard, then we need to have it turn on the
|
||||||
// screen once it is shown.
|
// screen once it is shown.
|
||||||
@ -1991,7 +2005,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Light up the keyboard if we are sliding up.
|
// Light up the keyboard if we are sliding up.
|
||||||
if (mLidOpen) {
|
if (lidOpen) {
|
||||||
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
|
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
|
||||||
LocalPowerManager.BUTTON_EVENT);
|
LocalPowerManager.BUTTON_EVENT);
|
||||||
} else {
|
} else {
|
||||||
@ -2473,7 +2487,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
//or case.unspecified
|
//or case.unspecified
|
||||||
if (mHdmiPlugged) {
|
if (mHdmiPlugged) {
|
||||||
return Surface.ROTATION_0;
|
return Surface.ROTATION_0;
|
||||||
} else if (mLidOpen) {
|
} else if (mLidOpen == LID_OPEN) {
|
||||||
return mLidOpenRotation;
|
return mLidOpenRotation;
|
||||||
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
|
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
|
||||||
return mCarDockRotation;
|
return mCarDockRotation;
|
||||||
@ -2641,11 +2655,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateRotation(int animFlags) {
|
void updateRotation(int animFlags) {
|
||||||
mPowerManager.setKeyboardVisibility(mLidOpen);
|
mPowerManager.setKeyboardVisibility(mLidOpen == LID_OPEN);
|
||||||
int rotation = Surface.ROTATION_0;
|
int rotation = Surface.ROTATION_0;
|
||||||
if (mHdmiPlugged) {
|
if (mHdmiPlugged) {
|
||||||
rotation = Surface.ROTATION_0;
|
rotation = Surface.ROTATION_0;
|
||||||
} else if (mLidOpen) {
|
} else if (mLidOpen == LID_OPEN) {
|
||||||
rotation = mLidOpenRotation;
|
rotation = mLidOpenRotation;
|
||||||
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
|
} else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) {
|
||||||
rotation = mCarDockRotation;
|
rotation = mCarDockRotation;
|
||||||
|
Reference in New Issue
Block a user