Initial Screen Orientation

by prunand » Thu, 18 Nov 2010 03:56:06 GMT


Sponsored Links
 I am working on a device that is designed to be run in landscape
mode.  The display used is configured as portrait, however.  The
device has no G-Sensor to detect its orientation.

I have modified PhoneWindowManager.rotationForOrientationLw() to
return landscape based on an env variable.  This works fine after the
device has fully completed booting.  The problem is the lock screen
initially shows in portrait mode for a second or two before it flips
to landscape.  I would like to have it show up in landscape mode
initially.

At this point, I think I need to change SurfaceFlinger to honor the
env variable, and set the initial orientation accordingly.  Does this
sound right?  If so, is there a certain part of SurfaceFlinger I
should look at first?

-- 



Initial Screen Orientation

by Dianne Hackborn » Thu, 18 Nov 2010 14:03:36 GMT


 If your device is running in landscape, its native orientation should be
landscape, and you shouldn't have to do anything to change it to use that.
 Certainly, at least if you are working with 2.2, don't modify
rotationForOrientationLw() to just arbitrarily "make" this work, since you
could very easily break behavior applications expect.

Android will run in the device's native orientation (that is, not applying a
rotation to what is displayed on the screen) unless something tells it not
to.  If there is no accelerometer, this will not impact the rotation (though
do check that there isn't a problem here because the current code generally
assumes an accelerometer so I'm not sure what will happen without one).
 Individual windows and activities can request an orientation.  Very little
in the platform should force a particular orientation, though both the lock
screen and the launcher tell the window manager to ignore the sensors for
determining orientation.




> website: 


Sponsored Links


Initial Screen Orientation

by Andrew Prunicki » Thu, 18 Nov 2010 23:47:01 GMT


  guess I missed a couple of details in my first note.  The device is
intended to be used in landscape, but due to an unfortunate mfg
glitch, the display used is apparently made for portrait use. Hence,
the display hardware and driver reports portrait as its native
resolution. We are using 2.0.1 for this device.

By breaking behavior that applications expect when changing
rotationForOrientationLw(), I assume you mean that an application will
expect to be in portrait, but get landscape instead? The apps I have
tested support both orientations. I'll try it with a fixed portrait
app to see how it works with that app. The way buttons are laid out
on the device, portrait-only apps won't work well anyway. Is there
some other expected behavior that I may be breaking by pursuing this
approach?

If I want to instruct Android to change the orientation to landscape
up-front, is SurfaceFlinger the place to go, or would modifying the
display driver itself be a better approach?

On Nov 18, 12:02am, Dianne Hackborn <hack...@android.com> wrote:

--



Initial Screen Orientation

by Dianne Hackborn » Fri, 19 Nov 2010 04:29:43 GMT


 On Thu, Nov 18, 2010 at 7:46 AM, Andrew Prunicki




Then you'll need to do some hacks.  (See below.)



To be a compatible device, you *must* respect the requests of apps for the
orientation they are to run in.  If you don't care about being a compatible
device, then it is up to you what you want to do.



You can modify rotationForOrientationLw() so that the mPortraitRotation and
mLandscapeRotation provide the appropriate rotation to achieve those two
orientations on your device:

 http://android.git.kernel.org/?p=platform/frameworks/policies/base.git ;a=blob;f=phone/com/android/internal/policy/impl/PhoneWindowManager.java;h=dec495d1b0dc368da5728017e70135f19f90f1c0;hb=HEAD#l2111

You may also need to modify other rotations like mCarDockRotation if
appropriate.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Initial Screen Orientation

by Dianne Hackborn » Fri, 19 Nov 2010 04:30:16 GMT


 (Note you may not need to modify mCarDockRotation -- its default rotation is
to rotate based on the sensor, for example.)







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Other Threads

1. Changing IMAP

This code is found in:
src/com/android/email/mail/store/ImapStore.java


Okay, so I have a beef with the E-mail program provided by default and
I see room for change. My problem is that they use the IMAP command
LIST to list each folder, the problem with this is that, if you are
like me, with a large organization, you have a plethora of IMAP
folders. I haven't counted, but I'd estimate that we have around 292
and when I use the IMAP client built in, it loads all these folders,
and it takes it's sweet time.

connection.executeSimpleCommand(String.format("LIST \"\" \"%s*
\"",mPathPrefix == null ? "" : mPathPrefix));

Is the line that the code uses, which has a problem, because it's
telling the imap server it wants to list all the folders, whether you
are subscribed or not...

A simple change to this would be

connection.executeSimpleCommand(String.format("LSUB \"\" \"%s*
\"",mPathPrefix == null ? "" : mPathPrefix));

The LSUB command will only display the folders you are subscribed to,
instead of every folder. A better version would be the

connection.executeSimpleCommand(String.format("LSUB \"\" \"%s%
\"",mPathPrefix == null ? "" : mPathPrefix));

so that it would fold the folders first, then if a user click on it,
it can expand, swapping the % for a *.



If they are worried about not being able to see unsubscribed folders,
a new option can be coded to allow for

connection.executeSimpleCommand(String.format("LIST \"\" \"%s*
\"",mPathPrefix == null ? "" : mPathPrefix));

and simple have the user pick which folders they'd like to subscribe
to, if they have the permissions.


I have not yet git the entire tree and attempted to recompile the
emulator to reflect this change, but I will to test out my change and
I'll let you all know if this works, just wanted to get some feedback
on this problem.

--~--~---------~--~----~------------~-------~--~----~

2. Developer Available

For those of you cruising this group looking for developers, I now have a short 
window to take proposals for Android development for pay.
If you are serious about needing some Android coding, whether a fully 
functional application or just some help on a large project, inquire and let me 
know what you want.
 
_________________________________________________________________
Hotmail goes where you go. On a PC, on the Web, on your phone. 
http://www.windowslive-hotmail.com/learnmore/versatility.aspx#mobile?ocid=TXT_TAGHM_WL_HM_versatility_121208
 
--~--~---------~--~----~------------~-------~--~----~

3. How to build recovery Image separately

4. UI question: TrueType Font rendering bug

5. Looking for Accelerometer Example

6. Eclipse problem with new projects

7. Question on differing permission definitions