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

[PermissionsAndroid] Prevent app from crashing when getCurrentActivity is null #10351

Closed
wants to merge 2 commits into from

Conversation

cmcewen
Copy link
Contributor

@cmcewen cmcewen commented Oct 12, 2016

We're seeing a lot of crashes from PermissionsModule not being able to access the current activity, mentioned in #10009 and here: #9310 (comment)

As far as I can tell, there is no way to ensure the Activity exists since the ReactContext holds a WeakReference to the current Activity and it appears that the lifecycle calls are happening in the right order (so not the same as #9310).

This will at least allow people to catch the error in JS and update the UI or try again as opposed to crashing the app.

I'm working on some bigger changes in #10221 but this is a smaller change and important to get fixed I think.

@cmcewen cmcewen changed the title [AndroidPermissions] Prevent app from crashing when getCurrentActivity is null [PermissionsAndroid] Prevent app from crashing when getCurrentActivity is null Oct 12, 2016
@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @andreicoman11 and @mikelambert to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Oct 12, 2016
@satya164
Copy link
Contributor

Thanks a lot!

@facebook-github-bot shipit

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Oct 12, 2016
@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are a Facebook employee, you can view this diff on Phabricator.

@satya164
Copy link
Contributor

cc @grabbou can we cherry-pick this to the stable release?

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 12, 2016
@aouaki
Copy link

aouaki commented Oct 14, 2016

Hey guys, we're seeing a lot of crashes on Android and this should fix them. Could we get this commit in the 0.36 ?

Thanks!

@grabbou
Copy link
Contributor

grabbou commented Oct 15, 2016

Hey @aouaki, I've added this commit to the pending rc.2 release of 0.36 - should be up soon. You can follow the status here -> #10329

grabbou pushed a commit that referenced this pull request Oct 25, 2016
Summary:
We're seeing a lot of crashes from `PermissionsModule` not being able to access the current activity, mentioned in #10009 and here: #9310 (comment)

As far as I can tell, there is no way to ensure the Activity exists since the `ReactContext` holds a `WeakReference` to the current Activity and it appears that the lifecycle calls are happening in the right order (so not the same as #9310).

This will at least allow people to catch the error in JS and update the UI or try again as opposed to crashing the app.

I'm working on some bigger changes in #10221 but this is a smaller change and important to get fixed I think.
Closes #10351

Differential Revision: D4010242

fbshipit-source-id: 7a76973bb2b3e45817d4283917740c89a10ec0b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants