summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Antonio Kantek <kanant@google.com> 2023-08-24 20:18:32 +0000
committer Antonio Kantek <kanant@google.com> 2023-08-24 20:55:27 +0000
commite0f6c22611fede01f445c8b07ee94daf6424e82d (patch)
tree6ed98fa1c56918aa83cba86f6fb355cd1a92bcf7
parent17e7b8846ee8dcbf12d7313d161fedb65ad814d0 (diff)
Clean up InputMethodService
List of clean ups: * Remove `mIsAutomotive` unused private field; * Remove `isAutomotive` unused private method; * Add javadoc to #onAppPrivateCommand empty public method * Simplify unnecessary fully qualified names - 'ViewGroup.LayoutParams.MATCH_PARENT' due to existing static import 'android.view.ViewGroup.LayoutParams.MATCH_PARENT' - 'ViewGroup.LayoutParams.WRAP_CONTENT' due to existing static import 'android.view.ViewGroup.LayoutParams.WRAP_CONTENT' * Replaced 'mHideNavBarForKeyboard' by a local variable. Bug: 287045146 Test: m Change-Id: Ie619defc632f2a4b76823a79e7f83471bdfb160e
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java34
1 files changed, 12 insertions, 22 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 795eb4a737ef..5066a5e7f0a4 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -644,8 +644,6 @@ public class InputMethodService extends AbstractInputMethodService {
private InlineSuggestionSessionController mInlineSuggestionSessionController;
- private boolean mHideNavBarForKeyboard;
- private boolean mIsAutomotive;
private @NonNull OptionalInt mHandwritingRequestId = OptionalInt.empty();
private InputEventReceiver mHandwritingEventReceiver;
private Handler mHandler;
@@ -1616,7 +1614,7 @@ public class InputMethodService extends AbstractInputMethodService {
// shown the first time (cold start).
mSettingsObserver.shouldShowImeWithHardKeyboard();
- mHideNavBarForKeyboard = getApplicationContext().getResources().getBoolean(
+ final boolean hideNavBarForKeyboard = getApplicationContext().getResources().getBoolean(
com.android.internal.R.bool.config_hideNavBarForKeyboard);
initConfigurationTracker();
@@ -1662,7 +1660,7 @@ public class InputMethodService extends AbstractInputMethodService {
// screen real estate. When this happens, the IME window should animate from the
// bottom of the screen to reduce the jank that happens from the lack of synchronization
// between the bottom system window and the IME window.
- if (mHideNavBarForKeyboard) {
+ if (hideNavBarForKeyboard) {
window.setDecorFitsSystemWindows(false);
}
}
@@ -2360,9 +2358,7 @@ public class InputMethodService extends AbstractInputMethodService {
public void setExtractView(View view) {
mExtractFrame.removeAllViews();
- mExtractFrame.addView(view, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
+ mExtractFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
mExtractView = view;
if (view != null) {
mExtractEditText = view.findViewById(
@@ -2381,7 +2377,7 @@ public class InputMethodService extends AbstractInputMethodService {
mExtractAction = null;
}
}
-
+
/**
* Replaces the current candidates view with a new one. You only need to
* call this when dynamically changing the view; normally, you should
@@ -2390,11 +2386,9 @@ public class InputMethodService extends AbstractInputMethodService {
*/
public void setCandidatesView(View view) {
mCandidatesFrame.removeAllViews();
- mCandidatesFrame.addView(view, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
+ mCandidatesFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
}
-
+
/**
* Replaces the current input view with a new one. You only need to
* call this when dynamically changing the view; normally, you should
@@ -2403,12 +2397,10 @@ public class InputMethodService extends AbstractInputMethodService {
*/
public void setInputView(View view) {
mInputFrame.removeAllViews();
- mInputFrame.addView(view, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
+ mInputFrame.addView(view, new FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
mInputView = view;
}
-
+
/**
* Called by the framework to create the layout for showing extracted text.
* Only called when in fullscreen mode. The returned view hierarchy must
@@ -3442,9 +3434,12 @@ public class InputMethodService extends AbstractInputMethodService {
return false;
}
+ /**
+ * Not implemented in this class.
+ */
public void onAppPrivateCommand(String action, Bundle data) {
}
-
+
/**
* Handle a request by the system to toggle the soft input area.
*/
@@ -4086,11 +4081,6 @@ public class InputMethodService extends AbstractInputMethodService {
| (isInputViewShown() ? IME_VISIBLE : 0);
}
- private boolean isAutomotive() {
- return getApplicationContext().getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_AUTOMOTIVE);
- }
-
/**
* Performs a dump of the InputMethodService's internal state. Override
* to add your own information to the dump.