Change Resolution in Android VM

Search This thread
Apr 23, 2017
12
2
Hello,

We're working on Android S in a virtualized environment (Running via QEMU emulator).
How do we change the resolution from the source code ? .
Also, how does
wm size AxB (where A and B are resolution numbers) work in the background from the adb shell ?
Which place in the source code do we look for to change the resolution ?

The host is an Ubuntu Setup, and we're using QEMU 6.
Attached screenshot is how we run the Android VM.
 

Attachments

  • android vm.PNG
    android vm.PNG
    1.8 MB · Views: 10

xXx yYy

Senior Member
Feb 4, 2017
1,001
5
175
You change Android's screen resolution and/or density by editing it's "build.prop" file.


Example:

Code:
adb shell wm size 1080x1920
and then
Code:
adb shell wm density 390


BTW:

Resolution is defined as the following on Google's developer portal:

The total number of physical pixels on a screen. When adding support for multiple screens, applications do not work directly with resolution; applications should be concerned only with screen size and density, as specified by the generalized size and density groups.

And screen density:
The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch). For example, a "low" density screen has fewer pixels within a given physical area, compared to a "normal" or "high" density screen. For simplicity, Android groups all actual screen densities into six generalized densities: low, medium, high, extra-high, extra-extra-high, and extra-extra-extra-high.
 
Apr 23, 2017
12
2
You change Android's screen resolution and/or density by editing it's "build.prop" file.


Example:

Code:
adb shell wm size 1080x1920
and then
Code:
adb shell wm density 390


BTW:

Resolution is defined as the following on Google's developer portal:

The total number of physical pixels on a screen. When adding support for multiple screens, applications do not work directly with resolution; applications should be concerned only with screen size and density, as specified by the generalized size and density groups.

And screen density:
The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch). For example, a "low" density screen has fewer pixels within a given physical area, compared to a "normal" or "high" density screen. For simplicity, Android groups all actual screen densities into six generalized densities: low, medium, high, extra-high, extra-extra-high, and extra-extra-extra-high.
I can change the resolution, while running the image.
with
adb shell > wm size 1920x1080 or something like that.

but, what i want to achieve is, writing a C/C++ code, which can help me change the resolution to whatever i feel like within the minResolution and maxResolution limits of the screen.

something like,
./screen_reso 1920 1080 (passing 1920 1080 as command line arguments or even inside the code)