Android adb ime 调试输入法

目录

前言

安装多个输入法后,可以在设置里进行切换。

既然是开发,能用命令就就命令~

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.

列出所有输入法

仅列出输入法 id

ime list -s

复制代码
console:/ # ime list -s
com.google.android.tts/com.google.android.apps.speech.tts.googletts.settings.asr.voiceime.VoiceInputMethodService
com.tencent.wetype/.plugin.hld.WxHldService
com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
com.sohu.inputmethod.sogou/.SogouIME
com.iflytek.inputmethod/.FlyIME

本例中,

这几个是系统自带的输入法,也是默认输入法,

com.google.android.tts/com.google.android.apps.speech.tts.googletts.settings.asr.voiceime.VoiceInputMethodService

com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME

这几个是用户自己下载的输入法

com.tencent.wetype/.plugin.hld.WxHldService

com.sohu.inputmethod.sogou/.SogouIME

com.iflytek.inputmethod/.FlyIME

列出所有输入法的所有信息

ime list -a

结果很长,只列出 微信输入法 的信息,

复制代码
com.tencent.wetype/.plugin.hld.WxHldService:
  mId=com.tencent.wetype/.plugin.hld.WxHldService mSettingsActivityName=com.tencent.wetype.plugin.hld.reactnative.activity.ImeMainSettingActivity mIsVrOnly=false mSupportsSwitchingToNextInputMethod=false mInlineSuggestionsEnabled=false mSupportsInlineSuggestionsWithTouchExploration=false mSuppressesSpellChecker=false mShowInInputMethodPicker=true mSupportsStylusHandwriting=false
  mIsDefaultResId=0x0
  Service:
    priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
    ServiceInfo:
      name=com.tencent.wetype.plugin.hld.WxHldService
      packageName=com.tencent.wetype
      labelRes=0x7f1102ab nonLocalizedLabel=null icon=0x0 banner=0x0
      processName=com.tencent.wetype:hld
      enabled=true exported=true directBootAware=false
      permission=android.permission.BIND_INPUT_METHOD
      flags=0x0
      ApplicationInfo:
        name=com.tencent.wetype.HldApplication
        packageName=com.tencent.wetype
        labelRes=0x7f1102ab nonLocalizedLabel=null icon=0x7f0e0003 banner=0x0
        className=com.tencent.wetype.HldApplication
        processName=com.tencent.wetype
        taskAffinity=com.tencent.wetype
        uid=10145 flags=0x38b83e44 privateFlags=0xac001100 theme=0x7f12013c
        requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
        sourceDir=/data/app/~~8c1LJhgD_6HP-G8ZHI-ypA==/com.tencent.wetype-U6heMnke7C3PVtyQud3oAQ==/base.apk
        resourceDirs=[]
        overlayPaths=[/data/resource-cache/com.android.systemui-neutral-VdjM.frro, /data/resource-cache/com.android.systemui-accent-gHXI.frro]
        seinfo=default:targetSdkVersion=33
        seinfoUser=:complete
        dataDir=/data/user/0/com.tencent.wetype
        deviceProtectedDataDir=/data/user_de/0/com.tencent.wetype
        credentialProtectedDataDir=/data/user/0/com.tencent.wetype
        sharedLibraryFiles=[/system/framework/org.apache.http.legacy.jar]
        enabled=true minSdkVersion=24 targetSdkVersion=33 versionCode=28201 targetSandboxVersion=1
        supportsRtl=false
        fullBackupContent=true
        crossProfile=false
        HiddenApiEnforcementPolicy=2
        usesNonSdkApi=false
        allowsPlaybackCapture=true
        nativeHeapZeroInitialized=0
        enableOnBackInvokedCallback=false
        createTimestamp=1320471

启用/禁用 输入法

ime enable <ID>

ime disable <ID>

启用/禁用 不会卸载输入法,只是在切换输入法时是否显示该输入法。

启用输入法

复制代码
ime enable com.tencent.wetype/.plugin.hld.WxHldService

禁用输入法

复制代码
ime disable com.tencent.wetype/.plugin.hld.WxHldService

切换输入法

ime set <ID>

输入法已经 enable 才可以切换。

使输入法 enable 的方法:

  • 用户点开输入法,启动输入法(一般会跳转到设置里启用输入法)。
  • 先 ime enable 输入法ID

切换输入法,

复制代码
ime set com.tencent.wetype/.plugin.hld.WxHldService

还原输入法

ime reset

还原输入法的意思是:

  • disable 用户自己下载的输入法,用户不点开输入法,启动输入法(一般会跳转到设置里启用输入法);
  • 使用系统默认的输入法

操作示例,

复制代码
console:/ # ime reset
Reset current and enabled IMEs for user #0
  Selected: com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
   Enabled: com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
   Enabled: com.google.android.tts/com.google.android.apps.speech.tts.googletts.settings.asr.voiceime.VoiceInputMethodService
console:/ # ime list -s
com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
com.google.android.tts/com.google.android.apps.speech.tts.googletts.settings.asr.voiceime.VoiceInputMethodService

可以看到,reset 后用户下载的输入法均不可用。

相关推荐
ajassi200013 分钟前
开源 java android app 开发(十八)最新编译器Android Studio 2025.1.3.7
android·java·开源
用户20187928316721 分钟前
Java 泛型:快递站老板的 "类型魔法" 故事
android
Knight_AL35 分钟前
浅拷贝与深拷贝详解:概念、代码示例与后端应用场景
android·java·开发语言
夜晚中的人海2 小时前
【C++】智能指针介绍
android·java·c++
用户2018792831672 小时前
后台Activity输入分发超时ANR分析(无焦点窗口)
android
用户2018792831672 小时前
Activity配置变化后ViewModel 的 “不死之谜”
android
游戏开发爱好者83 小时前
BShare HTTPS 集成与排查实战,从 SDK 接入到 iOS 真机调试(bshare https、签名、回调、抓包)
android·ios·小程序·https·uni-app·iphone·webview
2501_916008893 小时前
iOS 26 系统流畅度实战指南|流畅体验检测|滑动顺畅对比
android·macos·ios·小程序·uni-app·cocoa·iphone
2501_915106325 小时前
苹果软件加固与 iOS App 混淆完整指南,IPA 文件加密、无源码混淆与代码保护实战
android·ios·小程序·https·uni-app·iphone·webview
2501_915921435 小时前
iOS 26 崩溃日志解析,新版系统下崩溃获取与诊断策略
android·ios·小程序·uni-app·cocoa·iphone·策略模式