diff options
author | Michael Wright <michaelwr@google.com> | 2014-08-07 15:44:40 -0700 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2014-08-17 17:51:19 -0700 |
commit | 665366a3055c7baa36242b8c92c5ff85b1c3394b (patch) | |
tree | f08090e1318df91c4ddb2623d4403324023f3e86 /services/core | |
parent | 804322564b1b4e4ccff0b1c8cd312bac75ec5bb0 (diff) | |
download | frameworks_base-665366a3055c7baa36242b8c92c5ff85b1c3394b.zip frameworks_base-665366a3055c7baa36242b8c92c5ff85b1c3394b.tar.gz frameworks_base-665366a3055c7baa36242b8c92c5ff85b1c3394b.tar.bz2 |
Change 'disable hardware keyboard' to 'show input method'
Previously it implied that the hardware keyboard would be disabled,
but really the toggle would just enable showing the IME even if a
hardware keyboard was present. Changed the string and swapped the
semantics to be more clear about the behavior.
Bug: 14066881
Change-Id: I9c8a7eb98b5277f1d09cc19fa7402e9b4cf51d92
Diffstat (limited to 'services/core')
3 files changed, 20 insertions, 47 deletions
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index 4687e3f..e0f9b9c 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -603,10 +603,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub MSG_HARD_KEYBOARD_SWITCH_CHANGED, available ? 1 : 0, enabled ? 1 : 0)); } - public void handleHardKeyboardStatusChange(boolean available, boolean enabled) { + public void handleHardKeyboardStatusChange(boolean available, + boolean showImeWithHardKeyboard) { if (DEBUG) { - Slog.w(TAG, "HardKeyboardStatusChanged: available = " + available + ", enabled = " - + enabled); + Slog.w(TAG, "HardKeyboardStatusChanged: available = " + available + + ", showImeWithHardKeyboard= " + showImeWithHardKeyboard); } synchronized(mMethodMap) { if (mSwitchingDialog != null && mSwitchingDialogTitleView != null @@ -2810,11 +2811,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub ? View.VISIBLE : View.GONE); final Switch hardKeySwitch = (Switch)mSwitchingDialogTitleView.findViewById( com.android.internal.R.id.hard_keyboard_switch); - hardKeySwitch.setChecked(mWindowManagerService.isHardKeyboardEnabled()); + hardKeySwitch.setChecked(mWindowManagerService.isShowImeWithHardKeyboardEnabled()); hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mWindowManagerService.setHardKeyboardEnabled(isChecked); + mWindowManagerService.setShowImeWithHardKeyboard(isChecked); // Ensure that the input method dialog is dismissed when changing // the hardware keyboard state. hideInputMethodMenu(); diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 21905f0..297dacf 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -48,9 +48,7 @@ import java.util.Map; * A note on locking: We rely on the fact that calls onto mBar are oneway or * if they are local, that they just enqueue messages to not deadlock. */ -public class StatusBarManagerService extends IStatusBarService.Stub - implements WindowManagerService.OnHardKeyboardStatusChangeListener -{ +public class StatusBarManagerService extends IStatusBarService.Stub { private static final String TAG = "StatusBarManagerService"; private static final boolean SPEW = false; @@ -95,7 +93,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub public StatusBarManagerService(Context context, WindowManagerService windowManager) { mContext = context; mWindowManager = windowManager; - mWindowManager.setOnHardKeyboardStatusChangeListener(this); final Resources res = context.getResources(); mIcons.defineSlots(res.getStringArray(com.android.internal.R.array.config_statusBarIcons)); @@ -394,29 +391,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub } @Override - public void setHardKeyboardEnabled(final boolean enabled) { - mHandler.post(new Runnable() { - public void run() { - mWindowManager.setHardKeyboardEnabled(enabled); - } - }); - } - - @Override - public void onHardKeyboardStatusChange(final boolean available, final boolean enabled) { - mHandler.post(new Runnable() { - public void run() { - if (mBar != null) { - try { - mBar.setHardKeyboardStatus(available, enabled); - } catch (RemoteException ex) { - } - } - } - }); - } - - @Override public void toggleRecentApps() { if (mBar != null) { try { @@ -510,11 +484,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub switches[2] = mMenuVisible ? 1 : 0; switches[3] = mImeWindowVis; switches[4] = mImeBackDisposition; - switches[7] = mShowImeSwitcher ? 1 : 0; + switches[5] = mShowImeSwitcher ? 1 : 0; binders.add(mImeToken); } - switches[5] = mWindowManager.isHardKeyboardAvailable() ? 1 : 0; - switches[6] = mWindowManager.isHardKeyboardEnabled() ? 1 : 0; } /** diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 2295656..112972f 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -537,7 +537,7 @@ public class WindowManagerService extends IWindowManager.Stub final ArrayList<WindowState> mInputMethodDialogs = new ArrayList<WindowState>(); boolean mHardKeyboardAvailable; - boolean mHardKeyboardEnabled; + boolean mShowImeWithHardKeyboard; OnHardKeyboardStatusChangeListener mHardKeyboardStatusChangeListener; final ArrayList<WindowToken> mWallpaperTokens = new ArrayList<WindowToken>(); @@ -7015,11 +7015,11 @@ public class WindowManagerService extends IWindowManager.Stub boolean hardKeyboardAvailable = config.keyboard != Configuration.KEYBOARD_NOKEYS; if (hardKeyboardAvailable != mHardKeyboardAvailable) { mHardKeyboardAvailable = hardKeyboardAvailable; - mHardKeyboardEnabled = hardKeyboardAvailable; + mShowImeWithHardKeyboard = !hardKeyboardAvailable; mH.removeMessages(H.REPORT_HARD_KEYBOARD_STATUS_CHANGE); mH.sendEmptyMessage(H.REPORT_HARD_KEYBOARD_STATUS_CHANGE); } - if (!mHardKeyboardEnabled) { + if (mShowImeWithHardKeyboard) { config.keyboard = Configuration.KEYBOARD_NOKEYS; } @@ -7039,16 +7039,16 @@ public class WindowManagerService extends IWindowManager.Stub } } - public boolean isHardKeyboardEnabled() { + public boolean isShowImeWithHardKeyboardEnabled() { synchronized (mWindowMap) { - return mHardKeyboardEnabled; + return mShowImeWithHardKeyboard; } } - public void setHardKeyboardEnabled(boolean enabled) { + public void setShowImeWithHardKeyboard(boolean enabled) { synchronized (mWindowMap) { - if (mHardKeyboardEnabled != enabled) { - mHardKeyboardEnabled = enabled; + if (mShowImeWithHardKeyboard != enabled) { + mShowImeWithHardKeyboard = enabled; mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION); } } @@ -7062,15 +7062,15 @@ public class WindowManagerService extends IWindowManager.Stub } void notifyHardKeyboardStatusChange() { - final boolean available, enabled; + final boolean available, showImeWithHardKeyboard; final OnHardKeyboardStatusChangeListener listener; synchronized (mWindowMap) { listener = mHardKeyboardStatusChangeListener; available = mHardKeyboardAvailable; - enabled = mHardKeyboardEnabled; + showImeWithHardKeyboard = mShowImeWithHardKeyboard; } if (listener != null) { - listener.onHardKeyboardStatusChange(available, enabled); + listener.onHardKeyboardStatusChange(available, showImeWithHardKeyboard); } } @@ -11053,7 +11053,7 @@ public class WindowManagerService extends IWindowManager.Stub } public interface OnHardKeyboardStatusChangeListener { - public void onHardKeyboardStatusChange(boolean available, boolean enabled); + public void onHardKeyboardStatusChange(boolean available, boolean showIme); } void debugLayoutRepeats(final String msg, int pendingLayoutChanges) { |