[REQUEST] Magisk to set orientation - Android Head Unit - Magisk

On Android head units, the orientation typically defaults to landscape. And has disabled auto-rotation, the screen will always remain in a landscape mode. This effectively means you can't use any software on Google Play Store or other places to change this default because auto-rotation is disabled (they at best, can reverse the screen but cannot rotate it). I need to change this feature to portrait for the custom firmware I placed on my head unit (which is using Android 10).
In my attempts to work out how to do this, I have gathered some information, but I have not got enough experience or knowledge to know how to do this. I really need some with experience who likes these challenges.
I believe in order to do this correctly, this needs to be done at root, and place in one of these locations in Magisk
(1) /data/adb/post-fs-data.d (think it needs to be here)
or
(2) /data/adb/service.d/
and the command syntax would look it something like this (3)
adb shell settings put system accelerometer_rotation 0 # auto-rotation, 0 disable, 1 enable
adb shell settings put system user_rotation 0 # actual-rotation, clockwise, options 0[0°], 1[90°],2[180°],3[270°]
source:- https://stackoverflow.com/questions/25864385/changing-android-device-orientation-with-adb
or (4)
content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0
or (5)
import android.provider.Settings;
// You can get ContentResolver from the Context
Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0);
Settings.System.putInt(getContentResolver(), Settings.System.USER_ROTATION, 0);
or something else (Other source documents)
How to change Android default-natural orientation?
I have my device running android Jellybean 4.2.2 with Landscape as the default/natural orientation. How can I change the default/natural orientation of the same to portrait? Here is what I have t...
android.stackexchange.com
Disable Screen Rotation Landscape Mode in Android React Native
Disable Screen Rotation Landscape Mode in Android React Native. This tutorial explains how to disable screen rotation landscape mode in android react native application. There are two different types of orientation in android device, Portrait mode and Landscape mode. Portrait mode is default...
www.skptricks.com
Set Android default orientation to portrait mode - Boundary Devices
The default screen orientation for the Android-ready Nitrogen and Nitrogen53 is landscape. That’s fine for most people, but say you want it in portrait. Or upside down, or whatever. That’s a problem, since Android usually takes rotation instructions from code that expects motion sensor input...
boundarydevices.com
or (6)
There is an existing module I should be using ?
Thank you for any time you invest on this.

I have also been wondering if Magisk can do this, would be of value to have the ability to inject landscape or portrait as default, and the ability to turn on/off auto rotate would make this more appealing/useful code for developers and fix my issue?
Anyway, just an idea without the skill/knowledge to make it happen.

Related

[APP] Native screen rotate applications

i wrote two applications that provide screen rotations in different scenarios.
the first one (rotexec) rotates the screen in a particularly orientation and executes an application, then restores the orientation on exit.
the second one (devomon) polls the accelerometer and updates the screen orientation.
i know there are already applications out there that handle these tasks, but the ones i found all ran on the .net vm.
my goal here was to minimize the memory footprint, something not possible with managed languages.
for devomon.. with 4 filtered applications, it consumes about 52 KB of heap space.
the new version of devomon (with a gui):
http://www.megaupload.com/?d=LCOWUDF4
rotexec and devomon w/o a gui (don't use it):
http://www.megaupload.com/?d=DL58WVU4
project is hosted at SourceForge.. i haven't committed the newer changes though.
----
rotexec is intended for use with shortcuts, although if you use it more than once you might have a hard time distinguishing when all have the same damn icon.
the command-line format is...:
Code:
rotexec <direction>|<full_path_to_exe>[|<args]
<direction> indicates the side the top of the window touches and can be either N, S, E, or W
you can quote the individual items (i.e., "N" vs. N), but not the entire string.
* the orientation is set for the duration of the program, regardless of whether or not it owns the foreground window.
example shortcut:
Code:
88#"\Storage Card\rotexec.exe" W|\Storage Card\Program Files\Navigator\TomTom Navigator.exe
----
devomon reads the output of the accelerometer using htcsensorsdk.dll.
* the screen orientation is changed for all applications except those in the filter list.
* if the keyboard is out, no orientation changes are made.
* filters cannot be persisted at this time.
devomon now has a gui.
I'd just like to say a TON of thanks to this program. It works GREAT. I use it for Remote Desktop. I always want it rotated portrait, without the keyboard open, and now it does!
In addition, I would like to add a recommendation for modifying the shortcut icons. This app that I have attached is called Shortcut Creator, and it allows you to pull up any shortcut, and specify an icon from any .EXE on the device!

Is it possible to change the default landscape orientation?

Here is what I mean:
When using portrait and launching an app that forces landscape (most games, for example), it always defaults to 90 degree rotation (ie. Turning the phone counterclockwise). With the SGS in a lot of games this is uncomfortable when plugged in because of the USB port's location. If the other landscape orientation (270 degrees I guess, or turning the phone clockwise from portrait) were used the cable would be on top and you could rest your hand beneath it. It would also have the advantage of your hand not covering the light sensor and causing brightness changes.
So my question is, is there an app that can force this globally, or maybe a configuration change I've missed?
I dont think thats possible
but i guess a software can be built cosidering the fact that our captivate supports landscape in both directions in other apps and while reading and browsing on net
I've seen posts about orientation settings in build.prop but they were all froyo. I've also read that since gb there is a screenOrientation= reverseLandscape option for individual apps' AndroidManifest.xml file, so editing them individually should work. Just makes me think there must be a value somewhere that defines what the default landscape orientation is, just don't know if it's compiled or easy to modify.
If anyone is interested, there's an app on market called Orientation Control that can force orientation, even has a tasker plugin. I created a tasker profile for apps that force landscape and used the plugin to force reverse
landscape instead, then an exit task to set it back to portrait. Works perfectly
Sent from my SGH-I897 using xda premium

*Application Settings Screen* flickers when entering the App's Settings screen

Problem:
Application Settings Screen flickers in certain Apps when first entering the Application's Settings. THIS ONLY HAPPENS IN PORTRAIT Mode. It does not happen in Landscape.
Cause:
The device may have non-standard fonts or font sizes that are not properly utilized by some applications.
I am using default fonts with an application called Big Font to enlarge font-size to 120%. When I reduce font-size to normal size (100%), the problem no longer occurs.
Temporary Solution:
1) Tilt the device to Landscape mode and flickering should stop. Then you can return to Portrait mode.
2) Reset your fonts to normal fonts and/or normal font-size.
3) Enter the application's Settings screen in Landscape first, then rotate device to Portrait if necessary.
To date I have encountered this issue with stock Samsung Internet Browser v.2.3.3 (Gingerbread-KG3), HDR Camera+ 2.16, and PowerAMP (multiple versions).
I hope this is helpful to others that may encounter this issue.

BLU VIVO XL3 Guide to change DPI, Stop Background Apps and hide (Debloat) apps

I just picked up a VIVO XL3 running Marchmallow. It's a bit of a mess with bugs but here are a couple things you might find useful. Connect to the phone using ADB and USB Debugging from a PC. (Nothing special -- see other guides on how to do this.)
One Note: this phone is pretty insecure -- it seems to have no incorrect fingerprint limit (Where it will require a password/PIN.) I recommend you go into Settings -> Security and enable Require password at boot. Otherwise, even on reboot, you do not need a password ever -- the fingerprint will unlock it right away.
Anyway, onto the guide. Use ADB and open up a shell to the phone: (adb shell)
------
To see a list of apps that can run in the background run:
appops query-op RUN_IN_BACKGROUND allow
To set a particular app to not run in the background: (replace package-name below with a package from the list above.)
appops set package-name RUN_IN_BACKGROUND ignore
Example:
appops set net.slickdeals.android RUN_IN_BACKGROUND ignore
------
To hide (Debloat an app)
Unfortunately, this doesn't work on this phone. This won't be possible without root.
Trying to hide an app with "pm hide" command will give you this error:
Error: java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_USERS.
------
Since there is no way to change the screen DPI in the settings app, you can do it in ADB. The stock density setting is 360 and that makes everything way too big for my taste. The smaller the number, the smaller things get on the screen. I find 280 is a good setting and you can fit a lot more on the screen while my old eyes can still read it. I also set the font size to smallest in the settings app.
wm density 280
I did notice if I got too low system_ui crashes. Before you reboot the phone you MUST reset the DPI otherwise the phone may not boot back up again!! System_ui can crash and you'll still be on on the ADB connection:
wm density reset
Reboot after making changes.... although feel free to poke around to make sure you like the setting.
Thank you for posting this. The DPI setting helps tremendously because holy cow...
I'm curious if anyone knows where to get TWRP recovery image. I wish I could install Magisk on it.
Blu Vivo XL3+ change dpi in develpers options w/ no mod
adrianblack said:
I just picked up a VIVO XL3 running Marchmallow. It's a bit of a mess with bugs but here are a couple things you might find useful. Connect to the phone using ADB and USB Debugging from a PC. (Nothing special -- see other guides on how to do this.)
One Note: this phone is pretty insecure -- it seems to have no incorrect fingerprint limit (Where it will require a password/PIN.) I recommend you go into Settings -> Security and enable Require password at boot. Otherwise, even on reboot, you do not need a password ever -- the fingerprint will unlock it right away.
Anyway, onto the guide. Use ADB and open up a shell to the phone: (adb shell)
------
To see a list of apps that can run in the background run:
appops query-op RUN_IN_BACKGROUND allow
To set a particular app to not run in the background: (replace package-name below with a package from the list above.)
appops set package-name RUN_IN_BACKGROUND ignore
Example:
appops set net.slickdeals.android RUN_IN_BACKGROUND ignore
------
To hide (Debloat an app)
Unfortunately, this doesn't work on this phone. This won't be possible without root.
Trying to hide an app with "pm hide" command will give you this error:
Error: java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_USERS.
------
Since there is no way to change the screen DPI in the settings app, you can do it in ADB. The stock density setting is 360 and that makes everything way too big for my taste. The smaller the number, the smaller things get on the screen. I find 280 is a good setting and you can fit a lot more on the screen while my old eyes can still read it. I also set the font size to smallest in the settings app.
wm density 280
I did notice if I got too low system_ui crashes. Before you reboot the phone you MUST reset the DPI otherwise the phone may not boot back up again!! System_ui can crash and you'll still be on on the ADB connection:
wm density reset
Reboot after making changes.... although feel free to poke around to make sure you like the setting.
Click to expand...
Click to collapse
If you do into deveoplers option there one called "smallest width" in "drawing" section just under "networking" where you set USB to MTP.PTP or charging. Default setting was 360. Ive tryed 360, 420, 480, 720. All work well - Display adapts in seconds w/o reboot. When you go from 720 back down to 480 it asks you to reboot. No need to worry anymore if you an MOD or if your gonna soft brick. Personnally I like 480 with font size et to small (720 is great for watching vids and probably gaming - but leaves everything to small for day to day use, unless you have miget baby finger)
PScript - Im useing Microsoft Launcher instead of stock Launcher (See Screen Shots)

Pi4 Display upside down

Recently switched my Pi4 over to the 64 bit Pi OS. I have a 7" Raspberry monitor that is displaying upside down so I have to turn my monitor 180. I tried display_rotate=2 in config.txt but no joy. Then I tried lcd_rotate=2 but still no joy. Then I tried display_rotate=2 AND lcd_rotate=2 in the config.txt During the reboot process I got a very short display that was correct but when it finished the reboot I was right back to being upsidedown. This was not an issue when I was running Raspbian Buster, the previous OS. Any fix or suggestions are greatly appreciated.
In the terminal
sudo nano /boot/config.txt
Then add the line:
lcd_rotate=2
Thats what is seen on the forums
Open the Terminal screen.
Access the config file using sudo nano /boot/config.txt
Enter a new line with the text display_rotate=2 (CASES OF NON-TOUCH DISPLAYS)
Press CONTROL+X then Y then ENTER to Save
Type sudo reboot to reboot and your LCD will be rotated!
To set screen orientation when in console mode, you will need to edit the kernel command line to pass the required orientation to the system.
sudo nano /boot/cmdline.txt
To rotate by 90 degrees clockwise, add the following to the cmdline, making sure everything is on the same line, do not add any carriage returns. Possible rotation values are 0, 90, 180 and 270.
video=DSI-1:[email protected],rotate=90
—— assuming you dont have a built in display and you are using HDMI?
The DSI text should be changed to HDMI
FOR NON TOUCH DISPLAYS
———
Launch the terminal and execute the commandaccording to the rotation you want.
DISPLAY=:0 xrandr --output HDMI-1 --rotate right
DISPLAY=:0 xrandr --output HDMI-1 --rotate left
DISPLAY=:0 xrandr --output HDMI-1 --rotate inverted
To reset rotation back to normal, use the command
DISPLAY=:0 xrandr --output HDMI-1 --rotate normal
Kenora_I said:
Open the Terminal screen.
Access the config file using sudo nano /boot/config.txt
Enter a new line with the text display_rotate=2 (CASES OF NON-TOUCH DISPLAYS)
Press CONTROL+X then Y then ENTER to Save
Type sudo reboot to reboot and your LCD will be rotated!
Click to expand...
Click to collapse
Thanks for the reply. However, I tried this and it did not rotate.
Kenora_I said:
To set screen orientation when in console mode, you will need to edit the kernel command line to pass the required orientation to the system.
sudo nano /boot/cmdline.txt
To rotate by 90 degrees clockwise, add the following to the cmdline, making sure everything is on the same line, do not add any carriage returns. Possible rotation values are 0, 90, 180 and 270.
video=DSI-1:[email protected],rotate=90
—— assuming you dont have a built in display and you are using HDMI?
The DSI text should be changed to HDMI
Click to expand...
Click to collapse
I am not using HDMI. As I mentioned, I'm using the official 7" Raspberry non-touch display.

Categories

Resources