Blog

[Samsung DeX] Setting up Freeform Application in Android Studio Emulator
Blog May 11, 2017
8

If you don’t have the Dex Station, you can test your app resize behavior in Android Studio using Android Virtual Device. These are the steps to set-up DeX freeform emulator environment:

  1. Run AVD Manager (it is located on top menu of Android Studio)

  2. Click Create Virtual Device

  3. Select the device definition with name Nexus 6P

  4. Click the download link next to ‘Nougat’ or click next if you have already downloaded Nougat SDK before.

  5. Click Finish after the download is completed.

  6. Selecty Nougat as the system image and click Next.

  7. Click Finish

  8. Click Launch button

  9. Wait for the emulator to boot. When emulator booting is completed, you will be shown Android Nougat home screen. Just through follow the wizard.

  10. Run your application and check whether phone layout runs well in phone mode or not.

  11. Run Command Prompt and enter following commands

    • Enter : adb shell

    • Enter : su

    • Enter : setenforce 0

    • Enter : settings put global enable_freeform_support 1

    • Enter : cd /data/local/tmp

    • Enter : mkdir permissions

    • Enter : cd permissions

    • Enter : cp -a /system/etc/permissions/* ./

    • Enter : sed -e "s/live_wallpaper/freeform_window_management/" android.software.live_wallpaper.xml >freeform.xml

    • Enter : mount --bind . /system/etc/permissions

    • Wait few seconds

    • Enter : stop

    • Wait few seconds

    • Enter : start

  12. The emulator will reboot. After rebooting, check if the icon below appears when in Recent screen. App will go into Freeform when you click the icon shown below

  13. Enter following commands in Command Prompt to test app in the same density and resolution as DeX mode.

    • adb shell

    • wm density 160

    • wm size 1080x1920

  14. Rotate the emulator by clicking the following icon on Emulator control panel

  15. Test if your application runs well in same density and resolution as Dex Mode. You can resize your application by click and drag corner of your application. Sometimes you need to dragging at the ‘shadow’ part of your application for it to work.

  16. Enter below commands on Command Prompt and click icon below on Emulator control panel if you want to return to phone mode.

    • adb shell

    • wm density reset

    • wm size reset

    Click the rotate button with different direction as step 14

Revision history
REVISION HISTORY DATE
First update May 11, 2017