OSDN Git Service

Add a shell command for IMMS to test instant apps
authorYohei Yukawa <yukawa@google.com>
Mon, 21 May 2018 16:47:53 +0000 (09:47 -0700)
committerYohei Yukawa <yukawa@google.com>
Mon, 21 May 2018 16:47:53 +0000 (09:47 -0700)
commitf80087cae1227c48159a2a177729b14f4eb32e48
treec73d85747e20698b29062798b77872b8b829e370
parent167b451daa1893ee9b15cb25bfba627a7254acd3
Add a shell command for IMMS to test instant apps

This change adds a shell command to allow InputMethodManagerService
(IMMS) to bind to InputMethodService provided by instant apps, like we
did so for AccessibilityManagerService [1].  Note that binding to an
InputMethodService provided by instant apps is not a supported
scenario.  In theory we can avoid doing this by having a separate APK
for MockIme instead of putting everything into
CtsInputMethodTestCases.apk but that configuration is not yet
supported by our test harness hence it doesn't work right now hence
having this special mode for testing is the only way we have right
now.

 [1]: Ifced735a9a6e495747372dd8b00fdd64933a09c7
      d223db316d11a625a73f86392e7055d5c6f26e7d

Bug: 79484568
Test: Manually verified as follows:
  1. Build a test IME that has android:targetSandboxVersion="2" in its
     AndroidManifest.xml.
  2. Install the test IME APK with 'adb install --instant <APK>'
  3. adb shell ime list -a -s
  4. Make sure that the test IME is not in the list.
  5. adb shell cmd input_method set-bind-instant-service-allowed true
  6. adb shell ime list -a -s
  7. Make sure that the test IME is now in the list.
  8. Select that test IME.
  9. Make sure that the test IME is working.
 10. adb shell cmd input_method set-bind-instant-service-allowed false
 11. Make sure that the test IME is no longer the current IME.
 12. adb shell ime list -a -s
 13. Make sure that the test IME is no longer in the list.
Test: cts-tradefed run cts-instant -m CtsInputMethodTestCases
Change-Id: I4383129fd9e229a849282e874aff5d4eef1f49f8
services/core/java/com/android/server/InputMethodManagerService.java