Basic Customization

To tailor the browser to your users, there are certain common customization's you should perform, and we list them below.

You should have already cloned this project (and and all the related related projects listed in the .gclient or src/DEPS file) and
you should be working on a branch on top of our baseline.
Remember to always keep a link to our upstream_, so that you can merge the stability patches and bugfixes that will come on this project for your branch of choice.

Common Changes and 'Channels' aka Branding

By using the Sync and Build Instructions and compiling the swe_browser_apk target, you will get a working APK with a good default configuration.  Before deploying to your customers you should make some changes (details follow the bullets below), and in particular:

  1. replace the package name with your own package name (usually com.company.division.browser)
  2. change the name, icon, color and other branding elements of the APP to match your needs
  3. disable features you don't care about, for example by editing the browser/res/values/bools.xml (and other Android resource files)
  4. for each distinct feature, such as Fast Webview (SWEET) or WebRefiner or Speculative Redirect Pre-Connect, you have more advanced configuration options to fit your needs
  5. and of course anything that comes in source format can be shaped with ease

We support 'channels' to simplify the customization process.  They are specified in swe/channels/ (or swe/browser/channels/ for M42).
You can copy the default 'dev' channel to a channel name of your choice, edit the swe/channels/YourChannel/branding/BRANDING file
to set constants such as the Package Name, add resource customizations (e.g. icon or colors) in the overlay/res folder, and activate the
channel by executing the following command before building:

$GYP_DEFINES="$GYP_DEFINES OS=android swe_channel=YourChannel" gclient runhooks

Advanced Features Configuration

WebRefiner

WebRefiner is a content filtering component for SWE Browser. It provides a core filtering engine for filtering URLs and a DOM manipulator for applying cosmetic filters on the page to hide unwanted contents.

TL;DR: you should change the subscription.url(s) in web_refiner_conf, and you're good to go.
UI Enablement
  • Default: toggle the option in Menu > Settings > Privacy & Security > "Ads and distracting content"
  • Per-site (Overrides the default option on a per-website basis): toggle the option in Top-left Favicon Button > "Ads and distracting content"
Filter configuration
  1. The configuration file is in:
  2. WebRefiner looks for the configuration only in the above path and failure to provide a valid configuration will result in a failed initialization of WebRefiner (and WebRefiner won't be shown in the UI)
  3. WebRefiner is fully compatible with the *leading ad-blocking filter list format*. A wide variety of public filters can be configured in subscriptions.url or you can create your own compatible filter list.
  4. Subscriptions configured in web_refiner_conf will always be downloaded from a http/https server at the very first browser startup and will be updated periodically according their expiration.
  5. All the downloaded filter files (and internal WebRefiner data) are stored in device /data/data/<browser-application>/web_refiner/. Deleting the folder, or clearing the APP DATA will bring WebRefiner back to its default state.
  6. Filters are applied in the same order as in the configuration file.
WebRefiner libraries
  1. The libraries listed in src/components/web_refiner/ (downloaded during the 'gclient sync' phase) are built on top of SWE based on Chromium version M42. Attempting to use these libraries in any other version of chromium will result in instability.
  2. libswewebrefiner.so is built with dependency on libswe.so. If you are changing the chromium library name to something else in your project, then libswewebrefiner.so library loading will simply fail at runtime.
  3. Libraries support ARM and ARM64 architecture only.
Browser command line arguments
--disable-web-refiner               disables WebRefiner completely
--enable-web-refiner-logcat-stats   enables logcat output of applied filters
Debugging: Logcat messages
logcat -s WebRefiner       generic WebRefiner failure messages
logcat -s WebRefinerStat   filter stats when '--enable-web-refiner-logcat-stats' is used
Tags:
Created by superadmin on 2020/04/18 20:52
    

My Recent Modifications

Need help?

If you need help with XWiki you can contact: