Closed Bug 1131087 Opened 9 years ago Closed 7 years ago

Search activity will use geo default instead of user-set default

Categories

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

35 Branch
All
Android
defect

Tracking

(firefox44 wontfix, firefox45 wontfix, firefox46- wontfix, firefox47 wontfix, firefox48 wontfix, firefox49+ wontfix, fennec+, firefox50 wontfix, firefox51 wontfix, firefox52 fix-optional, firefox53 fix-optional, firefox54 fix-optional)

RESOLVED WONTFIX
Tracking Status
firefox44 --- wontfix
firefox45 --- wontfix
firefox46 - wontfix
firefox47 --- wontfix
firefox48 --- wontfix
firefox49 + wontfix
fennec + ---
firefox50 --- wontfix
firefox51 --- wontfix
firefox52 --- fix-optional
firefox53 --- fix-optional
firefox54 --- fix-optional

People

(Reporter: Margaret, Unassigned)

References

Details

(Keywords: regression)

STR:

1) Set a non-default engine as your default (e.g. DDG)
2) Upgrade to a version of Fennec with the patches from bug 1129576
3) If you're in the US, your default search engine in the search activity will now be Yahoo, not DDG
36 WONTFIX?
(In reply to Aaron Train [:aaronmt] from comment #1)
> 36 WONTFIX?

Probably. We need a plan for dealing with "userengine" and "cachedengine". We are using a single SharedPref for both intents. Bug 1129576 clears the SharedPref so we can re-check the "cachedengine".

People can just pick their favorite engine again, which is not friendly and we might do this clear-the-cache again in the future.
tracking-fennec: ? → 37+
Assignee: nobody → mark.finkle
Mark and Aaron, I hope you'll take a second look at this because this may be more broken than you realize.

I'm running Android Firefox Beta 36.0 on a Nexus 4.  Selecting my preferred default engine (Google) multiple times did not result in it being used.

History:
* I used Google before the Yahoo default default change.
* I switched my default to Google upon the Yahoo change.
* Search results came from Google for a while.
* Search results starting coming from Yahoo.
* I select Google as my default again.
* Search results keep coming from Yahoo.
* I select Google as my default again again.
* Search results keep coming from Yahoo, again.
* I delete Yahoo as a search provider.
* Search results finally come from my default, Google.

If nothing else, I guess I can tell Margaret that deleting Yahoo as a search provider may be a work-around for her, but I suspect that's not an ideal outcome.
(In reply to petebiz from comment #3)
> Mark and Aaron, I hope you'll take a second look at this because this may be
> more broken than you realize.
> 
> I'm running Android Firefox Beta 36.0 on a Nexus 4.  Selecting my preferred
> default engine (Google) multiple times did not result in it being used.
> 
> History:
> * I used Google before the Yahoo default default change.
> * I switched my default to Google upon the Yahoo change.
> * Search results came from Google for a while.
> * Search results starting coming from Yahoo.
> * I select Google as my default again.
> * Search results keep coming from Yahoo.
> * I select Google as my default again again.
> * Search results keep coming from Yahoo, again.
> * I delete Yahoo as a search provider.
> * Search results finally come from my default, Google.
> 
> If nothing else, I guess I can tell Margaret that deleting Yahoo as a search
> provider may be a work-around for her, but I suspect that's not an ideal
> outcome.

To confirm, since this bug is related to the search-activity (outside the browser i.e, 'Firefox Beta Search' in your launcher). Are you searching from within that or within Firefox?

Also, are you located in the U.S?
Everything I'm describing relates to searches inside the Android Firefox Beta app itself, in what I'd call the awesome bar if it was desktop Firefox.
By the way, I just checked and do NOT see this behavior on my 2012 Nexus 7.  I've only experienced this on my Nexus 4.
Flags: needinfo?(margaret.leibovic)
Sorry for taking so long to look into this bug... I suspect what petebiz is seeing is us switching the default back to Google in late betas before updating to release [1], and then switching back to Yahoo.

Unfortunately, we don't have any way of knowing whether a user set their default search engine back to the original default, so when we changed from Yahoo->Google as the app default, there was no noticable difference, but then when we changed the default again from Google->Yahoo, we would assume that the default hadn't been modified, so we migrated it again.

In any case, this issue does not have to do with the search activity, which is what we're trying to track in this bug, so let's move that discussion to a new bug if it needs to continue, and keep this bug about the search activity.

[1] http://hg.mozilla.org/releases/mozilla-beta/rev/69d50177865b
Flags: needinfo?(margaret.leibovic)
Actually, the issues described here sound like a combination of that beta churn and bug 1073775. So I think they should be resolved now.
To update, despite what I said about my Nexus 7 not exhibiting it, it now is.  It was rebooted in between my first report and now.

The behavior of my Nexus 7, right now, running Android L 5.0.2, Firefox 37.0:

 * Settings,Customize,Search shows Google as my default search engine (NOT yahoo)
 * I just now typed "house bill" without the quotes into the address bar
 * I got search results from yahoo.
 * I set Yahoo as default search
 * I set default back to Google
 * I search for "house bill" without the quotes, and I got Google search results

So despite the interface explicitly showing me Google as my default, it was sending searches to Yahoo until I changed it away from Google and then back.

***So perhaps the bug is more limited in that it displays an incorrect default.***  I never tried before switching away and back on my Nexus 4, but the Nexus 4 certainly did report Google as my default while still returning Yahoo results, just as the Nexus 7 did until switching away and then back to Google.
Is this going to be able to make Beta? We have a shortened release cycle in 37.
Flags: needinfo?(mark.finkle)
Comment 9 sounds exactly like bug 1073775. Given that the actual search is returning the correct engine, I am not inclined to get risky and try to push a fix. If we can get more confirmation on the STR, we can start looking into an additional fix.

Re-noming for tracking.
tracking-fennec: 37+ → ?
Flags: needinfo?(mark.finkle)
@petebiz - Can you retest with the most recent Beta?
Adding here the STR's from bug 1142238 :

"I'm able to reproduce this issue when changing the default search engine for the first time. Changing it for the second time shows the correct behavior.   

If: 
1. Start Firefox with a clean profile. 
2. Add the Firefox search widget to the home screen 
3. Change the default search engine to anything else from list (e.g DDG)

Result: Firefox searches are conducted through DDG. Firefox widget searches are conducted through Google 
     
4. Change the default search engine again to anything else from list (e.g Amazon)

Result: Firefox searches are conducted through Amazon. Firefox widget searches are conducted through Amazon 

Tested on Galaxy Note 3 with Android 4.4.2"
Assignee: mark.finkle → margaret.leibovic
tracking-fennec: ? → +
Mark, should we be tracking this, and if so, when will we see some activity?
Flags: needinfo?(mark.finkle)
302 -> Margaret
Flags: needinfo?(mark.finkle) → needinfo?(margaret.leibovic)
I want to make sure we sort out what behavior we want and that it is correct. It seems very unclear here. Tracking for 49 so I keep an eye on this.
We want the user set default, this is a bug.

However, the search activity is not being actively prioritized right now, we have more important problems to solve.

I haven't had time to look into this myself, and realistically I'm not going to. Maybe mkaply would be interested in taking a look, since he's been touching more of the search stuff recently. Really what I want is to drop the Gecko search service, so we don't end up with bugs like this.
Assignee: margaret.leibovic → nobody
Flags: needinfo?(margaret.leibovic) → needinfo?(mozilla)
I'll see what I can figure out.
Assignee: nobody → mozilla
Flags: needinfo?(mozilla)
has the priority of this bug changed?
Flags: needinfo?(margaret.leibovic)
(In reply to Jim Mathies [:jimm] from comment #24)
> has the priority of this bug changed?

This is not a top priority because the search activity is not highly used.

It would be good to fix this, yes, but there are other things that are more pressing.
Flags: needinfo?(margaret.leibovic)
After having experienced similar trouble with the crash reporter, I think that part (or possibly even most) of the problem might be down to the fact that the search activity runs in a different process, yet is accessing Firefox's app shared preferences.
Android doesn't play too well with the same shared preferences instance being used from different processes and it is entirely possible that one process won't notice the changes made by the other process, because the shared preferences seem to be read from disk only once during the lifetime of the process.
A simple solution would be to pass Context.MODE_MULTI_PROCESS here (https://dxr.mozilla.org/mozilla-central/rev/46fe2115d46a5bb40523b8466341d8f9a26e1bdf/mobile/android/base/java/org/mozilla/gecko/GeckoSharedPrefs.java#101), which would force the shared preferences to be always reread from disk, although that's not super desirable, either and in any case has been deprecated as of API23.

Additionally, while it would no longer be necessary to actually kill the search activity's process in order for a search engine change to be picked up, it would still be necessary to exit the activity (e.g. by pressing back) and reenter it, because the shared preferences are read directly only during activity creation. Afterwards, the search engine manager attempts tracking any changes to the shared preferences (https://dxr.mozilla.org/mozilla-central/rev/46fe2115d46a5bb40523b8466341d8f9a26e1bdf/mobile/android/base/java/org/mozilla/gecko/search/SearchEngineManager.java#93) and pass any search engine changes back to the search activity as they happen, however in practice this doesn't seem to be working. After a bit of googling around, it seems highly probable that shared preferences change listeners are only functioning within the same process, but not across two different processes. So in our case, the search activity's SearchEngineManager is never notified about any changes to the shared preferences.
Priority: -- → P3
Hi Sebastian, Barbara, I am confused why this is a P3. Resetting a user-set search engine to a geo location is annoying on a Fennec update. It sounds like a pretty core scenario. Thoughts? I hope we can fix it in Fx50/51.
Flags: needinfo?(s.kaspari)
Flags: needinfo?(bbermes)
The search widget is not a default UI the user needs to go deep into the Android OS UI to find it (comment 25). It also requires the user to add the search widget to the homescreen then switch the search settings in Firefox from the default search engine (comment 15). There is a fairly simple workaround of switching it back and forth once that gets it back in sync.
(In reply to Kevin Brosnan [:kbrosnan] from comment #29)
> The search widget is not a default UI the user needs to go deep into the
> Android OS UI to find it (comment 25). It also requires the user to add the
> search widget to the homescreen then switch the search settings in Firefox
> from the default search engine (comment 15). There is a fairly simple
> workaround of switching it back and forth once that gets it back in sync.

This.

The search widget and activity are currently not really maintained. We are actually looking into whether it is worth keeping to ship them. If it is then we definitely need to invest more time into it. Hence I moved it to the backlog (P3).
Flags: needinfo?(s.kaspari)
(In reply to Sebastian Kaspari (:sebastian) from comment #30)
> (In reply to Kevin Brosnan [:kbrosnan] from comment #29)
> > The search widget is not a default UI the user needs to go deep into the
> > Android OS UI to find it (comment 25). It also requires the user to add the
> > search widget to the homescreen then switch the search settings in Firefox
> > from the default search engine (comment 15). There is a fairly simple
> > workaround of switching it back and forth once that gets it back in sync.
> 
> This.
> 
> The search widget and activity are currently not really maintained. We are
> actually looking into whether it is worth keeping to ship them. If it is
> then we definitely need to invest more time into it. Hence I moved it to the
> backlog (P3).

Thanks Kevin ang Sebastian, I understand. Doesn't seem like this will get fix in 50, marking it as fix-optional.
Flags: needinfo?(bbermes)
We looked at this during regression triage. It seems unfriendly to unset a user's preferred search engine, do we want to continue tracking this for a fix?
Flags: needinfo?(snorp)
Flags: needinfo?(mozilla)
Flags: needinfo?(snorp) → needinfo?(s.kaspari)
Not much has changed since comment 25. Only the search activity is affected and this one has not a high priority. In fact I would like to look at telemetry to see whether it's worth keeping at all.
Flags: needinfo?(s.kaspari)
So even though the search engine has been changed in Firefox preferences, when the search activity queries the search engine, it's getting the previous search engine. It only gets the new preference when Fennec has been completely closed.

Is it possible that when the search engine is changed it's not getting written immediately to the place where the activity/engine manager queries it?

Here's where we end up getting the previous engine:

https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/search/SearchEngineManager.java#264
Flags: needinfo?(mozilla)
@mkaply

Please see comment 26 - shared preferences are not meant to be used across processes.
Given that this is officially classified as a backlog bug, it doesn't seem worth tracking it in any way.
Taking off my plate.
Assignee: mozilla → nobody
I'm using Firefox Beta 54. Prior to the latest update, the search functiin in the widget switched to Yahoo, although my default in Firefox remained DuckDuckGo. Deleting Yahoo from the list of search engines, changing from DDG to another search engine and back again, and rebooting the phone all left the widget set to search via Yahoo. There is no apparent way to change the setting.
This is an ex-Search Activity now (bug 1221344).
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.