diff options
| author | Tarandeep Singh <tarandeep@google.com> | 2017-11-21 14:26:11 -0800 |
|---|---|---|
| committer | Tarandeep Singh <tarandeep@google.com> | 2017-12-08 00:55:11 +0000 |
| commit | 89a6c48a8b2e54f9b93211c20a126edab0eefe35 (patch) | |
| tree | 24672532a571730b75767871d0f7d98f2f7ec259 /core/java/android | |
| parent | 7c95a682ba064c611a13cc94fa1ccea397d776a9 (diff) | |
Add support for VR InputMethod.
This change adds support for VR-only IMEs in InputMethod framework.
In order to set this VR IME, setVrInputMethod(ComponentName) should be
called by VrManager.
When VrManager calls setVrInputMethod(), IMMS changes updates
the selected input method in a transient way i.e. it doesn't
update the Settings or input history. Once VR mode finishes,
it restores last input from settings.
Bug: 63037786
Test: Manually using the sample app in bug.
Change-Id: I1db7981b5198e7e203d4578cae7e5b6d20037d0d
Diffstat (limited to 'core/java/android')
4 files changed, 48 insertions, 0 deletions
diff --git a/core/java/android/app/VrManager.java b/core/java/android/app/VrManager.java index 392387a99897..61b90e1766e5 100644 --- a/core/java/android/app/VrManager.java +++ b/core/java/android/app/VrManager.java @@ -4,6 +4,7 @@ import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; +import android.annotation.TestApi; import android.content.ComponentName; import android.content.Context; import android.os.Handler; @@ -214,4 +215,22 @@ public class VrManager { e.rethrowFromSystemServer(); } } + + /** + * Start VR Input method for the packageName in {@link ComponentName}. + * This method notifies InputMethodManagerService to use VR IME instead of + * regular phone IME. + * @param componentName ComponentName of a VR InputMethod that should be set as selected + * input by InputMethodManagerService. + * @hide + */ + @TestApi + @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS) + public void setVrInputMethod(ComponentName componentName) { + try { + mService.setVrInputMethod(componentName); + } catch (RemoteException e) { + e.rethrowFromSystemServer(); + } + } } diff --git a/core/java/android/service/vr/IVrManager.aidl b/core/java/android/service/vr/IVrManager.aidl index 7285fb40ae02..f7acfc5918a8 100644 --- a/core/java/android/service/vr/IVrManager.aidl +++ b/core/java/android/service/vr/IVrManager.aidl @@ -17,6 +17,7 @@ package android.service.vr; import android.app.Vr2dDisplayProperties; +import android.content.ComponentName; import android.service.vr.IVrStateCallbacks; import android.service.vr.IPersistentVrStateCallbacks; @@ -109,5 +110,13 @@ interface IVrManager { * @param standy True if the device is entering standby, false if it's exiting standby. */ void setStandbyEnabled(boolean standby); + + /** + * Start VR Input method for the given packageName in {@param componentName}. + * This method notifies InputMethodManagerService to use VR IME instead of + * regular phone IME. + */ + void setVrInputMethod(in ComponentName componentName); + } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 92d1de8e5a24..4d96733255d7 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -697,6 +697,19 @@ public final class InputMethodManager { } } + /** + * Returns a list of VR InputMethod currently installed. + * @hide + */ + @RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS) + public List<InputMethodInfo> getVrInputMethodList() { + try { + return mService.getVrInputMethodList(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + public List<InputMethodInfo> getEnabledInputMethodList() { try { return mService.getEnabledInputMethodList(); diff --git a/core/java/android/view/inputmethod/InputMethodManagerInternal.java b/core/java/android/view/inputmethod/InputMethodManagerInternal.java index 77df4e3883a7..e13813e5199b 100644 --- a/core/java/android/view/inputmethod/InputMethodManagerInternal.java +++ b/core/java/android/view/inputmethod/InputMethodManagerInternal.java @@ -16,6 +16,8 @@ package android.view.inputmethod; +import android.content.ComponentName; + /** * Input method manager local system service interface. * @@ -37,4 +39,9 @@ public interface InputMethodManagerInternal { * Hides the current input method, if visible. */ void hideCurrentInputMethod(); + + /** + * Switches to VR InputMethod defined in the packageName of {@param componentName}. + */ + void startVrInputMethodNoCheck(ComponentName componentName); } |
