Instructions
The following instructions are provided to help interested developers and/or researchers set up Tango in their environment. Before proceeding, you need to have an Android smartphone (Samsung Galaxy S3 recommended) and a Ubuntu machine.
We tested Tango using a Samsung Galaxy S3 smartphone running the Android 4.2.2 (Jellybean) operating system as our mobile device and a Ubuntu 14.04 desktop (3.40 GHz i5 processor (i5-3570) with 4GB of RAM) as our remote server for obtaining the evaluation results presented in our Mobisys paper.
1. Setup of Android build on your Ubuntu machine
a) Follow the steps at http://source.android.com/source/initializing.html to set up a Linux build environment for Android
b) Add build Tango's build path
$ vi ~/.bashrc
export USE_CCACHE=1
PATH=$PATH:~/tango/out/host/linux-x86/bin
2. CyanogenMod setup on your smartphone
Root your device if you have not yet done that and download the proper CyanogenMod package from http://download.cyanogenmod.org and install CyanogenMod on your device.
For Samsung Galaxy S3, please follow http://wiki.cyanogenmod.org/w/Install_CM_for_d2att to install CyanogenMod.
In our evaluation, we use this version of CM available at http://download.cyanogenmod.org/get/jenkins/24767/cm-10.1-20130411-EXPERIMENTAL-crespo-M3.zip
3. Build Tango
a) Extract Tango source code from download to ~/
$ cd ~
$ tar xf tango.tar.bz2
$ cd tango
b) Compile Tango source code
$ source build/envsetup.sh
$ lunch cm_d2att-userdebug
$ scripts/switch_vm.sh replay
$ scripts/build_all.sh
If you come across following errors, try to bypass them by commenting out the lines that cause errors in corresponding xml files
device/samsung/d2-common/overlay/frameworks/base/core/res/res/values/config.xml:335: error: Resource at config_panelAutoBrightnessValue appears in overlay but not in the base package; use <add-resource> to add.
device/samsung/d2-common/overlay/frameworks/base/core/res/res/values/dimens.xml:22: error: Resource at pie_trigger_thickness appears in overlay but not in the base package; use <add-resource> to add.
vendor/cm/overlay/common/frameworks/base/core/res/res/values/config.xml:23: error: Resource does not already exist in overlay at 'config_disabledComponents'; use <add-resource> to add.
vendor/cm/overlay/common/frameworks/base/core/res/res/values/config.xml:24: error: Resource at config_disabledComponents appears in overlay but not in the base package; use <add-resource> to add.
vendor/cm/overlay/common/frameworks/base/core/res/res/values/config.xml:25: error: Resource at config_disabledComponents appears in overlay but not in the base package; use <add-resource> to add.
vendor/cm/overlay/common/frameworks/base/core/res/res/values/config.xml:26: error: Resource at config_disabledComponents appears in overlay but not in the base package; use <add-resource> to add.
make: *** [/root/tango/out/target/common/obj/APPS/framework-res_intermediates/package-export.apk] Error 1
4. Install Tango on your smartphone
$ ./scripts/push_vms.sh
5. Launch Tango
a) Everytime you are starting Tango, you need to initialize the environment
$ source build/envsetup.sh
$ lunch cm_d2att-userdebug
b) Go to vm_test folder to set up a remote server and obtain the ID of current Dalvik VM
$ cd ~/tango/vm_test
$ ./setup_server.sh d2att prepare
c) Replicate your phone's file system on the server
$ cd ~/tango/vm_test
$ mkdir fs
$ cd fs
$ adb pull /data data/
$ adb pull /system system/
The file system for Galaxy S3 is a bit different and you need to conduct the following extra copy
$ adb pull /cache/dalvik-cache data/dalvik-cache
$ adb pull /vendor vendor/
d) Reboot your phone and copy the channel ID for the current replayed Dalvik VM
$ cd ~/tango/vm_test
$ ./logcat.sh
e) Replay Zygote process and enter the channel ID you just copied to the command prompt
$ ./replay_zgote.sh
f) For Galaxy S3, you may need to disable NFC on your phone to ensure Tango runs normally
6. As an example, we demonstrate how to replay Email application using Tango
a) Replicate the email data and obtain user ID for the Email application
$ cd vm_test;
$ ./setup_datadata.sh com.android.email
$ adb shell ps | grep email
b) For example, if it is "u0_a18 2091 247 868280 31468 ffffffff 401e510c S com.android.email" in the last "ps" output, then create a file 'record.lst' on your phone under /data and put '10000 + xx' into it, where xx = 18
Note: in case Tango fails to run at Step 5, you may try building and installing Tango in debug mode following the instructions:
$ cd ~/tango
$ source build/envsetup.sh
$ lunch cm_d2att-userdebug
$ cd scripts;
$ ./clean.sh
$ ./switch_vm.sh replay-debug
$ cd ~/tango
$ mmm -j8 dalvik/vm
$ cd ~/tango/scripts
$ ./push_vm.sh --vm