how to change default display orientation from portrait to landscape or vice-versa?

1,230 views
Skip to first unread message

Venu

unread,
Jul 1, 2010, 4:37:13 AM7/1/10
to android-platform, vbyra...@nvidia.com, rkan...@nvidia.com
Hi all,

I'm trying to change default display orientation of android on froyo.
Can some one plz let me know the procedure to change default display
orientation of android from portrait to landscape or vice-versa?

Thanks,
Venu

Dianne Hackborn

unread,
Jul 1, 2010, 4:54:58 PM7/1/10
to android-...@googlegroups.com, vbyra...@nvidia.com, rkan...@nvidia.com
Your driver needs to report its native dimensions in that orientation -- that is with width larger than height.

Because the standard platform has not been shipped this way, there may be fixes you need to make in it for it to work correctly.  For example WindowManagerService.java at least at one time didn't fully work correctly with a screen in this orientation -- it would not use the correct rotations on it.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@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.

Venu

unread,
Jul 2, 2010, 12:00:08 AM7/2/10
to android-platform
Hi Dianne,
Thank you very much for your quick response.
Actually I'm working on development board where we have the default
orientation set to Landscape and am trying to make it portrait, for
testing some of the new features.
But as I do not know much internals of android, I'm stuck there?
Can you plz elaborate a little bit more on where exctly I need to
change this dimensions reporting?
It would be of more helpful, If you can point me to the files where
android would refer for native dimensions.
Thanking you again for your help.
Venu


On Jul 2, 1:54 am, Dianne Hackborn <hack...@android.com> wrote:
> Your driver needs to report its native dimensions in that orientation --
> that is with width larger than height.
>
> Because the standard platform has not been shipped this way, there may be
> fixes you need to make in it for it to work correctly.  For example
> WindowManagerService.java at least at one time didn't fully work correctly
> with a screen in this orientation -- it would not use the correct rotations
> on it.
>
>
>
>
>
> On Thu, Jul 1, 2010 at 1:37 AM, Venu <venubyravar...@gmail.com> wrote:
> > Hi all,
>
> > I'm trying to change default display orientation of android on froyo.
> > Can some one plz let me know the procedure to change default display
> > orientation of android from portrait to landscape or vice-versa?
>
> > Thanks,
> > Venu
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-platform" group.
> > To post to this group, send email to android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib­e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> 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.- Hide quoted text -
>
> - Show quoted text -

w wylhistory

unread,
Jul 2, 2010, 12:21:48 AM7/2/10
to android-...@googlegroups.com
in file frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java
function:
rotationForOrientationLw
return a direction of what you want;
the red lines are my change: (in eclair)
  /*added by wylhistory for test*/
        Log.d(TAG,"the before switch orientation :"+orientation);
 if(false){
        /*above is added by wylhistory for test*/

        synchronized (mLock) {
            switch (orientation) {
                case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
                    //always return landscape if orientation set to landscape
                    return mLandscapeRotation;
                case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
                    //always return portrait if orientation set to portrait
                    return mPortraitRotation;
            }
            // case for nosensor meaning ignore sensor and consider only lid
            // or orientation sensor disabled
            //or case.unspecified
            if (mLidOpen) {
                return mLidOpenRotation;
            } else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 
0) {
                return mCarDockRotation;
            } else if (mDockState == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation >
= 0) {
                return mDeskDockRotation;
            } else {
                if (useSensorForOrientationLp(orientation)) {
                    // If the user has enabled auto rotation by default, do it.
                    int curRotation = mOrientationListener.getCurrentRotation();
                    return curRotation >= 0 ? curRotation : lastRotation;
                }
                return Surface.ROTATION_0;
            }
        }
/*added by wylhistory for test*/
        }
        return Surface.ROTATION_90;/here you can change to any other direction of your like;
  /*added by wylhistory */


2010/7/2 Venu <venubyr...@gmail.com>
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

Venu

unread,
Jul 2, 2010, 4:00:25 AM7/2/10
to android-platform
Thank you very much wylhistory.
With your suggested changes i'm able to see home screen in Portrait.
But when I'm seeing item list under settings, display orientation is
not rotating when I rotate the phone to either left or right sides,
which was working prior to this change.
Any idea, how can I get display orientation working along with the
home screen in portrait mode?

thanks,
Venu

On Jul 2, 9:21 am, w wylhistory <wylhist...@gmail.com> wrote:
> in file
> frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindow­Manager.java
> function:
> rotationForOrientationLw
> return a direction of what you want;
> *the red lines are my change: (in eclair)*
>   */*added by wylhistory for test*/*
> *        Log.d(TAG,"the before switch orientation :"+orientation);*
> * if(false){*
> *        /*above is added by wylhistory for test*/*
> */*added by wylhistory for test*/*
> *       ** }*
> *        return Surface.ROTATION_90;/here you can change to any other
> direction of your like;*
> *  /*added by wylhistory */*
> *
> *
> *
> *
> 2010/7/2 Venu <venubyravar...@gmail.com>
> >http://groups.google.com/group/android-platform?hl=en.- Hide quoted text -

w wylhistory

unread,
Jul 2, 2010, 6:43:13 AM7/2/10
to android-...@googlegroups.com
Sorry,
in my device,it is in portrait  mode in each application except the apps that do not support it;
the fallback is that it will never change to the landscape ;
if you want to responding to the sensor,you must change the function rotationForOrientationLw,
return the reverse rotation,I do not test it,you can try;



2010/7/2 Venu <venubyr...@gmail.com>
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

Venu

unread,
Jul 2, 2010, 7:43:01 AM7/2/10
to android-platform, vbyra...@nvidia.com
Thank you very much wylhistory, for your prompt response.

I'll try to see how to fine tune this function to serve auto rotation
along with portrait as home screen.
If anyone else have any suggestions, plz let me know.

Thanks,
Venu

On Jul 2, 3:43 pm, w wylhistory <wylhist...@gmail.com> wrote:
> Sorry,
> in my device,it is in portrait  mode in each application except the apps
> that do not support it;
> the fallback is that it will never change to the landscape ;
> if you want to responding to the sensor,you must change the
> function rotationForOrientationLw,
> return the reverse rotation,I do not test it,you can try;
>
> 2010/7/2 Venu <venubyravar...@gmail.com>
> > > >http://groups.google.com/group/android-platform?hl=en.-Hide quoted

Rogério de Souza Moraes

unread,
Jul 2, 2010, 9:09:56 AM7/2/10
to android-...@googlegroups.com
Hi,

I use this configuration in init.rc to set the default display to landscape mode. I use it in 2.1.

setprop ro.FSL_LANDSCAPE_MODE 1

Regards,

Rogerio

2010/7/2 Venu <venubyr...@gmail.com>
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

Venu

unread,
Jul 6, 2010, 5:37:18 AM7/6/10
to android-platform
hi Rogério,

Where is this init.rc is stored?

thanks,
Venu


On Jul 2, 6:09 pm, Rogério de Souza Moraes <rogerio.so...@gmail.com>
wrote:
> Hi,
>
> I use this configuration in init.rc to set the default display to landscape
> mode. I use it in 2.1.
>
> setprop ro.FSL_LANDSCAPE_MODE 1
>
> Regards,
>
> Rogerio
>
> > > > > >http://groups.google.com/group/android-platform?hl=en.-Hidequoted

SagarKadam

unread,
Jul 6, 2010, 6:39:05 AM7/6/10
to android-platform
This file is present into system/core/rootdir/ of your android build.
Which later goes into your targets root file system

On Jul 6, 2:37 pm, Venu <venubyravar...@gmail.com> wrote:
> hi Rogério,
>
> Where is this init.rc is stored?
>
> thanks,
> Venu
>
> On Jul 2, 6:09 pm, Rogério de Souza Moraes <rogerio.so...@gmail.com>
> wrote:
>
> > Hi,
>
> > I use this configuration in init.rc to set thedefaultdisplaytolandscape
> > mode. I use it in 2.1.
>
> > setprop ro.FSL_LANDSCAPE_MODE 1
>
> > Regards,
>
> > Rogerio
>
> > 2010/7/2 Venu <venubyravar...@gmail.com>
>
> > > Thank you very much wylhistory, for your prompt response.
>
> > > I'll try to see how to fine tune this function to serve auto rotation
> > > along withportraitas home screen.
> > > If anyone else have any suggestions, plz let me know.
>
> > > Thanks,
> > > Venu
>
> > > On Jul 2, 3:43 pm, w wylhistory <wylhist...@gmail.com> wrote:
> > > > Sorry,
> > > > in my device,it is inportrait mode in each application except the apps
> > > > that do not support it;
> > > > the fallback is that it will neverchangeto thelandscape;
> > > > if you want to responding to the sensor,you mustchangethe
> > > > function rotationForOrientationLw,
> > > > return the reverse rotation,I do not test it,you can try;
>
> > > > 2010/7/2 Venu <venubyravar...@gmail.com>
>
> > > > > Thank you very much wylhistory.
> > > > > With your suggested changes i'm able to see home screen inPortrait.
> > > > > But when I'm seeing item list under settings,displayorientationis
> > > > > not rotating when I rotate the phone to either left or right sides,
> > > > > which was working prior to thischange.
> > > > > Any idea, how can I getdisplayorientationworking along with the
> > > > > home screen inportraitmode?
>
> > > > > thanks,
> > > > > Venu
>
> > > > > On Jul 2, 9:21 am, w wylhistory <wylhist...@gmail.com> wrote:
> > > > > > in file
>
> > > frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindow­­­Manager.java
> > > > > > function:
> > > > > > rotationForOrientationLw
> > > > > > return a direction of what you want;
> > > > > > *the red lines are mychange: (in eclair)*
> > > > > >   */*added by wylhistory for test*/*
> > > > > > *        Log.d(TAG,"the before switchorientation:"+orientation);*
> > > > > > * if(false){*
> > > > > > *        /*above is added by wylhistory for test*/*
>
> > > > > >         synchronized (mLock) {
> > > > > >             switch (orientation) {
> > > > > >                 case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE:
> > > > > >                     //always returnlandscapeiforientationset to
> > > > > >landscape
> > > > > >                     return mLandscapeRotation;
> > > > > >                 case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
> > > > > >                     //always returnportraitiforientationset to
> > > > >portrait
> > > > > >                     return mPortraitRotation;
> > > > > >             }
> > > > > >             // case for nosensor meaning ignore sensor and consider
> > > only
> > > > > lid
> > > > > >             // ororientationsensor disabled
> > > > > >             //or case.unspecified
> > > > > >             if (mLidOpen) {
> > > > > >                 return mLidOpenRotation;
> > > > > >             } else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR &&
> > > > > > mCarDockRotation >=
> > > > > > 0) {
> > > > > >                 return mCarDockRotation;
> > > > > >             } else if (mDockState == Intent.EXTRA_DOCK_STATE_DESK &&
> > > > > > mDeskDockRotation >
> > > > > > = 0) {
> > > > > >                 return mDeskDockRotation;
> > > > > >             } else {
> > > > > >                 if (useSensorForOrientationLp(orientation)) {
> > > > > >                     // If the user has enabled auto rotation by
> > >default,
> > > > > do
> > > > > > it.
> > > > > >                     int curRotation =
> > > > > > mOrientationListener.getCurrentRotation();
> > > > > >                     return curRotation >= 0 ? curRotation :
> > > lastRotation;
> > > > > >                 }
> > > > > >                 return Surface.ROTATION_0;
> > > > > >             }
> > > > > >         }
> > > > > > */*added by wylhistory for test*/*
> > > > > > *       ** }*
> > > > > > *        return Surface.ROTATION_90;/here you canchangeto any other
> > > > > > direction of your like;*
> > > > > > *  /*added by wylhistory */*
> > > > > > *
> > > > > > *
> > > > > > *
> > > > > > *
> > > > > > 2010/7/2 Venu <venubyravar...@gmail.com>
>
> > > > > > > Hi Dianne,
> > > > > > > Thank you very much for your quick response.
> > > > > > > Actually I'm working on development board where we have thedefault
> > > > > > >orientationset toLandscapeand am trying to make itportrait, for
> > > > > > > testing some of the new  features.
> > > > > > > But as I do not know much internals of android, I'm stuck there?
> > > > > > > Can you plz elaborate a little bit more on where exctly I need to
> > > > > > >changethis dimensions reporting?
> > > > > > > It would be of more helpful, If you can point me to the files where
> > > > > > > android would refer for native dimensions.
> > > > > > > Thanking you again for your help.
> > > > > > > Venu
>
> > > > > > > On Jul 2, 1:54 am, Dianne Hackborn <hack...@android.com> wrote:
> > > > > > > > Your driver needs to report its native dimensions in that
> > >orientation
> > > > > --
> > > > > > > > that is with width larger than height.
>
> > > > > > > > Because the standard platform has not been shipped this way,
> > > there
> > > > > may be
> > > > > > > > fixes you need to make in it for it to work correctly.  For
> > > example
> > > > > > > > WindowManagerService.java at least at one time didn't fully work
> > > > > > > correctly
> > > > > > > > with a screen in thisorientation-- it would not use the correct
> > > > > > > rotations
> > > > > > > > on it.
>
> > > > > > > > On Thu, Jul 1, 2010 at 1:37 AM, Venu <venubyravar...@gmail.com>
> > > > > wrote:
> > > > > > > > > Hi all,
>
> > > > > > > > > I'm trying tochangedefaultdisplayorientationof android on
> > > To post to this group, send email to android-...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib­e...@googlegroups.com>
> > > .
> > > For more options, visit this group at

Rogério de Souza Moraes

unread,
Jul 6, 2010, 11:00:53 AM7/6/10
to android-...@googlegroups.com
To customize the board the right thing to do first is to create a folder for your customs inside the folder vendor. Check the folder "vendor/htc" as example.

Regards,

Rogerio

2010/7/6 SagarKadam <kadams...@gmail.com>
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

Venu

unread,
Jul 7, 2010, 2:13:35 AM7/7/10
to android-platform, venubyr...@gmail.com
As I do not see anything like setprop ro.FSL_LANDSCAPE_MODE 1 in
system/core/rootdir/init.rc, I added "setprop ro.FSL_PORTRAIT_MODE 1"
to that file and rebuilt the image. but am still seeing the deault
screen as landscape. Any suggestions, what else could be checked?
> ...
>
> read more »- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages