Power & Source of Big Ideas

Landscape display with Android 8

Moderators: chensy, FATechsupport

I've managed to rotate the display so that Android comes up in Landscape but the touch does not rotate. Touching the right centre of the display appears at the bottom centre.

I set the following property in /device/rockchip/rk3399/device.mk

ro.sf.hwrotation=90

It was 0 for portrait mode.

Anyone know how to get the touch to also rotate? It should have been automatic and taken care of by the OS but doesn't seem to be. On the Nano PC T3 Plus that I also use, this works fine.
It's a brand new installation using the SD card after I write this to the eMMC memory so it should work straight off.

I did find some info about an issue with this on older Android versions but you'd think that 8.1 would have the patch to fix this. Looking at the drivers, there is code to rotate the touch so not sure why it is not working here.
I managed to fix this temporarily until I can work out how to do this without hard coding it.

I edited InputReader.cpp to hard code the display to landscape. I have no need for portrait at all.

I also managed to enable screen/sleep off without resorting to putting the device into debug mode but enabling the debugging.
Where did you find inputreader.cpp?

Thank you!
Daitaro wrote:
Where did you find inputreader.cpp?


In the Android kernel source for the RK3399.

Do a search for it from the root of the source tree.
Yeah it took a while, but I did find it after remembering that feature.

Which line did you edit to hardcode landscape?
Daitaro wrote:
Yeah it took a while, but I did find it after remembering that feature.

Which line did you edit to hardcode landscape?


It's in the actual Android framework but you already found it.

I added the following line of code after the comment TEST in 2 places.

Code starts at line 190

Code: Select all

static void rotateDelta(int32_t orientation, float* deltaX, float* deltaY) {
    float temp;
//
// TEST
//
    orientation = DISPLAY_ORIENTATION_90;

    switch (orientation) {
    case DISPLAY_ORIENTATION_90:
        temp = *deltaX;
        *deltaX = *deltaY;
        *deltaY = -temp;
        break;

    case DISPLAY_ORIENTATION_180:
        *deltaX = -*deltaX;
        *deltaY = -*deltaY;
        break;

    case DISPLAY_ORIENTATION_270:
        temp = *deltaX;
        *deltaX = -*deltaY;
        *deltaY = temp;
        break;
    }
}


Code starts at line 3754

Code: Select all

        if (mDeviceMode == DEVICE_MODE_DIRECT || mDeviceMode == DEVICE_MODE_POINTER) {
            // Convert rotated viewport to natural surface coordinates.
            int32_t naturalLogicalWidth, naturalLogicalHeight;
            int32_t naturalPhysicalWidth, naturalPhysicalHeight;
            int32_t naturalPhysicalLeft, naturalPhysicalTop;
            int32_t naturalDeviceWidth, naturalDeviceHeight;
//
// TEST
//
       mViewport.orientation = DISPLAY_ORIENTATION_90;

            switch (mViewport.orientation) {
            case DISPLAY_ORIENTATION_90:
                naturalLogicalWidth = mViewport.logicalBottom - mViewport.logicalTop;
@v8dave: Thank you for sharing!
I just modified my InputReader.cpp according to the previous post, and I see the screen as expected in Landscape mode, but the touchscreen being in Portrait mode.
In post #1 you mentioned the same issue, how did you resolve this?

Surprisingly without the changes in InputReader.cpp both Screen and Touscreen are 'aligned', but some applications seem to demand Portait-mode which does not fit to my screen.

Same like you, I only need Landscape mode.

Thanks!
The changes to InputReader.cpp will fix the touch screen for Landscape more. It's not the ideal way but seems to be the only way I could get it to work in Landscape mode.

There is also a setting somewhere in the XML files that tell the system it should only offer Landscape mode only. Can't recall exactly where though.
Thanks for the fast reply!
Will find it ...
I understand that changes in InputReader.cpp only influence the touch-screen.

The screen rotation can be disabled in 'frameworks/base/core/res/res/values/config.xml' by "<bool name="config_forceDefaultOrientation">true</bool>" **) and "<bool name="config_supportAutoRotation">false</bool>" .
**) : Flag indicating that this device does not rotate and will always remain in its default orientation. Activities that desire to run in a non-compatible orientation will be run from an emulated display within the physical display.

My device can also tell apps that it only supports landscape mode by deleting 'frameworks/native/data/etc/android.hardware.screen.portrait.xml'.

Now all my screens are in landscape mode, with the touchscreen aligned but for some apps and views of the contents is cut off:
(https://imgur.com/rOgFqBE)
The Notification bar seems to have the right width, app 2/3 of the screen are cut off, there is also no touch recorded at this 'black' area.

Any idea how to fix this?
Thank's for this fast replys guys... :)
Thanks for your replies authorityapk.com tubemate get-mobdro.com
Tiemichael wrote:

Now all my screens are in landscape mode, with the touchscreen aligned but for some apps and views of the contents is cut off:
(https://imgur.com/rOgFqBE)
The Notification bar seems to have the right width, app 2/3 of the screen are cut off, there is also no touch recorded at this 'black' area.

Any idea how to fix this?



Did you ever find a solution to this?
Daitaro wrote:
Tiemichael wrote:

Now all my screens are in landscape mode, with the touchscreen aligned but for some apps and views of the contents is cut off:
(https://imgur.com/rOgFqBE)
The Notification bar seems to have the right width, app 2/3 of the screen are cut off, there is also no touch recorded at this 'black' area.

Any idea how to fix this?



Did you ever find a solution to this?

I'm also experiencing the bug, but in my case, it happens in an app that is completely in portrait mode and only when activities that have been called with startActivityForResult() return their result (so we go back to the caller activity).
No, I never found a solution to this ...

I overcame this issue by pre-installing a landscape-manager app, which needs to be configured at first boot.

Working reasonable well
Thanks, I gave it a try as well, and it worked for me! I was getting really frustrated with this one...
Briggs wrote:
Daitaro wrote:
Tiemichael wrote:

Now all my screens are in landscape mode, with the touchscreen aligned but for some apps and views of the contents is cut off:
(https://imgur.com/rOgFqBE)
The Notification bar seems to have the right width, app 2/3 of the screen are cut off, there is also no touch recorded at this 'black' area.

Any idea how to fix this?



Did you ever find a solution to this?

I'm also experiencing the bug, but in my case, it happens in an app that is completely in portrait mode and only when activities that have been called with startActivityForResult() return their result (so we go back to the caller activity).

i agree to post .
Tiemichael wrote:
I understand that changes in InputReader.cpp only influence the touch-screen.

The screen rotation can be disabled in 'frameworks/base/core/res/res/values/config.xml' by "<bool name="config_forceDefaultOrientation">true</bool>" **) and "<bool name="config_supportAutoRotation">false</bool>" .
**) : Flag indicating that this device does not rotate and will always remain in its default orientation. Activities that desire to run in a non-compatible orientation will be run from an emulated display within the physical display.

My device can also tell apps that it only supports landscape mode by deleting 'frameworks/native/data/etc/android.hardware.screen.portrait.xml'.

Now all my screens are in landscape mode, with the touchscreen aligned but for some apps and views of the contents is cut off:
(https://imgur.com/rOgFqBE)
The Notification bar seems to have the right width, app 2/3 of the screen are cut off, there is also no touch recorded at this 'black' area.

Any idea how to fix this?

Same happened with me on app. But after researching on it. I solved.
v8dave wrote:
The changes to InputReader.cpp will fix the touch screen for Landscape more. It's not the ideal way but seems to be the only way I could get it to work in Landscape mode.

There is also a setting somewhere in the XML files that tell the system it should only offer Landscape mode only. Can't recall exactly where though.

tweaking InputReader.cpp for improved touch screen functionality in Landscape mode are valuable for troubleshooting. While it may not be the ideal solution, sometimes it's the practical one. Mentioning a setting in XML files for exclusive Landscape mode adds another layer of customization. Thanks for sharing your expertise!Fm Whatsapp Download
Leveraging the landscape display feature in Android 8 enhances user experience by providing a broader, more immersive view. Whether gaming, watching videos, or multitasking, the landscape mode optimizes visual engagement, showcasing the versatility and user-centric design of the Android 8 operating system.
For landscape display on Android 8, ensure your app's layout accommodates both portrait and landscape orientations. Leverage the "res/layout-land" folder for landscape-specific XML layouts. Test thoroughly on various devices to guarantee a seamless user experience, providing flexibility for users who prefer different screen orientations.
For landscape display on Android 8, ensure your app's layout accommodates both portrait and landscape orientations. Leverage the "res/layout-land" folder for landscape-specific XML layouts. Test thoroughly on various devices to guarantee a seamless user experience, providing flexibility for users who prefer different screen orientations.
Tiemichael wrote:
I understand that changes in InputReader.cpp only influence the touch-screen.

The screen rotation can be disabled in 'frameworks/base/core/res/res/values/config.xml' by "<bool name="config_forceDefaultOrientation">true</bool>" **) and "<bool name="config_supportAutoRotation">false</bool>" .
**) : Flag indicating that this device does not rotate and will always remain in its default orientation. Activities that desire to run in a non-compatible orientation will be run from an emulated display within the physical display.

My device can also tell apps that it only supports landscape mode by deleting 'frameworks/native/data/etc/android.hardware.screen.portrait.xml'.

Now all my screens are in landscape mode, with the touchscreen aligned but for some apps and views of the contents is cut off:
(https://imgur.com/rOgFqBE)
The Notification bar seems to have the right width, app 2/3 of the screen are cut off, there is also no touch recorded at this 'black' area.

Any idea how to fix this?

Thanks for share good informetion.

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 3 guests