I've got a strange case for Android ICS Launcher 4.0.x.
Pre-condition:
A ICS device with root permission
Download Android ICS Launcher 4.0.3/4 source code (to modify and run)
Procedure:
Go to market (Play Store), download "Go Task Manager"
Open Widgets tab on Launcher, find "Mem Optimize", drag to Home screen (workspace)
Download and install "Fruit Ninja"
Create "Fruit Ninja" shortcut next to "Mem Optimize" widget on Home screen.
Execute "Fruit Ninja" and keep your phone in LANDSCAPE (hold it in your hand in this position, don't change this)
On menu screen of "Fruit Ninja", slice "Exit" , select "Yes"
Now back on Launcher Home screen, touch on "Mem Optimize" widget
Current Result:
Expectation:
My Tries (modify Launcher ICS source code):
Add to "Manifest.xml": android:screenOrientation="portrait"
=> still can't fix the problem.
Handle configuration change, android:configChanges="orientation|screenSize"
=> still can't fix the problem.
Use: setRequestedScreenOrientation(PORTRAIT)
=> still can't fix the problem.
What I've tried worked on Android 2.x; however, from 4.0.3+ , somehow it's not working as expected. Does anyone have any idea about this?
The problem is not in the Launcher. The problem is that a single configuration ( and that includes the orientation) is shared among all activities on the phone.
So if you have an activity that set the orientation to Landspace,e.g. Camera ( this is classical example where I work), this will "make" all the other activities to be on landscape too, because as I said that information is unique in system and shared among all.
This happens since the beginning of Android albeit sometimes you will not notice that because the changes are pretty fast.
To check what I am saying do the follow. Write an activity with a dialog theme such as @android:style/Theme.Holo.Dialog
, so it won't cover the entire screen and you'll still be able to see the activity that was bellow. That activity must have a fixed orientation. Let's say that you set it to landscape. Then use am start
on Android shell to be able to start the activity you have just created on top of any other activity. You'll see that no matter the orientation that previous activity had, as soon as you launch you test activity, the previous activity will assume the same orientation than your test activity. When you hit back, the previous activity will restore the orientation. But sometimes it might take a while, so you see things like your current result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With