How to determine the actual resolution and dpi of client

Discussions related to using VirtualBox on Windows hosts.
Post Reply
predatorftp
Posts: 9
Joined: 29. Apr 2015, 06:37

How to determine the actual resolution and dpi of client

Post by predatorftp »

Hello,

This is a weird question if have been playing with for a few days now, hope you guys can help:
Host - Windows 7 pro 64bit
Vbox - 4.3.12
Client - Droid4x android custom version

Description of the problem: Vbox allow setting the window size (resolution of the client) in the .vbox file using the dedicated property. this will define the window \ resolution size of the guest system (android in this case).
if setting a portrait mode 720x1280 resolution, vbox encounter the simple issue - real monitor resolution is FHD - 1920x1080 so only 1080 rows in actual hosting screen - so it will resize the window to fit and it does it automatically - all good so far.

I would like to find a way to know whats the actual window size (resolution) and actual DPI is being used. so i can reproduce it on different computers and different host resolutions.
for example "VBoxManage guestproperty set Droid4x.ova vbox_dpi 320" will allow you to change the dpi value (while vbox is shut off) but even tho a value of 320 is set when starting the client it will change and vbox will resize the window to fit host physical size (resolution).

I may be wrong on some of the assumptions i made so please feel free to correct me !
Hope the question is clear enough.
Last edited by predatorftp on 30. Dec 2015, 13:57, edited 1 time in total.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: How to determine the actual resolution and dpi of client

Post by loukingjr »

This forum doe not actually support DroidX or Android or whatever "Vbox - 4.3.12 (Droid4x version)" is.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
predatorftp
Posts: 9
Joined: 29. Apr 2015, 06:37

Re: How to determine the actual resolution and dpi of client

Post by predatorftp »

that info was just for context. please ignore it, and address the question asked.

how to determine the resolution and dpi vbox is using in a current (maybe running) instance ?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to determine the actual resolution and dpi of client

Post by scottgus1 »

I don't think there is a Virtualbox way to solve your problem. There's a list of info about a guest you can get with this command run on the host while the guest is running:

Code: Select all

VBoxManage guestproperty enumerate "<VM-name>"
Replace the <VM-name> with the exact name of your guest, including upper and lower case.

However, some of the more important info comes from Guest Additions, and there are no Guest Additions for Android guests.

If you try the command and see DPI and screen resolution listed, then there you go. If not, you'll have to try an in-the-guest script that drops a text file with the desired info on the host through whatever network you are able to set up.

Also, there's a setting in the guest's Virtualbox View Menu, "Auto Resize Guest Display", which when unchecked should stop the guest display from resizing to the host screen.
predatorftp
Posts: 9
Joined: 29. Apr 2015, 06:37

Re: How to determine the actual resolution and dpi of client

Post by predatorftp »

thank you for the detailed response.
VBoxManage guestproperty enumerate gets it's info from the .vbox file of the instance.
so it's "only" the declared info and not the actual info. it dealers 720x1280 but clearly my screen only has 1080 lines ... and window was resized so for sure the info given is incorrect !

I would love a "script" or a way to do it from within the client running OS - Android - if any one has or know of a way to do it, I would much appreciate it !

Thanks.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to determine the actual resolution and dpi of client

Post by scottgus1 »

predatorftp wrote:VBoxManage guestproperty enumerate gets it's info from the .vbox file of the instance.
so it's "only" the declared info and not the actual info.
True. If no Guest Additions are present, all "enumerate" does is read things from the guest it can read, which probably does get greatly limited to what's in the .vbox file.

Try an Android forum for generating the text file. I don't know about networking between an Android guest and the host, but if the guest can use the network card presented you might be good. Someone may have figured that out. Try the Other Guests forum.

Once you can get the text file on a host folder, then it's very easy to parse & use the info. Post back here when you have the file on the host ready to be read.
predatorftp
Posts: 9
Joined: 29. Apr 2015, 06:37

Re: How to determine the actual resolution and dpi of client

Post by predatorftp »

I managed to use this command from withing the android:
adb shell dumpsys display

It will display all the data about the display including resolution and dpi. but still it shows 720x1280 -- that can't be.

Whats maybe leading me to think vbox is "simply" resizing the client window and not actually changing the resolution and dpi detected by the android !

Am i right or wrong ?

Thanks
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to determine the actual resolution and dpi of client

Post by mpack »

That would be wrong. The VM, since it has no GAs, is using VESA graphics. The guest OS should be able to detect the current graphics mode, but whether or not it can do so is beyond the scope of these forums (as mentioned, Android is not a supported guest OS).
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to determine the actual resolution and dpi of client

Post by scottgus1 »

Now that I think of it, Virtualbox needs the Guest Additions to change the guest's resolution to fit the host window. Since there's no Guest Additions, Virtualbox is not changing the guest resolution, as Mpack says. The guest is just displaying off the bottom of the screen.

Is there a scroll bar on the side of the guest window? I have guests on a 1024x768 server that can show bigger screens, and they show scroll bars in the window when the screen resolution is bigger than the host window.
predatorftp
Posts: 9
Joined: 29. Apr 2015, 06:37

Re: How to determine the actual resolution and dpi of client

Post by predatorftp »

scot, no the display screen changes according to the window size. and yes i confirm that vbox simply resize it and not the os resolution. I don't understand how it's done it's beyond my understanding
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to determine the actual resolution and dpi of client

Post by scottgus1 »

Actually, that's what I'm saying. The guest OS draws its full screen, but only the part of the screen that can show in the window shows.
When such a thing happens on my guests, I get scroll bars on the window. You don't have the scroll bars?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to determine the actual resolution and dpi of client

Post by mpack »

VirtualBox does change VESA graphics mode if you change the display window size. As I said above, whether or not this is correctly reported by an unsupported guest OS is not something we care about. The guest OS can also command the graphics card to change modes: I do that routinely in my Win98SE VMs (Win98 also has no GAs and hence is stuck with VESA graphics).
 Edit:  Actually, I take that back. My Win98SE VM does not change display size when I change window size. It seems that the only way to change display size is to choose a new graphics mode within the guest OS (e.g. in Win98 I right click the desktop and choose Properties). I guess the display mode only changes automatically when the GAs are involved. If I drag the window border all that happens is that padding is displayed, or scroll bars are displayed, depending on whether the virtual display is smaller or bigger than the window. 
predatorftp
Posts: 9
Joined: 29. Apr 2015, 06:37

Re: How to determine the actual resolution and dpi of client

Post by predatorftp »

guys, in android, when resizing the vbox client window the screen size is resizing in the android OS too but wrongly reported by internal and external. I don't know why and how but it's a fact.
when i resize-reduce size the window the os screen withing the guest vbox reduces automatically, the only thing i'm left to find out is how to determine the actual real setting after that window resize took place.
Post Reply