How to set screen resolution and density in /system/build.prop?



  • I want to automate the creation of virtual android devices (using Android x86 and QEMU/KVM on Linux), the device settings includes screen resolution and density. The common way to set these settings is through adb shell wm size and adb shell wm density but it requires the device to be running, while changing /system/build.prop doesn't, I can mount the virtual disk and make changes there.


  • QA Engineer

    Since you are open to modifying virtual disk you can edit the file settings_global.xml located under /data/system/users/0/ directory. Among other things, look for these two keys in that file:

    • display_size_forced
    • display_density_forced

    These keys correspond to wm size WxH and wm density DPI respectively. Change their values to your desirable WidthxHeight and density.

    Save it. That's it.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2