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

add an activity check for the permission check #5900

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Donutcheese
Copy link
Contributor

Description (required)

Fixes #INSERT_ISSUE_NUMBER_HERE

What changes did you make and why?
Added SecurityException Handling:

Wrapped the creation of DownloadManager.Request in a try-catch block to handle SecurityException if storage permission is missing. This prevents the app from crashing when permissions are revoked during download.
Checked for Non-null activity Before Enqueuing:

Added a null check for activity before calling enqueueRequest. This ensures the activity is still valid, especially when permissions are revoked or the activity is recreated.
Enhanced Documentation:

Added detailed doc comments for the class and each method, explaining the purpose and functionality of the code, making it more readable and maintainable.

Tests performed (required)

Tested {build variant, e.g. ProdDebug} on {name of device or emulator} with API level {API level}.
ProdDebug on samsung zflip6, 34 api
Screenshots (for UI changes only)

Need help? See https://support.google.com/android/answer/9075928


Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.

Copy link
Member

@misaochan misaochan left a comment

Choose a reason for hiding this comment

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

Formatting/code style changes should ideally go into a separate PR. Also, could you please edit your description to replace #INSERT_ISSUE_NUMBER_HERE with the issue you are fixing? Thanks.

if (str1.equals(str2)) return 0;
if (str1.length() == 0) return str2.length();
if (str2.length() == 0) return str1.length();
if (str1.equals(str2)) {
Copy link
Member

Choose a reason for hiding this comment

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

There appear to be a lot of formatting changes in this PR. In my opinion these changes do make the code more readable, however they aren't relevant to the issue being addressed. Could you please revert the formatting changes and only keep the code changes? Thanks!

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.

2 participants