Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update context tracking to use lifecycle callbacks #238

Merged
merged 6 commits into from
Feb 13, 2018

Conversation

fractalwrench
Copy link
Contributor

ActivityManager#getRunningTasks was deprecated on Lollipop and above. This PR changes the automatic Report context so that it is set as the name of the most recently launched Activity which is in the started state, or null if this condition cannot be met.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1047

  • 12 of 13 (92.31%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.1%) to 70.62%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sdk/src/main/java/com/bugsnag/android/SessionTracker.java 7 8 87.5%
Files with Coverage Reduction New Missed Lines %
sdk/src/main/java/com/bugsnag/android/AppData.java 1 82.93%
sdk/src/main/java/com/bugsnag/android/DeviceData.java 2 74.17%
sdk/src/main/java/com/bugsnag/android/Client.java 3 51.37%
Totals Coverage Status
Change from base Build 1038: 0.1%
Covered Lines: 1697
Relevant Lines: 2403

💛 - Coveralls

@coveralls
Copy link

coveralls commented Feb 6, 2018

Pull Request Test Coverage Report for Build 1093

  • 12 of 13 (92.31%) changed or added relevant lines in 2 files are covered.
  • 212 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.4%) to 70.676%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sdk/src/main/java/com/bugsnag/android/SessionTracker.java 7 8 87.5%
Files with Coverage Reduction New Missed Lines %
sdk/src/main/java/com/bugsnag/android/AppData.java 1 84.09%
sdk/src/main/java/com/bugsnag/android/Breadcrumbs.java 2 93.33%
sdk/src/main/java/com/bugsnag/android/DeviceData.java 2 75.78%
sdk/src/main/java/com/bugsnag/android/Report.java 4 75.76%
sdk/src/main/java/com/bugsnag/android/Configuration.java 11 89.68%
sdk/src/main/java/com/bugsnag/android/Bugsnag.java 52 10.34%
sdk/src/main/java/com/bugsnag/android/Client.java 140 52.58%
Totals Coverage Status
Change from base Build 1079: 0.4%
Covered Lines: 1757
Relevant Lines: 2486

💛 - Coveralls

@@ -24,8 +25,8 @@
private static final String KEY_LIFECYCLE_CALLBACK = "ActivityLifecycle";
private static final int DEFAULT_TIMEOUT_MS = 30000;

private final ConcurrentHashMap<String, Boolean>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the change here? I'd be a bit concerned as this set is accessed using a few different code paths. Even if only the key is used, all this does is derive a concurrency-safe set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kattrali I've changed it to a LinkedHashSet as that retains the ordering of values. The testBasicInForeground covers the case where multiple activities launch, then one stops, and we need to access the previous activity name.

Maybe a ConcurrentLinkedDeque would be a better choice for this, if you're happy with the general approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah the approach is solid - ConcurrentLinkedDeque seems ideal for this case as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use a ConcurrentLinkedDeque.

@kattrali
Copy link
Contributor

Something went awry with the linter but I don't see what.

… and only anticipate small number of elements
@fractalwrench
Copy link
Contributor Author

Android Lint was failing as ConcurrentLinkedDeque is only available from API 21. I've changed the collection to use ConcurrentLinkedQueue instead, as that's been available from API 1, and we're not anticipating a large number of elements in this field.

@kattrali kattrali merged commit 537947b into master Feb 13, 2018
@kattrali kattrali deleted the update-context-tracking branch February 13, 2018 22:48
lemnik pushed a commit that referenced this pull request Jun 2, 2021
Avoid unnecessary SO mapping file uploads for ABI splits
rich-bugsnag pushed a commit that referenced this pull request Sep 3, 2021
Placeholder e2e tests for Android target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants