Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,742,912 Members 40,470 Now Online
XDA Developers Android and Mobile Development Forum

[How-to] auto-switch to 1080p on slimport, using tasker

Tip us?
 
cpanos
Old
(Last edited by cpanos; 18th July 2014 at 11:20 AM.)
#1  
cpanos's Avatar
Senior Member - OP
Thanks Meter 296
Posts: 335
Join Date: Nov 2012
Location: Athens
Default [How-to] auto-switch to 1080p on slimport, using tasker

Both the nexus 4 and the nexus 7 (2013) support slimport, which is very useful for mirroring the device to a big screen. However, neither device uses the standard 16:9 (1080p) aspect ratio. As a result, you end up with some cropping on a 1080p TV. For the nexus 4 it is even worse, since it outputs 768p upscaled to the TV's resolution.

However, the flexibility of android allows us to manually change the native resolution. In a console, we can type the command:

wm size 1080x1920

and the resolution will change. In the device screen the new resolution will look odd, however you now have true 1080p on the TV. To get back to the default resolution you type:

wm size reset

This solution works, but it is not very convenient. So I made two profiles for tasker, that automatically change the device resolution upon the connection of an HDMI cable and reset it when the cable is disconnected, thus automating the whole process.

I 'm attaching a screenshot of the two profiles, as well as a zip file so you can extract and import them in tasker.

In summary,
- you need root
- you need a ppi setting lower than 288 otherwise the navbar disappears

the HDMI plugged profile
- reduces the device brightness to minimize battery consumption
- increases volume
- sets resolution to 1080p
- enables WiFi
- sets display timeout to 10 hours
- activates display rotation

the HDMI un-plugged profile
- sets auto brightness back on
- resets screen resolution
- sets display timeout to 1min

These are optional settings that I found useful to automate, but they are all optional, and you can tweak them once you imported the profile to tasker.

I hope you find this useful!!!

UPDATE: Your device must be set to a ppi lower than 288. I am using 286 myself. To change your ppi:
Open the build.prop file from /system/build.prop
using a text editor/buildprop editor app, change the value of ro.sf.lcd_density=286
save the file, reboot
Attached Thumbnails
Click image for larger version

Name:	HDMI_plugged.png
Views:	366
Size:	42.5 KB
ID:	2804123   Click image for larger version

Name:	HDMI_unplugged.png
Views:	300
Size:	28.4 KB
ID:	2804124  
Attached Files
File Type: zip auto_slimport_tasker.zip - [Click for QR Code] (1.1 KB, 44 views)

Phone: Nexus 4 (E960)
ROM: android 4.4.4
Kernel: ak
Recovery: TWRP 2.7.1.0
Launcher: Nova launcher Prime

Other devices: Nexus 7 LTE (2013)
Previous devices: Nexus S (i9023)
The Following 8 Users Say Thank You to cpanos For This Useful Post: [ Click to Expand ]
 
petanque
Old
#2  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Sep 2012
Default dont work anymore

Thanks for sharing.. It worked for me in a long time but not it wont change anymore..

Do you know what i could get a conflict? have just installed apps and then last night i wont change resolution when i connect slimport and i cant seem to fix it
 
Q8-V08
Old
#3  
Member
Thanks Meter 11
Posts: 87
Join Date: Oct 2013
Thanks for this, I tried testing the wm size reset command in terminal emulator but for some reason the navbar icons disappear and only come back when I Power Off and restart the device again, I'm on 4.4.4 if it makes any difference.
 
cpanos
Old
#4  
cpanos's Avatar
Senior Member - OP
Thanks Meter 296
Posts: 335
Join Date: Nov 2012
Location: Athens
Quote:
Originally Posted by petanque View Post
Thanks for sharing.. It worked for me in a long time but not it wont change anymore..

Do you know what i could get a conflict? have just installed apps and then last night i wont change resolution when i connect slimport and i cant seem to fix it
Make sure tasker is still active and root is working fine.




Quote:
Originally Posted by Q8-V08 View Post
Thanks for this, I tried testing the wm size reset command in terminal emulator but for some reason the navbar icons disappear and only come back when I Power Off and restart the device again, I'm on 4.4.4 if it makes any difference.
I don't have that issue, however I'm also running at a lower PPI than the default. I'll try it out at stock PPI and see if I have any issues with the navbar. What is your setup? ROM, xposed, etc.

Sent from my Nexus 4 using Tapatalk

Phone: Nexus 4 (E960)
ROM: android 4.4.4
Kernel: ak
Recovery: TWRP 2.7.1.0
Launcher: Nova launcher Prime

Other devices: Nexus 7 LTE (2013)
Previous devices: Nexus S (i9023)
 
Q8-V08
Old
#5  
Member
Thanks Meter 11
Posts: 87
Join Date: Oct 2013
Quote:
Originally Posted by cpanos View Post
Make sure tasker is still active and root is working fine.






I don't have that issue, however I'm also running at a lower PPI than the default. I'll try it out at stock PPI and see if I have any issues with the navbar. What is your setup? ROM, xposed, etc.

Sent from my Nexus 4 using Tapatalk
Stock rooted, qc optimized bionic+dalvik, latest dev preview gpu driver.
For the navbar to showup on my 40" tv in 1920x1080 I have to set the ppi to 288, 289+ it's hidden.
Using
https://www.sven.de/dpi/
http://pixeldensitycalculator.com
http://isthisretina.com
all say my ppi should be 55.07 though.
The Following 2 Users Say Thank You to Q8-V08 For This Useful Post: [ Click to Expand ]
 
cpanos
Old
#6  
cpanos's Avatar
Senior Member - OP
Thanks Meter 296
Posts: 335
Join Date: Nov 2012
Location: Athens
Quote:
Originally Posted by Q8-V08 View Post
Stock rooted, qc optimized bionic+dalvik, latest dev preview gpu driver.
For the navbar to showup on my 40" tv in 1920x1080 I have to set the ppi to 288, 289+ it's hidden.
Using
https://www.sven.de/dpi/
http://pixeldensitycalculator.com
http://isthisretina.com
all say my ppi should be 55.07 though.
Thanks, I'm running on a ppi of 286 and everything works fine here as well. I will update the op to let people know that their ppi must be lower than 288 and add instructions on how to set that.

Im not sure if I can have the ppi change with tasker, however, people might be using a lower ppi permanently so having tasker switch it back to the default would suck.

Phone: Nexus 4 (E960)
ROM: android 4.4.4
Kernel: ak
Recovery: TWRP 2.7.1.0
Launcher: Nova launcher Prime

Other devices: Nexus 7 LTE (2013)
Previous devices: Nexus S (i9023)
The Following User Says Thank You to cpanos For This Useful Post: [ Click to Expand ]
 
Ja_som
Old
#7  
Ja_som's Avatar
Senior Member
Thanks Meter 225
Posts: 648
Join Date: Apr 2013
Location: Banská Bystrica, Slovakia

 
DONATE TO ME
Hi, thanks for this profiles... I don't have HDMI, but will this wm command work also with ChromeCast?
Google Nexus 7 (2nd gen.) 16GB rooted KitKat 4.4.4 + GravityBox / Android L preview on MultiRom

&

Motorola Moto G rooted KitKat 4.4.4 GPE + GravityBox


Slovenčina pre Moto G/Slovak language for Moto G TU/HERE
The Following User Says Thank You to Ja_som For This Useful Post: [ Click to Expand ]
 
jblaze10
Old
#8  
jblaze10's Avatar
Senior Member
Thanks Meter 98
Posts: 232
Join Date: Mar 2012
Location: Gold Canyon,Az
Quote:
Originally Posted by Ja_som View Post
Hi, thanks for this profiles... I don't have HDMI, but will this wm command work also with ChromeCast?
Bump, I would like to know this as well!! Tia.

Sent from my Nexus 7 using Tapatalk
 
Ja_som
Old
#9  
Ja_som's Avatar
Senior Member
Thanks Meter 225
Posts: 648
Join Date: Apr 2013
Location: Banská Bystrica, Slovakia

 
DONATE TO ME
Quote:
Originally Posted by jblaze10 View Post
Bump, I would like to know this as well!! Tia.

Sent from my Nexus 7 using Tapatalk
I tested it yesterday. I changed size with command from OP, but there was problem with navbar, I lost navbar in landscape mode, it appears only in portrait mode. When I played video in MX Player I could not go back...
This is maybe because of ppi, which I did not change.

Sent from my tablet./Odoslané z môjho tabletu.
Google Nexus 7 (2nd gen.) 16GB rooted KitKat 4.4.4 + GravityBox / Android L preview on MultiRom

&

Motorola Moto G rooted KitKat 4.4.4 GPE + GravityBox


Slovenčina pre Moto G/Slovak language for Moto G TU/HERE
 
cpanos
Old
#10  
cpanos's Avatar
Senior Member - OP
Thanks Meter 296
Posts: 335
Join Date: Nov 2012
Location: Athens
Quote:
Originally Posted by Ja_som View Post
Hi, thanks for this profiles... I don't have HDMI, but will this wm command work also with ChromeCast?
Quote:
Originally Posted by jblaze10 View Post
Bump, I would like to know this as well!! Tia.

Sent from my Nexus 7 using Tapatalk
Interesting. You mean when mirroring the device to a chromecast? I dont see why this should not work, I will test it and report back, on vacations now

Quote:
Originally Posted by Ja_som View Post
I tested it yesterday. I changed size with command from OP, but there was problem with navbar, I lost navbar in landscape mode, it appears only in portrait mode. When I played video in MX Player I could not go back...
This is maybe because of ppi, which I did not change.

Sent from my tablet./Odoslané z môjho tabletu.
Yes, you lost the navbar because of your ppi setting. Either change your ppi to anything lower than 288 or use a pie navbar app like LMT (havent tried that though).

I havent found a way to change ppi without the need to reboot the device so I can add it to the tasker profile.

Phone: Nexus 4 (E960)
ROM: android 4.4.4
Kernel: ak
Recovery: TWRP 2.7.1.0
Launcher: Nova launcher Prime

Other devices: Nexus 7 LTE (2013)
Previous devices: Nexus S (i9023)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes