focus-android
focus-android copied to clipboard
Create a search widget
Why/User Benefit/User Problem
Android users are now used to engaging with the Google search widget in order to give the browser a signal that they desire to engage with a voice or text search directly from the home screen. For improved convenience Focus should help fulfill this use case.
What / Requirements
As a user on the home screen I can initiate a text search by clicking on the search widget. As a user on the home screen I can initiate a voice search by clicking on the search widget. As a user I can customize the size of the search widget. As a user I can add a widget to the home screen or remove it
Acceptance Criteria (how do I know when I’m done?)
- If Focus is installed I can add a search widget from the home screen (a widget is listed under the Firefox entry in the widgets menu)
- If a widget is added to home screen I can resize it horizontally by long tapping it. As size reduces only text search becomes possible
- If a widget is added to home screen I can remove it
- If Focus is uninstalled the widget gets removed from the home screen
- The widget has a focus logo, some text that signals that users can text search and a microphone icon that signals that users can voice search
- If a user engages with text search, Focus opens with focus on the search bar and keyboard opened
- If a user engages with voice search, the Google voice recognition capability opens to start recording the voice. After a timeout either the Google voice recognition capability prompts the user to say something (no voice was detected), or Focus opens search results for the recognized string of text (voice was detected) using the default search provider
- Ensure widget design is extensible to allow for future addition of QR code scanning
- Event Telemetry identifies that the application was launched using the search widget (text or voice search can be segmented)
- Environment telemetry identifies that the search widget is installed
FYI legal confirmed we're good to go with this feature
@jeffreygee Can you please provide the UX for the widget?
For eng: we should try to move the Fenix search widget to AC (probably the feature-search component) in a reusable way so that we don't have to copy-paste the code.
We can copy-paste the Fenix code to AC as an abstract class which can then be extended on Fenix and Focus for providing their own pending intents and maybe override standardized resource ids for the app icon and content description for a11y services.
There is also Jetpack Glance that allows for building the widgets using compose but given that is still in alpha and we want to have a stable implementation in AC maybe we should stick with the battle tested AppWidgetProvider
.
@jeffreygee Can you provide a link to the latest designs for Focus implementation for this? Thanks!
Widget mocks here: https://www.figma.com/file/nCvlz8wsL1w7dLPag32Syz/Widget?node-id=2%3A277
The microphone will always appear on the widget . It will not be an option in settings with on/off for voice like in Fenix . Is it ok ? @rtestard @jonalmeida
The microphone will always appear on the widget . It will not be an option in settings with on/off for voice like in Fenix . Is it ok ? @rtestard @jonalmeida
Yes this is the intention.
When testing with app-focus-armeeeabi-v7a-debug.apk I noticed that if Focus was not closed previously and i launch a text search then the focus is not on the search bar and keyboard opened , the app only opens. Could we adjust so focus on this case is on the search bar with keyboard opened?
If the user didn't saw the onboarding and he clicks on the search widget he will not see it, but if enters normally in the app he will see the onboarding. When the user enters in the app from search widget the keyboard will appear the focus will be on browser toolbar . @rtestard This is correct ?
Agreed
Verified as fixed on the latest Focus Nightly 105.0a1 from 08/22 with Xiaomi 12 Pro (Android 12) and Lenovo Yoga Tab 11 (Android 11).

Verified as fixed on Focus Beta 105.0b1 as well, with Lenovo Yoga Tab 11 (Android 11).