LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-05-2012, 06:25 AM   #1
Vinter
Member
 
Registered: Feb 2005
Location: Germany
Distribution: Aptosid
Posts: 148

Rep: Reputation: 19
[android 2.2.2] Switching input method on rooted device?


Hi!

In order to automatically switch to Wifi Keyboard as my current input method when plugging my phone into my computer, I am looking to circumvent the security restrictions normally preventing that. Normally, applications are not given the permission to change input methods due to them being in control of the system, possibly with malicious intent.

Now, my phone is rooted, and root shall be your god, so this must be possible. To further complicate matters, I am trying to acieve this through Tasker (which does not know about root), as it already provides the several other tasks I want to achieve and can trigger them in any context imaginable. It is, however, able to run scripts - so if there is a way to sudo or similar, I'm set.

Google gave me this page: http://developer.android.com/referen...odManager.html

It says, among other things, the following:

Quote:
The input method manager as expressed by this class is the central point of the system that manages interaction between all other parts. It is expressed as the client-side API here which exists in each application context and communicates with a global system service that manages the interaction across all processes.

An input method (IME) implements a particular interaction model allowing the user to generate text. The system binds to the current input method that is use, causing it to be created and run, and tells it when to hide and show its UI. Only one IME is running at a time.

Multiple client applications arbitrate with the input method manager for input focus and control over the state of the IME. Only one such client is ever active (working with the IME) at a time.
Quote:
Only the system is allowed to directly access an IME's InputMethod interface, via the BIND_INPUT_METHOD permission. This is enforced in the system by not binding to an input method service that does not require this permission, so the system can guarantee no other untrusted clients are accessing the current input method outside of its control.
Quote:
A client application can ask that the system let the user pick a new IME, but can not programmatically switch to one itself. This avoids malicious applications from switching the user to their own IME, which remains running when the user navigates away to another application. An IME, on the other hand, is allowed to programmatically switch the system to another IME, since it already has full control of user input.
The identification of the current IME is represented by this:

Quote:
IBinder imeToken Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself.
I take from this that I either have to
a) gimme that BIND_INPUT_METHOD permission,
b) remove that whole restriction at least temporarily,
c) impersonate being the currently active IME by taking the imeToken away or
d) tell the IME that it should switch to another one.

Unfortunately, my programming experience is limited to C (on microcontrollers...), Python and PHP, and never have I worked in such a large-scale project, only in small ones for personal or limited use. So, well, I have no idea how to achieve any of these goals.

Could any Android-proficient programmer tell me if what I want to do is even possible, and if so, how? I don't need the full code, if there is much to it, but rather some directions, altough I certainly would not mind it

Thanks a bunch for any advice in advance!
V

[Ed: If this should have rather gone to "Linux on mobile devices", please forgive and move. If there are no Gurus around, I'd also be grateful for a pointer to the place where the most ommonly reside, i. e. another board.]

Last edited by Vinter; 02-05-2012 at 06:27 AM.
 
Old 02-05-2012, 04:24 PM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
Maybe post your question here: Android Questions. Your exisitng login to LQ should also work here.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Kinect meets Android, a new input method is born" mjolnir Linux - Mobile 0 01-25-2012 08:49 AM
LXer: Camera LED As Flashlight on Non-Rooted Android Phones LXer Syndicated Linux News 1 08-02-2010 09:43 PM
LXer: Use your Android Phone as a Wireless Hotspot (Rooted Phones Only) LXer Syndicated Linux News 0 07-31-2010 05:11 AM
LXer: Android e-reader rooted, booed, and sued LXer Syndicated Linux News 0 12-18-2009 11:00 AM
Changing root password on rooted android business_kid Linux - Mobile 3 11-24-2009 03:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration