Orientation locking method? - Android Software/Hacking General [Developers Only]

Tons of people want to be able to lock their phone in landscape mode (most default allow locking to portrait but none to landscape without hard keyboards).
We have plenty of people who roll android kernels here. Is it not possible to edit the bma150 accelerometer driver (i assume this is the one most/all android phones use.. am i wrong?) to report orientation based on a sysfs file. If the user writes a 0 to a certain sysfs file that the driver creates upon load, then orientation is like stock android behaves. If we write a "1" to the file, it could lock orientation in whatever position it's in and spoof any request for orientation to whatever this value is locked at. Each request would query the sysfs file and the user can write a "0" to unlock it.
Then we can create a widget/app that does the writing to the sysfs file. Obviously, this would only function for rooted phones.
Is this something that's not possible because the accelerometer drivers are different and closed source for each phone or what? I dont believe i'm the first person to come up with this idea so there has to be some reason why it's not done.

Hi,
install AutoRotate from the Market...it will enable or disable automatic rotation if you make a long press on the "search" button (or obviously if you start this app).
Bye

I agree I would find this extremely useful to be able to lock the tablet in any of the 4 possible orientations. Currently autorotate simply let u toggle between the default orientation (landscape on my tablet) and auto rotate on. I would love to be able to lock rotation at any position.

autorotate on my phone would just turn off autorotate or turn it on. this means portrait mode or non-locked rotate. Not what i'm describing at all and not what most people want.

Related

[APP] Proximity Sensor for Screen Off v0.2

May be this tool will be usefull.
It switch off screen using proximity sensor detection.
Like alternative power button.
After proximity detected - screen switched off and proximity sensor don't used until screen will be switched on again manualy.
No screenshots
Second time running will unload program from memory, it can be used for switching on/off proximity lock feature.
All settings in registry, settings reloaded on each program run.
HKEY_CURRENT_USER\Software\Exidler\Hd2ProximityScreenOff
AfterCallReactivateSensor = dword:150 - time in ms when activate proximity sensor after call ended
SensorOffWhenProximity = dword:0 - time in ms when disabling proximity sensor on proximity detected. May be useful for disabling accident detection. This time proximity sensor is still active and if no porximity detected with this time - screen will be switched on automatically
ActiveOnlyIfLocked = dword:0 - Activate Proximity sensor only if Phone locked.
HKEY_CURRENT_USER\Software\Exidler\Hd2ProximityScreenOff\Exceptions
Create any named sub keys with values:
ClassName = string - name of windows class
WndTitle = string - title of window
ProcName = string - name of process
For exception windows proximity sensor will be disabled if this one window is active.
All criterias are optional. For example create only one value ProcName="Explorer.exe" for disabling proximity lock when Resco Explorer is active.
Proximity sensor activated only in portrait mode.
Change log
2010-01-29: v0.2
- full uninstallable cab
- add options: After Call Reactivate Sensor, Sensor Off When Proximity, Active Only If Phone Locked, Exception windows
- disbaling Proximity lock when landscape mode
2010-01-28: v0.1 Test version. Bugs possible.
Great something to get us started, did you make this yourself? Are you willing to put some time in to perfect it & create some options etc. if we bug test it?
exidler said:
May be this tool will be usefull.
It switch off screen using proximity sensor detection.
Like alternative power button.
After proximity detected - screen switched off and proximity sensor don't used until screen will be switched on again manualy.
No screenshots, not settings, just install and reboot phone (or run tool manual from Install directory)
Second time running will unload program from memory.
Test version. Bugs possible.
Click to expand...
Click to collapse
How will this effect the screen turning on after a phonecall, i wan't the screen automatically turned on after a call without having to press a button.
Will this tweak allow default function in that case?
richardirv said:
Are you willing to put some time in to perfect it & create some options etc. if we bug test it?
Click to expand...
Click to collapse
I don't know which options may be added.
I'm can't full control proximity sensor. It's only possible to enable proximity sensor, and htc drivers switching off screen by itself. The i'm disable proximity sensor again
But if it's will be possible to implement some features - i can try to do this.
Ok this is a good start, for me the following things need to be worked out for this to work good.
1. Only works when phone is upright, ie. Portrait. Reason being is if the screen goes off via Proximity in when holding the phone in landscape there will be allot of accidental activations, especially while playing games etc. It is much less likely that proximity will be detected when holding the phone upright.
2. Screen needs to come back on when proximity not detected, as to not cancel out the in call screen off feature.
Will keep thinking! Really hope you can work some magic here exidler!! Thanks
ET said:
How will this effect the screen turning on after a phonecall, i wan't the screen automatically turned on after a call without having to press a button.
Click to expand...
Click to collapse
it will handle proximity sensor to default behavior after call. so i think (and shure) - screen will blink for short time (~200ms) and will be switched off by tool.
exidler said:
it will handle proximity sensor to default behavior after call. so i think (and shure) - screen will blink for short time (~200ms) and will be switched off by tool.
Click to expand...
Click to collapse
Let me test, I assume the cab can be de-installed and everything is back to default behaviour?
richardirv said:
1. Only works when phone is upright, ie. Portrait. Reason being is if the screen goes off via Proximity in when holding the phone in landscape there will be allot of accidental activations, especially while playing games etc. It is much less likely that proximity will be detected when holding the phone upright.
2. Screen needs to come back on when proximity not detected, as to not cancel out the in call screen off feature.
Click to expand...
Click to collapse
in call screen back on when no proximity
when not in call - it switch off. or you talking about switching on screen when not in call?
about landscape and portrait. it's make easy if screen orientation really changed (if not - polling g-sensor - is not a good idea for battery i'm think)
ET said:
Let me test, I assume the cab can be de-installed and everything is back to default behaviour?
Click to expand...
Click to collapse
Cab is Uninstallable, but you must close program manually before uninstalling: run program second time, it will show message about closing
exidler said:
in call screen back on when no proximity
when not in call - it switch off. or you talking about switching on screen when not in call?
about landscape and portrait. it's make easy if screen orientation really changed (if not - polling g-sensor - is not a good idea for battery i'm think)
Click to expand...
Click to collapse
I just ment you don't want it to interfere with the in call actions the HD2 already has.
As you say g-sensor polling etc. no good for battery. I have a feeling this maybe flawed before we get started.
richardirv said:
I just ment you don't want it to interfere with the in call actions the HD2 already has.
Click to expand...
Click to collapse
program know about call and not be interferace with HD2 proximity call actions.
Landscape alternative - Programs (windows) exceptions - when it's active - promity sensor may be disabled. (but this feature need more time for apply)
Just tested the app and maid an incomming call with an other phone, the screen will automaticly turn on after moving from my ear as should be.
Great app I must say!
My fear is when using apps like fpsece etc, the screen will keep going off. Need to put our heads together and brainstorm some ideas to prevent acidental proximity.
The landscape idea with g-sensor was the first thing that came to me but hopefully there will be a better idea. Maybe only when the phone is perfectly horizontal (i.e as it goes into a pocket) The problem is keeping the g-sensor active will drain battery....
Idea's peeps!!
Hmm no way of de-installing it. If I use the app and then push the on button and then try to remove the app via start/settings, after about 10 seconds the device freezes.
Even after trying to install the app again (wich usually workes to remove apps witch can't be completely removed via start/settings) the device freezes.
Taking battery out is only way to restart. App remaines on device though.
Noticed also that the app is flawed, trying to go with my right finger to the left top of the screen to push start makes the screen turn of and that simply sucks.
HOW TO REMOVE THIS APP?
ET said:
HOW TO REMOVE THIS APP?
Click to expand...
Click to collapse
Before uninstalling go to install folder (defaul is \Program Files\Hd2ProxmityScreenOff) and run exe file inside Hd2ProxmityScreenOff.exe
You will see message about that programe closed. Tap Ok and then uninstall.
All be fine.
about freezing when uninstalling without stopping in memory process i'm know.
exidler said:
Before uninstalling go to install folder (defaul is \Program Files\Hd2ProxmityScreenOff) and run exe file inside Hd2ProxmityScreenOff.exe
You will see message about that programe closed. Tap Ok and then uninstall.
All be fine.
about freezing when uninstalling without stopping in memory process i'm know.
Click to expand...
Click to collapse
OK thanks, it's de-installed correctly. Maybe will use it in the future when it has matured a bit.
The programm should look on proximity-sensor, when i turn on my phone with the power-button.
--> if proximity detectet, screen should be staying off
--> if no proximity, phone should be wake up
Is this possible with your app? This would be a very great feature off our hd2! Perfect locking solution!
Bib_x said:
The programm should look on proximity-sensor, when i turn on my phone with the power-button.
--> if proximity detectet, screen should be staying off
--> if no proximity, phone should be wake up
Is this possible with your app? This would be a very great feature off our hd2! Perfect locking solution!
Click to expand...
Click to collapse
it's not possible until full hack of promitiy sensor.
i'm not have a fule of knowlendge fo arm assembler interpereting.
it' not difficlt for poples, how have knowledge of arm programs research.
but for me, i'm only can handle simple events
We are waiting for full promitiy API
so all of yours requests is impossimle.
Its a good start. Keep the project on.
perhaps a little bit easier to develop and to get various possibilities:
could you add 2 parameters to your app:
-activate
-deactivate
or so.
then it could be called also from other apps depend on its needs and states.
And also one scenario: It should only work if screen is locked(using notification).Then it's sure,that it should switch off because sensor detection
Keep up your great work.A really good idea,which can be very useful, if adaptable and a little configurable.
Thanx
Micha

[Q] Force app to run with 180-degree rotation

I would like to run my application with 180-degree rotation all the time, no matter what the current sensor value is. For 0 or 90 degree rotations, I would set screenOrientation to "landscape" or "portrait" in the manifest file, or call setRequestedOrientation() from code.
The problem is, the Android API doesn't know anything about the 180 degree rotation that CM provides, so it is difficult to access from within my application. I would be open to any possible solutions, no matter how convoluted
I'm running CyanogenMod-6.0 on the Nexus One.
Thanks

[Q] Increasing Screen Rotation Speed

Is it possible to make the screen rotation happen any faster? Using an accelerometer app to view the sensors values, it looks like the values for a rotated screen are produced pretty quickly after a screen rotation takes place. Could the process responsible for detecting this change increase the sample rate of the accelerometer values, resulting in a faster response? Or is the pause due to error prevention, to help eliminate false rotations?
I would like to bring this back to the top, as it is a valid concern for me, as well. There is a full 1.5-second delay for switching orientation. Far too slow.
Thank you,
Andy
Hi,
I just asked this same question in another thread yesterday so I would also like to know. I'm using a Huawei u8100 running android 2.1.
Thanks!

How to limit Auto Rotate to 90° and 180° only

So I know CM7 can do it but unfortunately there is no CM7 for my device. Is there any app or any root file edits to limit so auto rotate just stays upright and then goes 180 degrees?
Im sick and tired of it going upside down and the other way when I barley turn the screen.
Afaik that setting in AOSP ROMs is stored in a .dex file, so unless you have the environment to edit that I do not know of another way. At least that is what I recall when Froyo added landscape right orientation.

Is it possible to control screen properties in Android

hello everyone,
I've a question I'd like to ask regarding android, as I'm not that experience with coding, so I was hoping someone could help me with this.
to make a long story short: I've an android stick that I want to use for a Magic Mirror, but those sticks do not have a gyroscope sensor (for obvious reasons) so the screen is always set to horizontal mode. you can change the screen orientation through basic android configurations or apps, but all that does is setting the width of the screen to 50% and the height to 200%, where I really need the screen to actually rotate 90 degrees (as for the mirror I need to use the screen of the stick vertically)
my question now is if it's possible to perhaps edit the android code, through rooting or something alike, where I can control the screen properties, so I'd be able to actually rotate the screen 90 degrees.

Categories

Resources