Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Migrate some SessionManager usage to BrowserStore #10789

Merged
merged 1 commit into from Jun 3, 2020

Conversation

NotWoods
Copy link
Contributor

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

After merge

  • Milestone: Make sure issues finished by this pull request are added to the milestone of the version currently in development.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@csadilek csadilek self-assigned this Jun 2, 2020
@csadilek csadilek self-requested a review June 2, 2020 15:45
Copy link
Contributor

@csadilek csadilek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for starting this. Left two minor comments below and there's a lint error to fix :).

Copy link
Contributor

@csadilek csadilek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@NotWoods NotWoods force-pushed the session-to-store branch 2 times, most recently from a5e424d to 6714d4b Compare June 3, 2020 17:20
@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2020

Codecov Report

Merging #10789 into master will increase coverage by 0.01%.
The diff coverage is 21.05%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #10789      +/-   ##
============================================
+ Coverage     20.45%   20.46%   +0.01%     
+ Complexity      681      680       -1     
============================================
  Files           372      372              
  Lines         15434    15434              
  Branches       2080     2080              
============================================
+ Hits           3157     3159       +2     
+ Misses        11981    11979       -2     
  Partials        296      296              
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/org/mozilla/fenix/FenixApplication.kt 12.16% <0.00%> (-0.09%) 4.00 <0.00> (ø)
...illa/fenix/addons/InstalledAddonDetailsFragment.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...s/deletebrowsingdata/DeleteBrowsingDataFragment.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...zilla/fenix/session/NotificationSessionObserver.kt 83.33% <80.00%> (+40.47%) 2.00 <1.00> (-1.00) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ead3194...0ffff8a. Read the comment docs.

@NotWoods NotWoods merged commit a7e74e3 into mozilla-mobile:master Jun 3, 2020
@NotWoods NotWoods deleted the session-to-store branch June 3, 2020 18:18
@liuche liuche mentioned this pull request Jun 10, 2020
29 tasks
notificationService.start(context)
}
fun stop() {
scope?.cancel()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick Q: Is it a possible problem that this scope cancel is never called AFAICT? It's not lifecycle aware and we are manually starting it in FenixApplication cc @NotWoods @csadilek

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine since we want the notification to stick around

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a few store observers / scopes tied to the whole application lifecycle e.g. MigrationTelemetryListener, MigrationPushRenewer. Those never get stopped and don't need to. I guess we could've not assigned the scope and removed the stop method, but yes, it should not be a problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekager @NotWoods Actually, we do have a problem here after all! The NotificationSessionObserver is leaking the HomeActivity as it's initialized in HomeActivity.onCreate and uses it as a context. When the HomeActivitiy is re-created, we never cancel the old scope and therefore leak the old HomeActivity. You can reproduce this by enabling "Don't keep activities"...then leak canary gets pretty mad at us :).

@NotWoods I saw you were working on an uplift of this class so we can fix it there? Let's chat in our PR...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants