Skip to content

Emulator look and feel

alexnivan edited this page Jun 26, 2014 · 1 revision

The following points cover the look and feel of the Android x86 device Emulator.

Enable hardware acceleration

First off, you need to check that your CPU supports hardware virtualization

$ egrep -c '(vmx|svm)' /proc/cpuinfo

0 means the CPU does not support, any other number is fine.

Install cpu-checker

$ sudo apt-get install cpu-checker

Check whether the CPU support KVM

$ kvm-ok

If you see:

"INFO: Your CPU supports KVM extensions
INFO: /dev/kvm exists
KVM acceleration can be used"

It means you can run your virtual machine faster with the KVM extensions.

If the output of the above command tells you to enable virtualization in the system BIOS, do so.

To install kvm for Ubuntu Lucid (10.04) or later:

$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

After the installation is done, add your <username> account to the group kvm and libvirtd

$ sudo adduser your_user_name kvm
$ sudo adduser your_user_name libvirtd

In order to start the emulator using KVM, add the following parameters to your usual command

-qemu -enable-kvm

Enable the hardware keyboard

On some occasions, the hardware keyboard may not work in the emulator. To remedy this, edit

<AOSP-tree>/external/qemu/android/avd/hardware-properties.ini

Find the following block

# Keyboard support (qwerty/azerty)
name        = hw.keyboard
type        = boolean
default     = yes
abstract    = Keyboard support
description = Whether the device has a QWERTY keyboard.

Make sure the value for default is yes.

After doing this, run make and the keyboard should now work properly.

Change screen size

The easy way to resize the screen is to add the following parameters to your usual emulator command

-skin widthxheight

This will resize the screen, but you will no longer have the keyboard and navigation buttons displayed.

If you need these, you have to create your own skin under

<AOSP-tree>/development/tools/emulator/skins/

In order to create a new skin, the easiest way is to copy an existing one (e.g. HVGA, since this one has the keyboard and buttons)

$ cp -r HVGA <skin-name>

Next, you want to edit the layout file. Take care, since enlarging the screen will likely require moving the keyboard and navigation buttons as well to avoid them being covered.

After you are done modifying, add the following to the emulator launch command in order to use the newly created skin

-skin <skin-name>

Below you have an example of a layout file, which sets and screen size to 900x700 and maintains keyboard and navigation pad.

parts {
    portrait {
    }
    landscape {
    }

    device {
        display {
            width   900
            height  700
            x       0
            y       0
        }
    }

    controls {
        background {
            image   controls.png
        }
        buttons {
            soft-left {
                    image button.png
                    x 56
                    y 142
            }
            home {
                    image button.png
                    x 0
                    y 142
            }
            back {
                    image button.png
                    x 112
                    y 142
            }
            dpad-up {
                    image arrow_up.png
                    x 77
                    y 53
            }
            dpad-down {
                    image arrow_down.png
                    x 77
                    y 106
            }
            dpad-left {
                    image arrow_left.png
                    x 53
                    y 53
            }
            dpad-right {
                    image arrow_right.png
                    x 123
                    y 53
            }
            dpad-center {
                    image select.png
                    x 77
                    y 81
            }
            phone-dial {
                    image button.png
                    x 0
                    y 71
            }
            phone-hangup {
                    image button.png
                    x 168
                    y 71
            }

            power {
                    image button.png
                    x 168
                    y 0
            }

            volume-up {
                    image button.png
                    x 112
                    y 0
            }

            volume-down {
                    image button.png
                    x 56
                    y 0
            }

            search {
                    image button.png
                    x 168
                    y 142
            }

        }
    }

    keyboard {
        background {
            image   keyboard.png
        }
        buttons {
            1 {
                image  key.png
                x  5
                y  5
            }
            2 {
                image  key.png
                x 42
                y 5
            }
            3 {
                image  key.png
                x 79
                y 5
            }
            4 {
                image  key.png
                x 116
                y 5
            }
            5 {
                image  key.png
                x 153
                y 5
            }
            6 {
                image  key.png
                x 190
                y 5
            }
            7 {
                image  key.png
                x 227
                y 5
            }
            8 {
                image  key.png
                x 264
                y 5
            }
            9 {
                image  key.png
                x 301
                y 5
            }
            0 {
                image  key.png
                x 338
                y 5
            }

            q {
                image  key.png
                x  5
                y  41
            }
            w {
                image  key.png
                x 42
                y 41
            }
            e {
                image  key.png
                x 79
                y 41
            }
            r {
                image  key.png
                x 116
                y 41
            }
            t {
                image  key.png
                x 153
                y 41
            }
            y {
                image  key.png
                x 190
                y 41
            }
            u {
                image  key.png
                x 227
                y 41
            }
            i {
                image  key.png
                x 264
                y 41
            }
            o {
                image  key.png
                x 301
                y 41
            }
            p {
                image  key.png
                x 338
                y 41
            }

            a {
                image  key.png
                x  5
                y 77
            }
            s {
                image  key.png
                x 42
                y 77
            }
            d {
                image  key.png
                x 79
                y 77
            }
            f {
                image  key.png
                x 116
                y 77
            }
            g {
                image  key.png
                x 153
                y 77
            }
            h {
                image  key.png
                x 190
                y 77
            }
            j {
                image  key.png
                x 227
                y 77
            }
            k {
                image  key.png
                x 264
                y 77
            }
            l {
                image  key.png
                x 301
                y 77
            }
            DEL {
                image  key.png
                x 338
                y 77
            }

            CAP {
                image  key.png
                x  5
                y 113
            }
            z {
                image  key.png
                x 42
                y 113
            }
            x {
                image  key.png
                x 79
                y 113
            }
            c {
                image  key.png
                x 116
                y 113
            }
            v {
                image  key.png
                x 153
                y 113
            }
            b {
                image  key.png
                x 190
                y 113
            }
            n {
                image  key.png
                x 227
                y 113
            }
            m {
                image  key.png
                x 264
                y 113
            }
            PERIOD {
                image  key.png
                x 301
                y 113
            }
            ENTER {
                image  key.png
                x 338
                y 113
            }

            ALT {
                image  key.png
                x  5
                y 149
            }
            SYM {
                image  key.png
                x 42
                y 149
            }
            AT {
                image  key.png
                x 79
                y 149
            }
            SPACE {
                image  spacebar.png
                x 116
                y 149
            }
            SLASH {
                image  key.png
                x 264
                y 149
            }
            COMMA {
                image  key.png
                x 301
                y 149
            }
            ALT2 {
                image  key.png
                x 338
                y 149
            }

        }
    }
}

layouts {
    portrait {
        width     1400
        height    734
        color     0xe0e0e0
        event     EV_SW:0:1

        part1 {
            name    portrait
            x       0
            y       0
        }

        part2 {
            name    landscape
            x       800
            y       0
        }

        part3 {
            name    device
            x       28
            y       27
        }
        part4 {
            name    controls
            x       1050
            y       77
        }
        part5 {
            name    keyboard
            x       1000
            y       328
        }

    }
}

keyboard {
    charmap qwerty2
}

network {
    speed  full
    delay  none
}