|« Slides for my talk||Blocking »|
Mon, Aug 10, 2015
So I got sick of some things on my Android tablet. The crappy privacy settings, the unrelenting stream of adverts in youtube, and so on.
So I figured it was time to try out the alternative: Cyanogenmod, an open-source fork of Android.
A lot went well. Things that were broken by latest Android switching away from the Dalvik runtime sprang back into life with a switch to CM and leaving it set to Dalvik. Such as YouTube AdAway (See previous post for more on that)
Also, CM has privacy settings that let me say "Yes, install the Facebook app, but NO, don't let it know where I am, thankyouverymuch" and profiles so I can have it automatically mute when I'm at work and regain sound when I get home. And I lost far fewer files in the transition than I expected, which was good.
There was just one little niggle. And it's to do with keyboards.
For most tasks, I like to use the standard Android keyboard. It's a pretty good kb. But when I use the ConnectBot ssh client, I *need* a full keyboard, with keys like Ctrl, Alt, and Esc. No problem, Hacker's Keyboard to the rescue!
But when I'm in Firefox, I want the LastPass keyboard so it can enter my username & passwords for me.
So depending on what app I'm using, I might be desiring one of three keyboards. And it's a pain to have to switch them manually.
No problem, because Tasker to the rescue! An app that can watch for context changes, like switching to an app, and automatically apply specified actions. Except that the UI isn't the easiest to get your head around, but eventually I was pretty confident that it wasn't me being an idiot: The option to change keyboard just wasn't there.
But it had to be, because I'd used it before...
A bit of Google-fu, and the answer came to light: Keyboard-switching power isn't exposed in the normal course of things. You can only get at it if you install the Secure Settings app.
Which I did. But that didn't work either. A bit more poking around, and I found that it needed me to install the System+ Module to allow it to expose the functionality I wanted. No problem, it has a button that does exactly that.
But I clicked on "Enable" and it failed to grant the permissions.
I checked the SuperSU logs, and was told that I'd need SuperSU *Pro* to access that feature.
So I threw a few quid their way, and got SuperSU Pro installed & running. (You have no idea how many reboots I'm leaving out of the story here, by the way :(
Tried again, saw a failure in the logs but needed to enable expanded logging for a more useful answer. Enabled it, tried again, finally got a useful error:
<stdin>: pm: not found</stdin>
But *why* isn't pm found? It's in the /system/bin/ directory, with correct 755 permissions. Fscking hell. Maybe I'm missing something?
Switch away from my Linux VM and back into OS X because that's where all the Android SDK stuff is installed. Open up an iTerm, and fire up adb. Which fails to find my tablet because (a) it's not plugged in at the moment, and (b) I turned off USB debugging.
Fix those two problems, and *now* I can get a shell. One quick confirm on SuperSU Pro later, and I have a root shell. Can I run the pm binary? Yes.
Okay, clearly there's a problem in the installer preventing it from using the correct $PATH to find the binary that's right where it fucking should be. It *can't* be that many commands to run to install this fecking module, right..? And I already know the first one from the error logs. It's pm grant com.intangibleobject.securesettings.plugin something something something
So, let's dump that command into google and see if anyone has been helpful enough to list the *other* commands that are needed..?
pm grant com.intangibleobject.securesettings.plugin android.permission.WRITE_SECURE_SETTINGS
pm grant com.intangibleobject.securesettings.plugin android.permission.CHANGE_CONFIGURATION
That's all it needs! Just those two commands!
So I run those from adb where pm is actually working, and the module is *still* not enabled. So I reboot just for good measure.
AND IT WORKS!!!
System+ Module is enabled, and Secure Settings is now allowing me to open the System+ Actions in Options and activate the "Input Method" entry.
Finally! I have reached the point where Tasker should be able to change my keyboard settings.
So now it's just the Tasker UI to worry about...
This time, I remember the lessons from last time: Do *not* start with the profile. First define the tasks you want. That means Tasks -> New -> Name it -> Add Action -> Select Plugin -> Secure Settings -> Edit configuration -> System+ Actions -> Input method -> Select desired keyboard from dropdown -> Save -> Leave all other conditions in the Tasker screen alone and hit the top-left button to say "I'm done here"
Repeat this for every keyboard I'll be wanting - in my case, LastPass, Hacker's, and stock.
Now that I *have* the tasks, create a profile to use them. Profiles -> New -> Application -> Select desired app(s) -> Top-left button -> From drop-down select desired keyboard task
Halfway there, I will now get the keyboard I want when I switch to a target app. But it won't go away when I leave. How do I add an "exit" task? I see nothing obvious.
A bit more poking around, and I get it: Long-press the green arrow, and it'll pop up a dropdown that allows you to add an exit task. Select that option, choose the stock keyboard task, and finally, after all that work, you're done.
Yes, I'm aware, it's an insane amount of work to have to go to just to establish a link between apps and keyboards. I only stuck with it so long because at every step of the way, it seemed like I was just *one* step away from success.
If somebody else is stuck with trying to get their CM tablet/phone to change keyboards based on app, I hope something in here helps you to save your sanity. Mine is, clearly, gone already :)
|<< <||> >>|