Closed Bug 1038227 Opened 10 years ago Closed 10 years ago

Collect search history in Fennec

Categories

(Firefox for Android Graveyard :: Search Activity, defect)

All
Android
defect
Not set
normal

Tracking

(firefox34 verified)

VERIFIED FIXED
Firefox 33
Tracking Status
firefox34 --- verified

People

(Reporter: eedens, Assigned: Margaret)

References

Details

Attachments

(1 file, 1 obsolete file)

Prior to launching the search activity, we want to pre-load the search history by collecting items in Fennec.  So, when a user performs a search from Fennec's url bar, it should get added to the search history db. 

Content provider: https://lxr.mozilla.org/mozilla-central/source/mobile/android/base/db/SearchHistoryProvider.java
Unit tests and examples: https://lxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/testSearchHistoryProvider.java
Attached patch Record search history in Fennec (obsolete) — Splinter Review
I put this in BrowserApp because I wasn't sure where else it should go, but I'm open to suggestions if you can think of a better place.
Attachment #8455809 - Flags: review?(rnewman)
Attachment #8455809 - Flags: review?(eedens)
Comment on attachment 8455809 [details] [diff] [review]
Record search history in Fennec

Review of attachment 8455809 [details] [diff] [review]:
-----------------------------------------------------------------

You missed a bit. Look for recordSearch in BrowserApp, which has two callers.

::: mobile/android/base/AndroidManifest.xml.in
@@ +391,5 @@
>                    android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
>  
> +        <provider android:name="org.mozilla.gecko.db.SearchHistoryProvider"
> +                  android:authorities="@ANDROID_PACKAGE_NAME@.db.searchhistory"
> +                  android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>

Two points on this:

* Didn't eedens do this when he landed it? If not, oh well, oversight!
* Think about whether this permission is suitable, or if you want to introduce a new one.

::: mobile/android/base/BrowserApp.java
@@ +937,5 @@
>          EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
>              "Menu:Update",
>              "Reader:Added",
>              "Reader:FaviconRequest",
> +            "Search:Keyword",

N.B., BrowserHealthRecorder also subscribes to this event. When BrowserApp becomes a NativeEventListener for this event, you'll need to switch BHR as well to avoid a conflict -- EventDispatcher requires all consumers to be the same type.

@@ +1381,5 @@
>                  final String url = message.getString("url");
>                  handleReaderFaviconRequest(url);
> +            } else if (event.equals("Search:Keyword")) {
> +                final ContentValues values = new ContentValues();
> +                values.put(SearchHistory.QUERY, message.getString("query"));

Check for empty or missing value?
Attachment #8455809 - Flags: review?(rnewman) → feedback+
Depends on: 1030277
Updated to address feedback. As I mentioned on IRC, I don't think we should store bookmark keyword search terms, but yes, storing search suggestions the user tapped on sounds smart.
Attachment #8455809 - Attachment is obsolete: true
Attachment #8455809 - Flags: review?(eedens)
Attachment #8456274 - Flags: review?(rnewman)
Attachment #8456274 - Flags: review?(rnewman) → review+
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/e13b40fe4740
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 33
Verified as fixed in build 34.0a1 (2014-08-04);
Device: Samsung Galaxy Nexus (Android 4.2.1).

I see that the target milestone is Firefox 33;
Will this bug be uplifted to Aurora 33?
Depends on: 1048444
Marking the bug as verified based on comment 6.
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: