Password managers on Android have long been neglected by Google, but that’s going to change with Android O. Android O’s Autofill Framework will drastically improve user/password data entry and will also eliminate the need for performance-costly Accessibility Services, but unfortunately it’ll be quite some time before most devices will ever receive Android O. For those of us who will be waiting months for Android O to be available for our devices, the standard password manager features will have to suffice. A personal favorite among the XDA-Developers team is Keepass2Android which is an Android port of the popular open-source Keepass password manager. Keepass2Android allows you to access your password database from the cloud storage of your choosing, and it also features fingerprint database unlocking and/or quick database access through a shorthand of the full password. But one nifty feature has been locked for many years to be used only by rooted users: automatically switching keyboards/input methods. A new Keepass2Android plugin called KeyboardSwap aims to fix that.
Many password managers in Android offer their own keyboards (also known as input methods in Android) because the Android system clipboard is notoriously insecure. Any application that requests the permission to read the clipboard is automatically granted it without user input, and unless you know your way around the App Ops command line, you can’t easily revoke the permission either. Keepass2Android is no different, and its keyboard, while aesthetically unpleasant, gets the job done. However, on many Android devices there’s no quick and easy way to change input methods without going into settings. Some software from OEMs and custom ROMs offer an input method switcher in the notification panel or navigation bar, but many do not. That’s why Keepass2Android’s automatic keyboard switching feature is so useful.
In the comments of our XDA Spotlight article featuring Keepass2Android, one of our users pointed out that Keepass2Android was still relying on the outdated Secure Settings application in order to automatically switch input methods. Since we now know that most of the functionality of Secure Settings can be replicated without root access, I figured it would be possible for Keepass2Android to replace Secure Settings with another app. I e-mailed the developer of Keepass2Android, Philipp Crocoll, with a non-root solution I came up with and the solution was the KeyboardSwap Plugin.
The way it works is simple. The application uses the WRITE_SECURE_SETTINGS permission which is normally restricted from user apps but can be granted manually via the package manager command line interface in the Android Debug Tools (ADB). All you have to do is install the plugin from the Google Play Store, ensure that you’re on the beta version of Keepass2Android, then enter the following command in a command prompt/terminal once you have ADB set up:
adb shell pm grant keepass2android.plugin.keyboardswap2 android.permission.WRITE_SECURE_SETTINGS
The plugin can then write the name of the Keepass2Android input method service into the
Settings.Secure.DEFAULT_INPUT_METHOD setting and Android will automatically open up this keyboard the next time keyboard entry is needed. Of course, this service actually has to be enabled within Keepass2Android by going into the settings –> application settings –> password entry access –> keyboard switching then toggling the “auto-switch keyboard” function.
For instance, if your current default keyboard is Gboard, then the KeyboardSwap Plugin will save
com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME as the current keyboard, then change DEFAULT_INPUT_METHOD to
keepass2android.keepass2android/keepass2android.softkeyboard.KP2AKeyboard once you’ve selected a password entry in the app. When you close the Keepass2Android input method, then the KeyboardSwap Plugin restores the Gboard input method service to the DEFAULT_INPUT_METHOD setting.
To the end user, once the permission has been granted the plugin “just works.” You won’t have to worry about anything related to the plugin once it’s set up. You can hide the application icon from your app drawer and never touch it again. If you factory reset or uninstall then re-install the app, only then will you have to grant the permission once again. Otherwise, this is a simple plugin that you can set up and forget, and it’ll make your password entry just a tad bit faster.