summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2022-01-20 21:28:34 -0800
committerYohei Yukawa <yukawa@google.com>2022-01-20 21:28:34 -0800
commitff7b453ca8e23b4ef75ba2c3f5becaf511cb07d3 (patch)
tree3c7eb2d56e6c9489eea17aa7ffd75e89588de2eb /core/java/android/inputmethodservice/InputMethodService.java
parent20ba147a1138be3ea40d7e20651ac5dd83afab1e (diff)
Minimum impl of nav buttons rendered by IME
This is the minimum implementation of rendering the back button and the IME switcher button in the InputMethodService process. Note that the feature is still disabled by default behind the flag. Newly added UI logic should be running only when the feature flag is enabled. Bug 215545985: Enable canImeRenderGesturalNavButtons() by default Here is the list of known blockers before enabling the flag. * Bug 215552600: Subscribe gesture mode change. * Bug 215551357: Show IME swicher button only when necessary. * Bug 215549533: Support light navigation bar. * Bug 215550296: Support floating IME. * Bug 215554582: Set "input_method_rounded_corner_content_padding" for each devices. Also, after enabling the flag by default, we start cleaning up newly added code under android.inputmethodservice.navigationbar. at Bug 215443343. Bug: 205803355 Test: Manually done as follows 1. Build aosp_coral-userdebug and flash it 2. Switch to gestural navigation mode. 3. adb root 4. adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons true 5. adb reboot 6. Tap any edit field to show AOSP Keyboard. 7. Confirm that the back button on the navbar works. 8. Confirm that the IME switcher button on the navbar works. Change-Id: I3e7e1f83554444131e2765dc159617bb9e2337c7
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 09d50850788b..5d2d8eafb3a8 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -469,6 +469,10 @@ public class InputMethodService extends AbstractInputMethodService {
InputMethodManager mImm;
private InputMethodPrivilegedOperations mPrivOps = new InputMethodPrivilegedOperations();
+ @NonNull
+ private final NavigationBarController mNavigationBarController =
+ new NavigationBarController(this);
+
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
int mTheme = 0;
@@ -611,6 +615,7 @@ public class InputMethodService extends AbstractInputMethodService {
info.touchableRegion.set(mTmpInsets.touchableRegion);
info.setTouchableInsets(mTmpInsets.touchableInsets);
}
+ mNavigationBarController.updateTouchableInsets(mTmpInsets, info);
if (mInputFrame != null) {
setImeExclusionRect(mTmpInsets.visibleTopInsets);
@@ -1534,6 +1539,7 @@ public class InputMethodService extends AbstractInputMethodService {
mCandidatesVisibility = getCandidatesHiddenVisibility();
mCandidatesFrame.setVisibility(mCandidatesVisibility);
mInputFrame.setVisibility(View.GONE);
+ mNavigationBarController.onViewInitialized();
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
@@ -1543,6 +1549,7 @@ public class InputMethodService extends AbstractInputMethodService {
mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(
mInsetsComputer);
doFinishInput();
+ mNavigationBarController.onDestroy();
mWindow.dismissForDestroyIfNecessary();
if (mSettingsObserver != null) {
mSettingsObserver.unregister();
@@ -2451,6 +2458,7 @@ public class InputMethodService extends AbstractInputMethodService {
setImeWindowStatus(nextImeWindowStatus, mBackDisposition);
}
+ mNavigationBarController.onWindowShown();
// compute visibility
onWindowShown();
mWindowVisible = true;
@@ -3656,6 +3664,7 @@ public class InputMethodService extends AbstractInputMethodService {
+ " touchableInsets=" + mTmpInsets.touchableInsets
+ " touchableRegion=" + mTmpInsets.touchableRegion);
p.println(" mSettingsObserver=" + mSettingsObserver);
+ p.println(" mNavigationBarController=" + mNavigationBarController.toDebugString());
}
private final ImeTracing.ServiceDumper mDumper = new ImeTracing.ServiceDumper() {