Published on

Android Replace Google Webview Search with Firefox


I have started to try use Firefox as my go to browser on Android. One of the biggest issues I ran into with this transition is that with Nova Launcher launcher I have a swipe gesture defined which lets me quickly search the web for something.

Nova Search

Nova does have a section where you can specify an app action to attach to a gesture. But unfortunately there is no "New Tab" or "Add to Firefox" action for Firefox. I can easily make Nova open Firefox by using the app option for my swipe action but then I still need to open a new tab and search from there. Tasker exposes an action called "task shortcut" which seems perfectly suited for what we need.

Tasker is often very well suited for something like this but it can sometimes require a bit of digging. Tasker has a "Send Intent" action which lets you trigger an intent. Using this I can probably do what I need to do the problem now is working out what this intent is and what other data gets passed with it. To work out what intents an app has there are a number of things I tried:

Option 1: Download the App's APK and look at its manifest

  1. Download the apps apk to a pc from this website
  2. Unzip the apk (it is basically just a zip file with a certain folder structure)
  3. Search inside the AndroidManifest.xml file for all intent filters

The problem with this approach is often the manifest has large chunks of binary data making it hard to read.

Option 2: Use the Inspeckage Xposed Module to Inspect the app on your phone

  1. Install the Inspeckage Xposed module
  2. Restart your phone
  3. Open up Inspeckage
  4. Turn off "Only user app"
  5. Under "choose target" choose the app you want to inspect
  6. Push the "Launch App" button, this should launch the target app
  7. You can then view an app's details in one of two ways:
    1. On a computer that your phone is connected to:
      • Connect your phone to a computer using the USB cable
      • In a terminal run adb forward tcp:8008 tcp:8008
      • On the same computer navigate to the IP and port displayed in the app
    2. On your phone: simply navigate to: http://localhost:8008
  8. You should now see an interface similar to the below screenshot

Inspeckage Android UI
Inspeckage App Inspection UI

The source code for this module can be found here. This approach made it easy for me to find all possible intents and activities for an app but did not show me what data needs to be passed with these.

Option 3: Use adb logcat

I came across this answer on Stackoverflow which explained how to see what intents were being passed around in real time together with the data passed around. The steps I followed were:

  • Connect phone to computer
  • Get adb logs and grep out intents: adb logcat | fgrep -i intent
  • Trigger the intent on your phone
  • Inspect logs to find the details of the intent

This output:

09-30 00:53:08.511  1635  2034 I ActivityManager: START u0 {act=android.intent.action.SEND typ=text/plain flg=0xb080001 cmp=org.mozilla.firefox/org.mozilla.gecko.overlays.ui.ShareDialog clip={text/uri-list U:content://} (has extras)} from uid 10121
09-30 00:53:08.669 17794 17794 I Xposed  : Inspeckage_IPC:startService: Intent { act=org.mozilla.gecko.overlays.ACTION_PREPARE_SHARE cmp=org.mozilla.firefox/org.mozilla.gecko.overlays.service.OverlayActionService }
09-30 00:53:13.062 17794 17794 I Xposed  : Inspeckage_IPC:startActivity: Intent { act=android.intent.action.VIEW dat= cmp=org.mozilla.firefox/org.mozilla.gecko.BrowserApp (has extras) }
09-30 00:53:13.063  1635  5195 I ActivityManager: START u0 {act=android.intent.action.VIEW dat= cmp=org.mozilla.firefox/org.mozilla.gecko.BrowserApp (has extras)} from uid 10118
09-30 00:53:13.281 17794 17794 I Xposed  : Inspeckage_IPC:startService: Intent { act=org.mozilla.firefox.DLC.STUDY cmp=org.mozilla.firefox/org.mozilla.gecko.dlc.DownloadContentService }

Line 3 in the above is the one we need:

09-30 00:53:13.062 17794 17794 I Xposed  : Inspeckage_IPC:startActivity: Intent { act=android.intent.action.VIEW dat= cmp=org.mozilla.firefox/org.mozilla.gecko.BrowserApp (has extras) }

Putting it all together

Using this information I went to Tasker and then:

  1. created a task called "OpenTabInFirefox"
  2. added a "Send Intent" action with:
    • Action: android.intent.action.VIEW
    • Cat: Default
    • Mime Type:
    • Data:
    • Extra:
    • Extra:
    • Extra:
    • Package: org.mozilla.firefox
    • Class: org.mozilla.gecko.BrowserApp
    • Target: Activity
  3. assigned the task an icon
    • Tasker will not let you assign it to a task shortcut otherwise
  4. opened Nova launcher's settings
  5. went to "Gestures & inputs"
  6. chose a desired gesture (for example "Swipe up") and went to "SHORTCUTS"
  7. chose the "Task Shortcut"
  8. chose the task created earlier and pushed back

Now when you use your chosen gesture Firefox is opened with a new tab. The only thing I still am trying to workout is how to get Tasker to set the cursor in the address bar and open up the keyboard other than that this does exactly what I wanted it to do.