tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

android.txt (4965B)


      1 Running Wrench on Android devices.
      2 ==================================
      3 
      4 Setting up the environment:
      5 ---------------------------
      6 
      7 Follow the steps at https://github.com/rust-windowing/android-rs-glue#setting-up-your-environment, with exceptions:
      8    - No need to download the Android NDK and SDK, we will use the ones downloaded by Gecko in ~/.mozbuild/
      9 
     10    - Install both the i686-linux-android and armv7-linux-androideabi rust
     11      targets, as the APK will include native libraries with both architectures.
     12 
     13    - Don't install currently published version of cargo-apk, as it is missing the following
     14      required patch: https://github.com/rust-windowing/android-ndk-rs/pull/236
     15 
     16      Instead, install the git master version like so:
     17        cargo install --git https://github.com/rust-windowing/android-ndk-rs cargo-apk
     18 
     19    - Consider adding ~/.mozbuild/android-sdk-linux/platform-tools to your path, for the adb commands below.
     20 
     21 Compiling and running:
     22 ----------------------
     23 
     24    Compile wrench:
     25        cd wrench
     26        export ANDROID_SDK_ROOT=$HOME/.mozbuild/android-sdk-linux # exact path may vary
     27        export ANDROID_NDK_ROOT=$HOME/.mozbuild/android-ndk-r21d  # exact path may vary
     28        cargo apk build --lib
     29 
     30    Install the APK:
     31        adb install -r ../target/debug/apk/wrench.apk
     32 
     33    Set command line arguments and env vars for wrench:
     34        adb shell
     35        mkdir /data/data/org.mozilla.wrench/files/wrench
     36        echo "load reftests/aa/rounded-rects.yaml" >/data/data/org.mozilla.wrench/files/wrench/args
     37        echo "env: WRENCH_REFTEST_CONDITION_EMULATOR=1" >>/data/data/org.mozilla.wrench/files/wrench/args # If you're using the emulator
     38        echo "env: WRENCH_REFTEST_CONDITION_DEVICE=1" >>/data/data/org.mozilla.wrench/files/wrench/args # If you're using a device
     39        exit
     40 
     41    Push reftests (if you need these files for what you're doing):
     42        adb push reftests /data/data/org.mozilla.wrench/files/wrench/
     43 
     44    Run the application:
     45        adb shell am start -n org.mozilla.wrench/android.app.NativeActivity
     46            (or click the icon in the launcher)
     47 
     48    Inspect the output:
     49        stdout and stderr will be redirected to the logcat, however, long lines will be truncated
     50        meaning the reftest analyzer will not work correctly. We therefore additionally redirect the
     51        output to the file /data/data/org.mozilla.wrench/files/wrench/stdout.
     52 
     53 Release mode:
     54 -------------
     55 
     56    Building in release does work as well. Use the following steps to compile wrench:
     57        cd wrench
     58        export ANDROID_SDK_ROOT=$HOME/.mozbuild/android-sdk-linux # exact path may vary
     59        export ANDROID_NDK_ROOT=$HOME/.mozbuild/android-ndk-r21d  # exact path may vary
     60        cargo apk build --lib --release
     61 
     62    Now the APK at ../target/release/apk/wrench.apk
     63    should be signed and installable (you may need to uninstall the debug APK first if you
     64    have that installed).
     65 
     66 Running reftests like a boss (on a local emulator):
     67 ---------------------------------------------------
     68 
     69    First, compile wrench as described above (debug mode).
     70    Then, from the root gecko source dir, run:
     71        ./mach python testing/mozharness/scripts/android_wrench.py --config testing/mozharness/configs/android/wrench.py
     72    This will automatically do the following:
     73        - Download the blessed android AVDs from taskcluster
     74        - Start the emulator (using your ~/.mozbuild/android-sdk-linux emulator binaries)
     75        - Install the debug APK (from gfx/wr/wrench/target/debug/apk/wrench.apk)
     76        - Copy the reftests to the sdcard
     77        - Write an args file to the sdcard
     78        - Run wrench
     79        - Wait for wrench to finish running
     80        - Scrape the logcat for reftest output
     81    Other logs (e.g. full logcat) can be found in your ~/.wrench/logs folder. Note that
     82    this will also leave the android emulator running, so repeating the command will be
     83    even faster the next time around as it won't need to redownload the AVDs or restart
     84    the emulator. It will reinstall the APK and re-push the reftests folder though.
     85 
     86    If you want to use a release APK (runs much faster), build it as per the "Release mode"
     87    instructions above and set the WRENCH_APK env var to point to the APK:
     88    to point to it:
     89        export WRENCH_APK=gfx/wr/target/release/apk/wrench.apk
     90        ./mach python testing/mozharness/scripts/android_wrench.py --config testing/mozharness/configs/android/wrench.py
     91 
     92 Running reftests like a boss (on a local device):
     93 -------------------------------------------------
     94 
     95    Same steps as running on a local emulator, except you need to do this:
     96        export ANDROID_SERIAL=<your device's serial>
     97    before running the `./mach python` command. You can get the serial of
     98    your device by running `adb devices` with the device plugged in. When running
     99    on a device, the android_emulator_wrench.py script will skip the steps to
    100    download the AVDs and start the emulator.