summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java19
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodMenuController.java36
2 files changed, 16 insertions, 39 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 4d125c3ff997..254fc0aad48e 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -246,10 +246,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private static final int MSG_SET_INTERACTIVE = 3030;
private static final int MSG_REPORT_FULLSCREEN_MODE = 3045;
- /**
- * package-private because this is also used by {@link InputMethodMenuController}.
- */
- static final int MSG_HARD_KEYBOARD_SWITCH_CHANGED = 4000;
+ private static final int MSG_HARD_KEYBOARD_SWITCH_CHANGED = 4000;
private static final int MSG_SYSTEM_UNLOCK_USER = 5000;
private static final int MSG_DISPATCH_ON_INPUT_METHOD_LIST_UPDATED = 5010;
@@ -284,7 +281,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final Context mContext;
final Resources mRes;
- final Handler mHandler;
+ private final Handler mHandler;
final InputMethodSettings mSettings;
final SettingsObserver mSettingsObserver;
final IWindowManager mIWindowManager;
@@ -1812,10 +1809,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mShowOngoingImeSwitcherForPhones = mRes.getBoolean(
com.android.internal.R.bool.show_ongoing_ime_switcher);
if (mShowOngoingImeSwitcherForPhones) {
- final InputMethodMenuController.HardKeyboardListener hardKeyboardListener =
- mMenuController.getHardKeyboardListener();
- mWindowManagerInternal.setOnHardKeyboardStatusChangeListener(
- hardKeyboardListener);
+ mWindowManagerInternal.setOnHardKeyboardStatusChangeListener(available -> {
+ mHandler.obtainMessage(MSG_HARD_KEYBOARD_SWITCH_CHANGED, available ? 1 : 0)
+ .sendToTarget();
+ });
}
mMyPackageMonitor.register(mContext, null, UserHandle.ALL, true);
@@ -4422,9 +4419,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// --------------------------------------------------------------
case MSG_HARD_KEYBOARD_SWITCH_CHANGED:
- final InputMethodMenuController.HardKeyboardListener hardKeyboardListener =
- mMenuController.getHardKeyboardListener();
- hardKeyboardListener.handleHardKeyboardStatusChange(msg.arg1 == 1);
+ mMenuController.handleHardKeyboardStatusChange(msg.arg1 == 1);
return true;
case MSG_SYSTEM_UNLOCK_USER: {
final int userId = msg.arg1;
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
index 132be7d11ab1..fcb1be0fc88c 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
@@ -18,7 +18,6 @@ package com.android.server.inputmethod;
import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.server.inputmethod.InputMethodManagerService.DEBUG;
-import static com.android.server.inputmethod.InputMethodManagerService.MSG_HARD_KEYBOARD_SWITCH_CHANGED;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;
import android.app.ActivityThread;
@@ -28,7 +27,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
-import android.os.Handler;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -62,10 +60,8 @@ public class InputMethodMenuController {
private final InputMethodManagerService mService;
private final InputMethodUtils.InputMethodSettings mSettings;
private final InputMethodSubtypeSwitchingController mSwitchingController;
- private final Handler mHandler;
private final ArrayMap<String, InputMethodInfo> mMethodMap;
private final KeyguardManager mKeyguardManager;
- private final HardKeyboardListener mHardKeyboardListener;
private final WindowManagerInternal mWindowManagerInternal;
private Context mSettingsContext;
@@ -83,10 +79,8 @@ public class InputMethodMenuController {
mService = service;
mSettings = mService.mSettings;
mSwitchingController = mService.mSwitchingController;
- mHandler = mService.mHandler;
mMethodMap = mService.mMethodMap;
mKeyguardManager = mService.mKeyguardManager;
- mHardKeyboardListener = new HardKeyboardListener();
mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
}
@@ -271,10 +265,6 @@ public class InputMethodMenuController {
}
}
- HardKeyboardListener getHardKeyboardListener() {
- return mHardKeyboardListener;
- }
-
AlertDialog getSwitchingDialogLocked() {
return mSwitchingDialog;
}
@@ -290,24 +280,16 @@ public class InputMethodMenuController {
return mSwitchingDialog.isShowing();
}
- class HardKeyboardListener implements WindowManagerInternal.OnHardKeyboardStatusChangeListener {
- @Override
- public void onHardKeyboardStatusChange(boolean available) {
- mHandler.sendMessage(mHandler.obtainMessage(MSG_HARD_KEYBOARD_SWITCH_CHANGED,
- available ? 1 : 0));
+ void handleHardKeyboardStatusChange(boolean available) {
+ if (DEBUG) {
+ Slog.w(TAG, "HardKeyboardStatusChanged: available=" + available);
}
-
- public void handleHardKeyboardStatusChange(boolean available) {
- if (DEBUG) {
- Slog.w(TAG, "HardKeyboardStatusChanged: available=" + available);
- }
- synchronized (ImfLock.class) {
- if (mSwitchingDialog != null && mSwitchingDialogTitleView != null
- && mSwitchingDialog.isShowing()) {
- mSwitchingDialogTitleView.findViewById(
- com.android.internal.R.id.hard_keyboard_section).setVisibility(
- available ? View.VISIBLE : View.GONE);
- }
+ synchronized (ImfLock.class) {
+ if (mSwitchingDialog != null && mSwitchingDialogTitleView != null
+ && mSwitchingDialog.isShowing()) {
+ mSwitchingDialogTitleView.findViewById(
+ com.android.internal.R.id.hard_keyboard_section).setVisibility(
+ available ? View.VISIBLE : View.GONE);
}
}
}