Closed Bug 1372623 Opened 7 years ago Closed 3 years ago

Nightly update prompted: Play store-distributed fennec_aurora build doesn't think it was installed via Play

Categories

(Firefox for Android Graveyard :: General, defect, P3)

55 Branch
defect

Tracking

(fennec+, firefox56+ wontfix, firefox57+ wontfix, firefox58 ?)

RESOLVED INCOMPLETE
Tracking Status
fennec + ---
firefox56 + wontfix
firefox57 + wontfix
firefox58 --- ?

People

(Reporter: kats, Unassigned)

References

Details

I used to have Fennec Aurora on my device, updating through the play store. Recently Aurora turned into "Nightly for Developers" and now it updates both through the play store and through the built-in updater. This means that I get update notifications from the build, and if the play store gets around to updating before I do the manual update, then tapping on the notification has no visible effect (presumably because the notification is stale and the build was already updated). I'm not sure if this is causing double bandwidth usage as well or what, but anyway - the build distributed through the play store shouldn't be giving me manual update notifications.
Since Bug 1220773 (Firefox 50) the updater shouldn't run if you installed the app through Play.

Did you ever install directly via an APK? IOW, can you reproduce with a fresh install via Play?
Flags: needinfo?(bugmail)
(In reply to Richard Newman [:rnewman] from comment #1)
> Since Bug 1220773 (Firefox 50) the updater shouldn't run if you installed
> the app through Play.
> 
> Did you ever install directly via an APK? IOW, can you reproduce with a
> fresh install via Play?

As best I can recall, I originally had aurora installed manually via APK. When we added it to the play store I uninstalled the APK and installed it from the play store. I can try a fresh install via the play store but that would be an option of last resort because I'd have to set up my preferences all over again which I'd like to avoid.

FWIW if I go into the advanced settings screen for this "Nightly for Developers" build, there is still an "Automatic updates" option which was set to "Only over Wi-Fi". I just set it to "Never" to see if that helps.
Flags: needinfo?(bugmail)
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #2)

> FWIW if I go into the advanced settings screen for this "Nightly for
> Developers" build, there is still an "Automatic updates" option which was
> set to "Only over Wi-Fi". I just set it to "Never" to see if that helps.

You should not see the Updater preferences if Fennec thinks it was installed from Play.

https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java#718

I've changed the title of the bug to match: the issue isn't the updater, it's that `isInstalledFromGooglePlay` is returning `false` on your install.

We need to attempt to repro this; it's possible that your device is remembering how this package name was _first_ installed, rather than _last_ installed (for most users that's the same thing), or it's possible that the check is buggy.
Summary: Remove the updater option from the play store-distributed fennec_aurora build → Play store-distributed fennec_aurora build doesn't think it was installed via Play
I have the same issue except that I never installed the old APK, only from google play.
This on a brand new android z3c.

Ben, Rail, does it ring a bell? Thanks
Flags: needinfo?(rail)
Flags: needinfo?(bhearsum)
(In reply to Sylvestre Ledru [:sylvestre] from comment #4)
> I have the same issue except that I never installed the old APK, only from
> google play.
> This on a brand new android z3c.
> 
> Ben, Rail, does it ring a bell? Thanks

I vaguely remember hearing about something like this in the past few months but I can't find any references to it...
Flags: needinfo?(bhearsum)
TBH, I have no idea how it works :/
Flags: needinfo?(rail)
Tracking 56+ based on Comment 4 - we should figure out what is going on here. ni on Ioana for investigation.
Flags: needinfo?(ioana.chiorean)
Florin, as Ioana is in PTO, could you find someone else to help? Thanks
Flags: needinfo?(florin.mezei)
Moving to Mihai Ninu, to see if we can have someone on their team look at this.
Flags: needinfo?(florin.mezei) → needinfo?(mihai.ninu)
I get this annoying message at least once a day.
I guess most of the people don't get this error otherwise we would have much more activity on this bug.
Summary: Play store-distributed fennec_aurora build doesn't think it was installed via Play → Nightly update prompted: Play store-distributed fennec_aurora build doesn't think it was installed via Play
Hi everyone, 

I've done some investigation on this issue, sorry it took too long but I had to make sure that is reproducible 100%.

I am experiencing the same issue on my Samsung Galaxy S6 EDGE (Android 7.0). But i can't see it on a Nexus 7 (Android 5.1.1).

Since I could not test it with a Google Play Aurora build, I've tried  it with the Nightly Gplay installed Build. Both notifications are received (Gplay and from the the Nightly build).
Flags: needinfo?(mihai.ninu)
guys, do you know who could help? This is boring enough that I could remove fennec nightly.
Flags: needinfo?(ted)
Flags: needinfo?(snorp)
I have Nightly installed from Play (Pixel, 7.1.2) and I don't see the update prompt. Mihai do you have STR? Did you just install Nightly fresh?
Flags: needinfo?(snorp) → needinfo?(mihai.ninu)
I think snorp is the best person to direct this.
Flags: needinfo?(ted)
I just installed the Nightly from Google Play and waited for a day so that the build would get update notification from the Playstore.
Flags: needinfo?(mihai.ninu)
(In reply to Mihai Ninu {:Ninu} from comment #16)
> I just installed the Nightly from Google Play and waited for a day so that
> the build would get update notification from the Playstore.

An update notification from the Play store is expected. This bug is about seeing the notifications from the old built-in updater. Do you see those?
Flags: needinfo?(ioana.chiorean) → needinfo?(mihai.ninu)
Yes, that's what I was seeing on a fresh install from the Play Store. I ended up just uninstalling it because it was too annoying to deal with and now I use Focus anyway.
snorp, sounds like the issue is still a problem. Can you take this on?  Are you able to reproduce the issue at all? 

I still don't completely understand what's happening from the comments. I have Nightly installed from the Play Store and don't see any extra update notifications.
Flags: needinfo?(snorp)
I was going to take a look, but didn't get time this week. I'm off next week. Eugen, you've worked on the updater a bit, can you take a look? I'm not sure how or if we disabled the built-in updater when installed from the Play Store.
Flags: needinfo?(snorp) → needinfo?(esawin)
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #20)
> I'm not sure how or if we disabled the built-in updater when
> installed from the Play Store.

See Comment 3.
(In reply to Richard Newman [:rnewman] from comment #21)
> (In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #20)
> > I'm not sure how or if we disabled the built-in updater when
> > installed from the Play Store.
> 
> See Comment 3.

Ah! Somehow I had missed that. I think we should probably just check that getInstallerPackageName() is non-null, meaning it was installed by some type of store. My theory is that the package name for Play might differ on some devices or versions of Android.
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #22)

> Ah! Somehow I had missed that. I think we should probably just check that
> getInstallerPackageName() is non-null, meaning it was installed by some type
> of store. My theory is that the package name for Play might differ on some
> devices or versions of Android.

This seems like something we can definitely test on kats's phone, no? Land a commit that logs `gIPN`, wait for it to get into Play, and see what it says on an affected device.
Sounds good to me, I can check that if you land the patch. FWIW if I go into the android settings -> Apps and look at "Google Play Store" it does list com.android.vending as the application id. But I'm using CyanogenMod so maybe the API reports something different.
With bug 1221646, we should already log this string in a "SendUIEvent" debug log.

Kats, can you please check the Telemetry SendUIEvent logs for the extra string "installer_<package name>"?
Flags: needinfo?(esawin) → needinfo?(bugmail)
Hm. So I had previously uninstalled my Play Store-Nightly because of this problem. I installed it again today and the SendUIEvent log says this:
  SendUIEvent: event = launch.1 method = system timestamp = 6580516482 extras = installer_com.android.vending

but also in the app settings I don't see the "Automatic updates" advanced option that I had previously seen (comment 2). So in effect I'm not sure I can reproduce the problem right now, and the nightly I got from the play store is reporting com.android.vending as the installer package name.
Flags: needinfo?(bugmail)
Sebastian, can you check telemetry for this event? Is there anything suspicious there?

Should getInstallerPackageName turn out to be unreliable, then we can either ignore the actual string and only check against null or we find another way to disable the updater (e.g., build flag or pref).
Flags: needinfo?(s.kaspari)
Telemetry is here:
https://sql.telemetry.mozilla.org/queries/751#1295

Nightly builds report to be installed from:

* 74.5% - com.android.vending (That's what we are looking for)
* 22.3% - <null>
*  1.2% - com.android.packageinstaller
*  1.1% - com.google.android.packageinstaller
* The rest is a weird mix of all kinds of package names and random values

Overall this doesn't look too bad.

From the Android docs for setInstallerPackageName():

> Change the installer associated with a given package. There are limitations
> on how the installer package can be changed; in particular:
> 
> *  A SecurityException will be thrown if installerPackageName is not signed
>    with the same certificate as the calling application.
> 
> *  A SecurityException will be thrown if targetPackage already has an
>    installer package, and that installer package is not signed with the
>    same certificate as the calling application. 

https://developer.android.com/reference/android/content/pm/PackageManager.html#setInstallerPackageName(java.lang.String,%20java.lang.String)

I assume those are cases where the APK was intalled from a different source at some point and the package manager still had an installer value set that could not be updated to "com.android.vending".
Flags: needinfo?(s.kaspari)
> I assume those are cases where the APK was intalled from a different source at some point and the package manager still had an installer value set that could not be updated to "com.android.vending".

I used the Google play store shipped with the Sony Z3C system. I haven't done anything fancy but I did received this prompt.
Hi everyone
Sorry for the late response on this issue but i was on PTO for the past two weeks.
I've installed again the Nightly build from the Google Play market on 5 different devices (list below) and left them two days to be sure that the nightly update is available. 
I didn't receive the built-in updater notification on the devices, just the Google play notification while it was updating (on the devices that had auto-update on).

I've managed to discover a new awkward behavior. While there is an update available as seen in the Gplay Market (available updates section), when going to about:firefox and tapping on "Check for updates" , no updates can be found.

Devices used:

Samsung Galaxy S6 EDGE - Android 7.0
Xiaomi mi i4 - Android 5.0.2
Nexus 6P - Android 8
Sony Xperia X - Android 6.0.1
Samsung Galaxy S8 - Android 7.0
Flags: needinfo?(mihai.ninu)
Sylvestre, can you please share your logs (see comment 25), if you can still reproduce this?
Flags: needinfo?(sledru)
I don't have access to the phone anymore (lost a fight against water :(
Flags: needinfo?(sledru)
Checking for getInstallerPackageName != null will give us false positives (e.g, "com.xiaomi.market"), and based on https://sql.telemetry.mozilla.org/queries/751 30% of our beta users have no IPN set, which is disturbing.
The query https://sql.telemetry.mozilla.org/queries/7309/ to group the beta results by locale exceeds max memory.

In theory, our check is correct and making it less strict would most likely introduce issues on devices running some GPlay alternative.
I'm not sure what we could do here, short of manually setting MOZ_UPDATER for each distribution and removing the runtime checks.
(In reply to Mihai Ninu {:Ninu} from comment #30)

> I didn't receive the built-in updater notification on the devices, just the
> Google play notification while it was updating (on the devices that had
> auto-update on).

Excellent.

> I've managed to discover a new awkward behavior. While there is an update
> available as seen in the Gplay Market (available updates section), when
> going to about:firefox and tapping on "Check for updates" , no updates can
> be found.

That is exactly the expected behavior, I think.

IIRC the docs for Android and Play ask that you not do your own update checks when installed via Play, and that extends to manual update checks. I think we should be hiding the 'Check for updates' button in that case.
Given that we are one week away from RC, mark 56 won't fix.
This may still be an issue, too late to fix for 57 though we could still take a patch for 58. 
Max or liuche, Should we keep this bug open? Is it still a problem?
Flags: needinfo?(max)
Flags: needinfo?(liuche)
Clearing NI for me because I don't develop on Fennec any more.

fwiw, I see the update notification still on my Nightly build from the Play Store still, so I think this is still an issue.

NI-ing Joe to get a prioritization for the Fennec team.
tracking-fennec: --- → ?
Flags: needinfo?(liuche) → needinfo?(jcheng)
Add Wesly
Flags: needinfo?(wehuang)
tracking-fennec: ? → +
Per comment 30 and comment 34 sounds this is not an issue now? Comment 33 has checked the code, and from comment 26 and comment 32 we may not able to check it further. I am closing it for now until further suggestion.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(wehuang)
Resolution: --- → INVALID
I still experience this issue.

I think this can be reproduced if you disable updates for Firefox in Google Play Store, but not sure what must be done next.
This is third time when this happened to me. When happened first time, I simply reinstalled Firefox.

Its possible that in meantime I taped Update button in about:firefox.
Also, I was updating manually when Play Store asked me to do so.

For example, week ago I cleaned Firefox data using Android Applications Settings. After that this update prompts stops appearing. Day later Firefox successfully auto-updated from Play Store. I decided to stop updates for a while (concerns about data usage), so I disabled updates in Play Store for Firefox. Yesterday, Firefox native update prompt pops-up.
Removed my settings again, just now. Moment later Firefox native update pop-ups... I ignored it and updated from Play Store - will see what happens next.

Update section in Advance Settings is not available now.
I'm also seeing this again, after I rebooted my phone on the weekend.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
discussed with the team here. indeed bothering and the bright side is it's nightly only. set P2 for now.
Priority: -- → P2
Not related to Play Store update blocking. After fresh install week ago, today new update prompt appeared.
Flags: needinfo?(max)
[triage] Sounds like it's aurora -> nightly audience only, which was small, iirc. Also, this is a pre-release audience who can probably deal with the annoyance/things-not-working: non-critical.
Flags: needinfo?(jcheng)
Priority: P2 → P3
IMHO, they probably stopped using it as it is a big pain (it is what I have done)
jya mentioned that this started happening for him, and that
> i believe it got re-installed using the samsung smart thing when i got a new phone

rnewman suggested that
> perhaps it's worth filing a bug to _record_ the install in the profile

although that would only help for cases where this happens either after restoring from a backup (although we've disabled normal Android backups, so this would only be possible for rooted users or in theory with some manufacturer-specific backup that overrides the normal Android backup process), or else if somehow the phone spontaneously forgets about us having been installed from the Play Store during normal operations.

If on the other hand isInstalledFromGooglePlay() only ever returns false right from the start, we'd still be stuck.
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: REOPENED → RESOLVED
Closed: 7 years ago3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.