This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Android Jelly Bean 4.2.2 Devkit Rotating Display of touchscreen ...Help Needed

Hello All,

I am working on TI JB 4.2.2 Devkit 4.1.1 on customized board AM335x and want to rotate the screen.I have ICS 4.0 Devkit in which we used to rotate the screen

by setting the property "ro.sf.hwrotation=90" in defualt.prop file.

But i am not able to rotate the display of my touchscreen with the above property.Kindly please guide me in this regard.

Regards

Nitish Mehta

  • Hi Nitish,

    the way to control the device rotation between ICS and JB changed quite a bit. This property that you are using does not exist anymore. Instead, you need to modify 2 settings into the a database. See the Android documentation:
    - developer.android.com/.../Settings.System.html
    - developer.android.com/.../Settings.System.html

    You basically need to set the ACCELEROMETER_ROTATION to 0 and the USER_ROTATION to 0, 1, 2, 3, ou 4 according to this:
    - ROTATION_0 = 0
    - ROTATION_90 = 1 // this is what you want here
    - ROTATION_180 = 2
    - ROTATION_270 = 3

    There are different solutions to achieve what you want:

    1) create an Android application with android.permission.WRITE_SETTINGS permission, and execute the following code:
    Settings.System.putInt(this.contentResolver, Settings.System.ACCELEROMETER_ROTATION, 0);
    Settings.System.putInt(this.contentResolver, Settings.System.USER_ROTATION, Surface.ROTATION_90);

    2) on the running system: update the settings.db using sqlite:
    /system/xbin/sqlite3 /data/data/com.android.providers.settings/databases/settings.db
    insert into system (name,value) values('accelerometer_rotation',0);
    insert into system (name,value) values('user_rotation',1);
    .exit

    3) before build, in your device/<your device folder>/ add an overlay onto the framework file: "frameworks/base/packages/SettingsProvider/res/values/defaults.xml" and update this version with the appropriate rotation value using the keys:
    - <integer name="def_user_rotation">1</integer>
    - <bool name="def_accelerometer_rotation">false</bool>

    Regards
  • Hi Team,

    First I am truly grateful for your quick response.
    I did the above using the Build option(No. 3) .But found that. When i click on the Settings Bar then only the screen gets rotated.
    We want to rotate it from the start i.e bootanimation must also be displayed after rotation(Default Display Condition in our case)

    Regards
  • Hello Team,
    Here i am mentioning some more updates from my side.
    I have configured as said above but the screen is also not aligned.
    Kindly please provide help for this questions also.

    1. How to change the screen resuolution (to fit the android screen in touchscreen size)?
    2.Also want to enable the Navigation Bar with this touchscreen after rotating it to 90 degree.What i have to do for that ??
    3.I am facing some compilation related problems.As when i change the above config.I am not able to see the change.
    I am currently configuring it with the sqlite method you mentioned.
    Command for compilation
    make TARGET_PRODUCT=beaglebone droid -j4
    for recompiling the changes.

    4.Any specifc things to be i should aware of for compilation of specific changes and its dependencies.


    Thanks !!!
    Regards
    Nitish
  • Hi Nitish,

    Which the two attached patches you should be able to have Android rotated as you want.
    It introduces a new variable ro.sf.hwrotation , which can be set to 0, 90, 180, or 270.
    0001-Set-rotation-to-90-by-default.patch is a patch for device/ti/am335xevm_sk/
    0001-Added-ro.sf.hwrotation-support.patch is a path for frameworks/base/

    The only missing part is the boot screen, we should look into the kernel for that.
    As for you other questions :
    1. The screen resolution is defined in the kernel in the mx23evk_video_modes structure (kernel/arch/arm/mach-mxs/mach-mx23evk.c).
    But you should not have to modify it. The touchscreen doesn't follow the screen resolution, it has its own resolution.

    2. To enable the Navigation Bar, modify device/ti/am335xevm_sk/init.am335xevm.rc and add, in the init section:
    setprop lcd.landscape true

    And modify the  overlay/frameworks/base/core/res/res/values/config.xml file:
    <bool name="config_showNavigationBar">true</bool>

    3. Have you tried to do make TARGET_PRODUCT=beaglebone -j4 ?

    3527.add_rotation_support.tar.gz

  • Hello Team ,

    First of all thank you for the above solution.It works fine.
    Also i am trying to look into kernel for boot animation to get rotated initially.
    Meanwhile ,from your side if you find solution for it.Please let me know.

    Regards
    Nitish Mehta