FORUMS
Remove All Ads from XDA
Win Honor 9 Lite

[HACK REQUEST] Manual Orientation Change (Spoof Keyboard Slide Out?)

57 posts
Thanks Meter: 1
 
By mttmllns, Member on 8th April 2010, 02:55 AM
Post Reply Email Thread
I'm tired of Automatic Orientation switching! Whether I'm walking down the street too roughly, in the process of pulling my phone out of my pocket, wanting to read something lying down in bed, or coming back to landscape mode from a lockscreen...the automatic orientation seems to be my enemy more often than my savior.

But before you tell me turn it off, I still want to be able to reorient my phone into landscape mode on demand. I have a MyTouch so I don't have personal experience with the wonderful hardware keyboard you G1, Droid, Cliq, etc. owners have. If I understand it correctly, when you slide out your keyboard the screen reorients to landscape and stays that way?

My question...can this action be spoofed on a phone that doesn't have a slide out hardware keyboard? Is there some flag that can be toggled? Some config file that can be edited? Can this be done with an App? A script? I have a feeling it will require root. Could it be cooked directly into a ROM?

Ideally I'd be able to co-opt a hardware key (maybe long-press back button) to toggle the orientation. I could also deal with having a shortcut in the Notification Drawer to perform the toggle.

It was my intention to investigate this on my own, teach myself android development and do some deeper poking around if it required root. I'm still going to do that...eventually. But I thought I'd open this up to others with much more knowledge to see if anybody else is interested in this or has a better idea of what this would require.

What do ya think? Would you want this feature or am I the only one? Would you want to develop it? Do you have any info that could help us?


keywords: automatic orient orientation rotate rotation hardware keyboard slide spoof
 
 
8th April 2010, 03:24 AM |#2  
bunu's Avatar
Senior Member
Thanks Meter: 57
 
More
download spare parts from the market if you don't have it already. You can use that to toggle automatic orientation on the launcher.

You can go to settings to toggle automatic orientation for the apps in the sound and display settings.
8th April 2010, 06:27 AM |#3  
mttmllns's Avatar
OP Member
Flag Seattle, WA
Thanks Meter: 1
 
More
Quote:
Originally Posted by UberMario

download spare parts from the market if you don't have it already. You can use that to toggle automatic orientation on the launcher.

You can go to settings to toggle automatic orientation for the apps in the sound and display settings.

Thanks but I'm familiar with both of those.
10th April 2010, 10:54 AM |#4  
mttmllns's Avatar
OP Member
Flag Seattle, WA
Thanks Meter: 1
 
More
Well after some more snooping I found this post about remapping keys:

http://forum.xda-developers.com/showthread.php?t=551344

Might help with part of this problem. We'll see if it leads me in the right direction...

I spent a bit of time searching through the source and following the various hardKeyboardHidden flags but that didn't really get me anywhere.
10th April 2010, 01:16 PM |#5  
mttmllns's Avatar
OP Member
Flag Seattle, WA
Thanks Meter: 1
 
More
Does someone with a G1 (or Droid, or Cliq or whatever slidey phone I guess) want to do me a real quick favor? I want to see if there is a keyevent generated when you slide the keyboard out and back in. To check this:
  1. Plug your phone in.
  2. Run
    Code:
    adb shell getevent
  3. Tell me what your device mapping is. Should look something like this:
    Code:
    add device 1: /dev/input/event5
      name:     "compass"
    add device 2: /dev/input/event4
      name:     "sapphire-keypad"
    add device 3: /dev/input/event3
      name:     "sapphire-nav-button"
    add device 4: /dev/input/event2
      name:     "sapphire-nav"
    add device 5: /dev/input/event1
      name:     "synaptics-rmi-touchscreen"
    add device 6: /dev/input/event0
      name:     "h2w headset"
  4. Slide your keyboard out and check if there are events.
  5. Slide your keyboard in and check for events.
  6. Paste the events here.

This should tell me the scancode if there is one. Getevent and sendevent are pretty interesting. With sendevent you can simulate any keypress or touchscreen input or whatever.

Thanks!
12th April 2010, 10:49 AM |#6  
phhusson's Avatar
Recognized Developer
Flag Paris
Thanks Meter: 2,557
 
Donate to Me
More
A kernel point of view is to send a SW_LID 0/1 event. Still, it can be done from userland with uevent.
15th April 2010, 01:11 PM |#7  
mttmllns's Avatar
OP Member
Flag Seattle, WA
Thanks Meter: 1
 
More
Quote:
Originally Posted by phhusson

A kernel point of view is to send a SW_LID 0/1 event. Still, it can be done from userland with uevent.

Ah. Thanks for the keywords! They helped a lot:

http://www.google.com/codesearch?q=p...g+SW_LID&hl=en

http://www.google.com/codesearch/p?h...g%20uevent&d=1

So it doesn't look like it'll be as easy as I was hoping, but maybe one day I'll figure out how to play with uevent. This does mean I'll have to write some C code, right? I'll save that research for another day but feel free to pitch in if you have any tips on where I could get started. I haven't really looked into what it takes to run C on Android.
31st July 2010, 02:43 PM |#8  
Senior Member
Flag New York
Thanks Meter: 7
 
More
I'd like to be able to shake the phone in a certain way to get it to rotate, but not just to rotate whenever I happen to tilt the phone. It should be a conscious event.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes