Closed Bug 1271318 Opened 8 years ago Closed 8 years ago

Application context within GeckoNetworkManager is unexpectedly null

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(firefox48 unaffected, firefox49blocking fixed)

RESOLVED FIXED
Firefox 49
Tracking Status
firefox48 --- unaffected
firefox49 blocking fixed

People

(Reporter: Grisha, Assigned: Grisha)

References

Details

Crash Data

Attachments

(1 file)

Bug 1271020 shows that somehow applicationContext is null at a point in time when it can't be null! How can this be so? Are we making wrong assumptions in this class or elsewhere. Pre-rewrite version of GeckoNetworkManager was performing the same null-check for activityContext, so this doesn't seem like something new (need to double-check this assumption).
GeckoNetworkManager (and GeckoBatteryManager) should use GeckoAppShell.getApplicationContext() to get the app context, instead of keeping track of the app context themselves.
(In reply to :Grisha Kruglov from comment #0) > Bug 1271020 shows that somehow applicationContext is null at a point in time > when it can't be null! How can this be so? Are we making wrong assumptions > in this class or elsewhere. > > Pre-rewrite version of GeckoNetworkManager was performing the same > null-check for activityContext, so this doesn't seem like something new > (need to double-check this assumption). From my experiences while working on Bug 1264815, I believe this is because: the `applicationContext` of those managers is not initialized properly when starting GeckoService instances in background; and recent progress on Android Push Notifications makes such starts more common.
Crash Signature: [@ java.lang.NullPointerException: at org.mozilla.gecko.GeckoNetworkManager.updateNetworkStateAndConnectionType(GeckoNetworkManager.java)]
Assignee: nobody → gkruglov
Status: NEW → ASSIGNED
Important crash, tracking.
Comment on attachment 8753065 [details] MozReview Request: Bug 1271318 - Don't keep context in GeckoNetworkManager, and get it from GeckoAppShell r=sebastian https://reviewboard.mozilla.org/r/52978/#review50170 Assuming the methods of GeckoNetworkManager are not called before GeckoAppShell is initialized (which I think makes sense - it happens in GeckoApp.onCreate), this sounds good to me.
Attachment #8753065 - Flags: review+
https://hg.mozilla.org/integration/fx-team/rev/a4491cec2aa404caba9eee49657b62acaf9335f4 Bug 1271318 - Don't keep context in GeckoNetworkManager, and get it from GeckoAppShell r=mcomella
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
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: