Android 输入法

129 阅读2分钟

ime 命令

msmnile_gvmq:/ $ ime
ime <command>:
  list [-a] [-s]
    prints all enabled input methods.
      -a: see all input methods
      -s: only a single summary line of each
  enable [--user <USER_ID>] <ID>
    allows the given input method ID to be used.
      --user <USER_ID>: Specify which user to enable. Assumes the current user if not specified.
  disable [--user <USER_ID>] <ID>
    disallows the given input method ID to be used.
      --user <USER_ID>: Specify which user to disable. Assumes the current user if not specified.
  set [--user <USER_ID>] <ID>
    switches to the given input method ID.
      --user <USER_ID>: Specify which user to enable. Assumes the current user if not specified.
  reset [--user <USER_ID>]
    reset currently selected/enabled IMEs to the default ones as if the device is initially booted w
    ith the current locale.
      --user <USER_ID>: Specify which user to reset. Assumes the current user if not specified.

1.获取当前设备有效的输入法列表

adb shell ime list -s

输出情况:

msmnile_gvmq:/ $ ime list -s
com.android.inputmethod.latin/.CarLatinIME
com.sohu.inputmethod.sogou/.SogouIME

2.获取当前设备有效的输入详细信息

 ime list -a
msmnile_gvmq:/ $ ime list -a
com.sohu.inputmethod.sogou/.SogouIME:
  mId=com.sohu.inputmethod.sogou/.SogouIME mSettingsActivityName=com.sohu.inputmethod.sogou.SogouIMESettingsLauncher mIsVrOnly=false mSupportsSwitchingToNextInputMethod=false mInlineSuggestionsEnabled=false mSuppressesSpellChecker=false mShowInInputMethodPicker=true
  mIsDefaultResId=0x7f050003
  Service:
    priority=100 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=true
    ServiceInfo:
      name=com.sohu.inputmethod.sogou.SogouIME
      packageName=com.sohu.inputmethod.sogou
      labelRes=0x7f101936 nonLocalizedLabel=null icon=0x7f080a45 banner=0x0
      enabled=true exported=true directBootAware=false
      permission=android.permission.BIND_INPUT_METHOD
      flags=0x0
      ApplicationInfo:
        name=com.sohu.inputmethod.sogou.SogouTinkerApplication
        packageName=com.sohu.inputmethod.sogou
        labelRes=0x7f101935 nonLocalizedLabel=null icon=0x7f080a45 banner=0x0
        className=com.sohu.inputmethod.sogou.SogouTinkerApplication
        processName=com.sohu.inputmethod.sogou
        taskAffinity=com.sohu.inputmethod.sogou
        uid=10096 flags=0x38f83e44 privateFlags=0xac001100 theme=0x7f1100e9
        requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
        sourceDir=/data/app/~~0LobUbVxNj2AsxYlczhScQ==/com.sohu.inputmethod.sogou-OHAEBccYjmhGfwjLOKdfvg==/base.apk
        resourceDirs=[]
        overlayPaths=[/data/resource-cache/com.android.systemui-neutral-VHSN.frro, /data/resource-cache/com.android.systemui-accent-xRIt.frro]
        seinfo=default:targetSdkVersion=30
        seinfoUser=:complete
        dataDir=/data/user/0/com.sohu.inputmethod.sogou
        deviceProtectedDataDir=/data/user_de/0/com.sohu.inputmethod.sogou
        credentialProtectedDataDir=/data/user/0/com.sohu.inputmethod.sogou
        sharedLibraryFiles=[/system/framework/org.apache.http.legacy.jar]
        enabled=true minSdkVersion=21 targetSdkVersion=30 versionCode=2320 targetSandboxVersion=1
        supportsRtl=true
        fullBackupContent=true
        crossProfile=false
        HiddenApiEnforcementPolicy=2
        usesNonSdkApi=false
        allowsPlaybackCapture=true
        nativeHeapZeroInitialized=0
com.android.inputmethod.latin/.CarLatinIME:
  mId=com.android.inputmethod.latin/.CarLatinIME mSettingsActivityName=null mIsVrOnly=false mSupportsSwitchingToNextInputMethod=false mInlineSuggestionsEnabled=false mSuppressesSpellChecker=false mShowInInputMethodPicker=true
  mIsDefaultResId=0x0
  Service:
    priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
    ServiceInfo:
      name=com.android.inputmethod.latin.CarLatinIME
      packageName=com.android.inputmethod.latin
      labelRes=0x7f08000c nonLocalizedLabel=null icon=0x0 banner=0x0
      enabled=true exported=true directBootAware=true
      permission=android.permission.BIND_INPUT_METHOD
      flags=0x0
      ApplicationInfo:
        packageName=com.android.inputmethod.latin
        labelRes=0x7f08000c nonLocalizedLabel=null icon=0x7f04000c banner=0x0
        processName=com.android.inputmethod.latin
        taskAffinity=com.android.inputmethod.latin
        uid=10064 flags=0x38c8be45 privateFlags=0xa4400040 theme=0x103013e
        requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
        sourceDir=/system/app/CarLatinIME/CarLatinIME.apk
        resourceDirs=[]
        overlayPaths=[/data/resource-cache/com.android.systemui-neutral-VHSN.frro, /data/resource-cache/com.android.systemui-accent-xRIt.frro]
        seinfo=default:targetSdkVersion=23
        seinfoUser=:complete
        dataDir=/data/user/0/com.android.inputmethod.latin
        deviceProtectedDataDir=/data/user_de/0/com.android.inputmethod.latin
        credentialProtectedDataDir=/data/user/0/com.android.inputmethod.latin
        sharedLibraryFiles=[/system/framework/android.test.base.jar, /system/framework/android.hidl.manager-V1.0-java.jar, /system/framework/android.hidl.base-V1.0-java.jar, /system/framework/org.apache.http.legacy.jar]
        enabled=true minSdkVersion=32 targetSdkVersion=23 versionCode=32 targetSandboxVersion=1
        supportsRtl=true
        fullBackupContent=true
        crossProfile=false
        HiddenApiEnforcementPolicy=0
        usesNonSdkApi=true
        allowsPlaybackCapture=false
        nativeHeapZeroInitialized=0

常看当前正在使用的输入法

adb shell settings get secure default_input_method

切换输入法

adb shell ime set com.sohu.inputmethod.sogou/.SogouIME