B2G/QA/Tips And Tricks
B2G Tips Tricks
A collection of QA's tips and tricks on how to test Firefox OS.
Conversion tool to change file formats
Addon to Firefox web browser to see Firefox OS Simulator
https://addons.mozilla.org/en-us/firefox/addon/firefox-os-simulator/
Launching Desktop B2G on mac with profile
$ git clone git://github.com/mozilla-b2g/gaia $ make -C gaia profile $ /path/to/b2g -profile gaia/profile (eg. Tonys-MacBook-Air:MacOS tchung$ ./b2g -profile /Users/tchung/Desktop/DailyB2G/07172012_desktop/gaia/profile)
Diagrams
of the RIL (Software Module Structure)
Gaia
Setting the system clock
$ adb shell date -s 20120731.172200 (for 5:22pm)
- In order to print the format the same on the mac:
date -j "+%Y%m%d.%H%M%S"
- Placing them together :
adb shell date -s `date -j "+%Y%m%d.%H%M%S"`
Tricking b2g emulator to see network
1) launch emulator ./run-emulator.sh 2) adb shell setprop net.dns1 10.0.2.3
Enabling A-GPS on device
This is for building B2G:
$ cd b2g/app/b2g.js vi b2g.js add pref("geo.gps.supl_server", "supl.google.com"); add pref("geo.gps.supl_port", 7276);
For changing the preference:
1. adb root 2. adb remount 3. adb pull /system/b2g/defaults/pref/user.js . 4. edit the file and change : pref("geo.gps.supl_server", "test.supl.svc.ovi.com"); pref("geo.gps.supl_port", 7276); to pref("geo.gps.supl_server", "supl.google.com"); pref("geo.gps.supl_port", 7276); 5. adb push user.js /system/b2g/defaults/pref 6. adb reboot
Media Files Repository
Can be found here: http://hg.mozilla.org/mozilla-central/file/tip/content/media/test
Importing Contacts via Device (manually)
- First, export your contacts in your old phone to the SIM card.
- Some phones have this feature built-in, check your Contacts app or phone settings.
- Android: To export Google contacts onto a SIM card (which Android does not do by default), install the free app Contact2Sim. Open the app, select the phone, and in the options menu choose "Copy missing to SIM".
- iPhone: No easy solution. You could probably sync iPhone to Mac Address Book, and sync that to Google, and then find an Android phone to export those to your sim card.
- FUTURE: Install the Contacts Backup app, or backup to Gmail from iTunes. Then once Francisco finishes his Google->Firefox OS importer you can import from there.
- Second, put the SIM card in your Firefox phone, open the Contacts app and click the "Import SIM contacts" button.
Changing preferences
Prefs.js:
PREFS_JS=$(adb shell echo -n "/data/b2g/mozilla/*.default")/prefs.js adb pull $PREFS_JS edit prefs.js adb shell stop b2g adb push prefs.js $PREFS_JS adb shell start b2g
- things to change :
- For email debugging, setting this pref to set true : "browser.dom.window.dump.enabled"
User.js:
adb pull /system/b2g/defaults/pref/user.js . < edit user.js and set "ril.debugging.enabled" to true > adb shell mount -o remount,rw /system adb push user.js /system/b2g/defaults/pref adb shell mount -o remount,ro /system adb shell sync && adb reboot
- this turns ril debugging on
adb root adb pull /system/b2g/defaults/pref/user.js . echo 'pref("network.dns.disablePrefetch", true);' >> user.js adb remount adb push user.js /system/b2g/defaults/pref adb shell sync && adb reboot
- This adds the pref to disable dns prefetching : bug 856530
- Use the patterns above to change either the pref.js in the user profile or the user.js for the system: http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries
- Real time turning wifi debug on ( you will need netcat ( http://netcat.sourceforge.net/download.php ; http://www.catonmat.net/blog/unix-utilities-netcat/ ) ). You will also need to work with a version that has the simple remote js console. Patch listed here: ( bug 723391 )
adb forward tcp:9999 tcp:9999 netcat localhost 9999 navigator.mozSettings.createLock().set({'wifi.debugging.enabled': true})
- to turn it back off, just set it to false:
navigator.mozSettings.createLock().set({'wifi.debugging.enabled': false})
Source : bug 806611
- to turn system system updates off; set gaia.system.checkForUpdates to false
Backing up the Profile and Restoring it after flash
<go to a temp folder somewhere> adb pull /data/local local adb pull /data/b2g b2g <flash device> adb push local /data/local adb push b2g /data/b2g
Crashes
Getting crashes off the Device
- adb shell ls -l /data/b2g/mozilla/Crash\ Reports/submitted/
How to Force a crash
BusyBox
From bug 860548
File:Busybox.zip
Install
- . download and unzip the zip file
- . adb root
- . adb remount
- . adb push busybox /system/bin
- . adb shell chmod 755 /system/bin/busybox
Usage
- adb shell busybox ping 8.8.8.8 => ping command
- adb shell busybox ifconfig wlan0 => check tx/rx bytes
- adb shell cat /proc/net/route => check the default route
- adb shell iptables -t nat -nvL => check if the packets are sent from application to IP layer, check Chain OUTPUT (policy ACCEPT 2 packets, 168 bytes)
DBus
Here is the way to provide more logs. dbus-log.txt Usage in ubuntu linux:
- Unzip File:Dbus-tool.zip
- adb root
- adb push dbus-monitor /system/bin
- adb shell chmod 777 /system/bin/dbus-monitor
- adb push dbus-uuidgen /system/bin
- adb shell chmod 777 /system/bin/dbus-uuidgen
- Before running dbus-monitor, you need to run "dbus-uuidgen --ensure" in unagi first.
- adb shell dbus-monitor --system "type='signal'" |tee dbus-log.txt
- Start to test. Now dbus log will be recorded.
Notes:
- . Why we use it : http://en.wikipedia.org/wiki/D-Bus
- . example and instructions from : bug 828860
Scripts
- File:ChangeUA.sh.zip
- sets a pref to change the user agent
- File:Channel-setup.zip
- sets a pref to change the channel to nightly
- File:CheckVersions.zip
- lists the gaia/gecko checkin, buildid, version
- File:Crashreports.zip
- lists all the files in the submitted/pending folder directories of the Crash Reports folder
- File:OMTC PrefChange.zip
- Changes the OMTC in the pref
- File:ModPref.sh.zip
- pull prefs.js, edit locally, they push to phone
Incomplete Script
- File:Profile backup.sh.zip
- still working on this to have options to backup flash and restore; rough draft.
Hardware Cheat codes
- Konami
- Up-Up-Down-Down-Left-Right-Left-Right B, A, Start.
- System Recovery:
- Inari : reboot, power-on+ volume up
- Fastboot mode: (mode that allows flashing on the device without setting remote debug on)
- Inari, Hamachi : plug in, power on, hold volume up+down
- Unagi : plug in, power on, hold power + up
- Leo: take out battery, hold down volume button, plug into computer
- upload mode (visual screen change)
- Leo: take out battery, hold up volume button, plug into computer
- Calibrating the Proximity sensor
- Inari
- load the image to the device
- start the Dialer app
- Input "*983*0#" and press "send". The device should start vendor engineering test app
- Press "Down" and Select "Sensor"
- Press "Calibrate" button to do prox sensor calibration
- The device will show "Calibrate OK", when the calibration is complete.
- Then you can test the sensor.
- block the sensor, the screen will show "Proximity:true"
- unblock the sensor, the screen will show "Proximity:false"
- Press "Back", "Quit" to quit this app, and check whether the sensor can work in voice call.
- Inari
( Source : https://bugzilla.mozilla.org/show_bug.cgi?id=857484 )
- Getting IMEI info:
- dial *#06# in the phone app.
- Getting Touchscreen Info:
$ adb shell cat /proc/touchscreen/ts*
Devices that don't allow for adb root/adb remount
If you do a |adb shell getprop ro.secure| it should return 1. You basically have to repack which is complicated, or get a different boot.img.
The things that are blocking is the default.prop which has to be set to: ro.secure=0 ro.debuggable=1 persist.service.adb.enable=1
Unforuntately without mount/remount/root it's difficult.
Help I bricked my phone/Unagi
RIL
APN
Name: T-Mobile APN: epc.tmobile.com or fast.tmobile.com (for LTE devices) Proxy: <Not set> Port: <Not set> Username: <Not set> Password: <Not set> Server: <Not set> MMSC: http://mms.msg.eng.t-mobile.com/mms/wapenc MMS proxy: <Not set> MMS port: <Not set> MMS protocol: WAP 2.0 MCC: 310 MNC: 260 Authentication type: <Not set> APN type: <Not Set> OR Internet+MMS (depending on software version)
MCC/MNC
adb logcat | grep -E 'MCC|MNC'
- more info can be found : https://etherpad.mozilla.org/SIM-api
COMRIL vs MOZRIL checking
- changes were made in COMRIL, that should be available in AU 112(v 1.0.1)/AU 103 (for v1.1) and beyond, where if the comril fails, it fails over to the mozril.
- |adb logcat -b radio| will help in terms of determining failover.
- example of success vs fail over : https://gist.github.com/anonymous/5620923
Dealing with the Commercial RIL
If the bundles are in the distribution folder, then it will use that RIL:
- adb shell ls /system/b2g/distribution/bundles/
To revert and use mozril, delete the bundles folder:
- adb root
- adb shell mount -o remount,rw /system
- adb shell rm -r /system/b2g/distribution/bundles
- adb shell mount -o remount,ro /system
- adb shell sync && adb reboot
Locating the Firmware version on your Device
- adb shell cat /proc/version
Linux version 3.0.21-perf (jeremy.kim@LGEARND8B7) (gcc version 4.4.3 (GCC) ) #1 PREEMPT Mon May 13 14:20:36 KST 2013
Flashing only Gecko and Gaia bits over your base image
These are steps if you only want to apply gecko and gaia over your device Gonk or Commercial RIL.
- Pre-setup:
- Flash the base Leo build on the device, so you have the vendor binaries
- download the Gaia.zip and b2g-18.0.en-US.android-arm.tar.gz from the Device directory's location. (Leo example)
- Extract both into a temp directory
$ adb root $ adb shell stop b2g $ adb remount
//Updating gecko (make sure you push the b2g directory not the b2g app, //ie be at the directory one level above the unzipped b2g-18 zip file instead of inside the b2g folder) $ adb push b2g /system/b2g
//If gaia doesn't work the first time around, do the steps above and the following and then do the gaia update portion; // otherwise skip this and go to the updating gaia portion: $ adb shell rm -r /cache/* $ adb shell rm -r /data/b2g/* $ adb shell rm -r /data/local/webapps $ adb shell rm -r /system/b2g/webapps
//Updating gaia: $ adb push gaia/profile/webapps /system/b2g/webapps $ adb push gaia/profile/settings.json /system/b2g/defaults/ $ adb push gaia/profile/user.js /system/b2g/defaults/pref/
// restart $ adb shell sync $ adb shell reboot
Removing RIL + flashing Gecko + flashing Gaia and reseting profile
Instructions for updating currently:
- Pre-setup:
- Flash the base Leo build on the device, so you have the vendor binaries
- download the Gaia.zip and b2g-18.0.en-US.android-arm.tar.gz from the Device directory's location. (Leo example)
- Extract both into a temp directory
$ adb root $ adb shell stop b2g $ adb remount
// remove the RIL $ adb shell rm -r /system/b2g/distribution/bundles
//Updating gecko (make sure you push the b2g directory not the b2g app, //ie be at the directory one level above the unzipped b2g-18 zip file instead of inside the b2g folder) $ adb push b2g /system/b2g
//If gaia doesn't work the first time around, do the steps above and the following and then do the gaia update portion; // otherwise skip this and go to the updating gaia portion: $ adb shell rm -r /cache/* $ adb shell rm -r /data/b2g/* $ adb shell rm -r /data/local/webapps $ adb shell rm -r /system/b2g/webapps
//Updating gaia: $ adb push gaia/profile/webapps /system/b2g/webapps $ adb push gaia/profile/settings.json /system/b2g/defaults/ $ adb push gaia/profile/user.js /system/b2g/defaults/pref/
// restart $ adb shell sync $ adb shell reboot
Building Gecko/Gaia
B2G Compiling Gecko
- Follow the instructions on : https://github.com/mozilla-b2g/B2G
- if you have all the prereqs, you just need to clone the repo
- use the config.sh to config what you're building, use the Branch variable to switch branches, use the device name to build for the specific devices
- BRANCH=master ./config.sh peak
- BRANCH=v1-train ./config.sh leo
B2G Compiling Gaia
Importing contacts, dial data, sms, and media via USB
- You can do this by just cloning the gaia repo and switching to master branch:
git clone https://github.com/mozilla-b2g/gaia.git git checkout origin/master git checkout master
And then run the script to populate sqlite db
Note: the following steps below assumes that you have built your own gecko and gaia repo. If you havent done that first, you cannot run these steps. See Instructions on building your B2G Repo. Average time it takes to sync and build is around 5-8 hours
- Start by syncing and updating your Gaia repo
./repo sync gaia Cd gaia
- run the script that populates your sqlite db
$ make reference-workload-x-heavy Images: 250 Songs: 250 Videos: 50 Contacts: 2000 Sms Messages: 2000 Dialer History: 500
$ make reference-workload-medium Images: 50 Songs: 50 Videos: 10 Contacts: 500 Sms Messages: 500 Dialer History: 100
$ make reference-workload-light Images: 20 Songs: 20 Videos: 5 Contacts: 200 Sms Messages: 200 Dialer History: 50
Reference : https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Gaia/Hacking_Tips_And_FAQ
Hi DPI builds
- Currently supported screens:
- qHD: ~540×960, device pixel ratio = 1.6875
- WVGA: ~480×800, device pixel ratio = 1.5
How to:
- You need to set HIDPI=1 when using any make command
Examples:
- HIDPI=1 make reset-gaia
- HIDPI=1 make install-gaia
- HIDPI=1 BUILD_APP_NAME=contacts make install-gaia
Other Gaia compilation commands
- MOZILLA_OFFICIAL=1
- to make branded; default 0
- make production
- production build versus engineering
- DOGFOOD=1
- dogfood is turned on
- make profile
- makes only the profile
- make reset-gaia, keeps your old profile
- resets gaia
- make install-gaia
- installs gaia, brand new
- APP=<app name>
- installs the specific application in the gaia directory
- make clean
- removes the generated profile; will be available when bug 874774 lands.
Example : if you want the production dogfood build that's branded: MOZILLA_OFFICIAL=1 DOGFOOD=1 make production
See : https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Gaia/Build_System_Primer
Customized UI
(From : Al Tsai) Customized UI allows people change their:
- animation when boot and shutdown,
- default ring tones,
- wallpapers,
- built-in bookmarks for browser,
- built-in contacts,
- default cost control setting,
- home screen,
- settings,
- adding sms black list
- and the working in support page.
For more detail, you can have a look on https://wiki.mozilla.org/B2G/MarketCustomizations
GAIA_DISTRIBUTION_DIR=sample_folder_path make reset-gaia
Current bugs: bug 845261 bug 860288