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

[$500] Android - Attachment- App crashes on opening specific image #31204

Closed
1 of 6 tasks
lanitochka17 opened this issue Nov 10, 2023 · 27 comments
Closed
1 of 6 tasks

[$500] Android - Attachment- App crashes on opening specific image #31204

lanitochka17 opened this issue Nov 10, 2023 · 27 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 10, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.3.98-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Launch app
  2. Tap on a report
  3. Tap plus icon near compose
  4. Tap Add attachment
  5. Upload specific image attached below
  6. Tap send
  7. Tap on the image

Expected Result:

Tapping on specific image app must not crash

Actual Result:

Tapping on specific image app crashes

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6271713_1699645547418.atta_h.mp4

log.txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e0a96dfdf9f4a360
  • Upwork Job ID: 1723067228082819072
  • Last Price Increase: 2023-11-17
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 10, 2023
Copy link

melvin-bot bot commented Nov 10, 2023

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot changed the title Android - Attachment- App crashes on opening specific image [$500] Android - Attachment- App crashes on opening specific image Nov 10, 2023
Copy link

melvin-bot bot commented Nov 10, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01e0a96dfdf9f4a360

Copy link

melvin-bot bot commented Nov 10, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 10, 2023
Copy link

melvin-bot bot commented Nov 10, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External)

Copy link

melvin-bot bot commented Nov 10, 2023

📣 @3owa! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@3owa
Copy link

3owa commented Nov 10, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01f65412f3e14305bf

Copy link

melvin-bot bot commented Nov 10, 2023

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Nov 10, 2023

@lanitochka17 could you add that specific image here

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@Oggyy
Copy link

Oggyy commented Nov 13, 2023

I have't checked the stackoverflow link according to video and logs.txt. this is samsung device. i have few questions here:
is it happening on samsung device only or every other device?
What are u trying to do in webview?

Copy link

melvin-bot bot commented Nov 13, 2023

📣 @Oggyy! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@lanitochka17
Copy link
Author

@pradeepmdk Hello
Photo

@giltron
Copy link

giltron commented Nov 14, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

App crashes after attempting to view a large uploaded image attachment.

What is the root cause of that problem?

The image size, which is 7724 x 5148, is too large for the rendering on the screen.
This causes the app to crash with the following in logcat on Android:

 Canvas: trying to draw too large(159052608bytes) bitmap.

This image is too large for the container it is being rendered on the device.

What changes do you think we should make in order to solve the problem?

Make sure the image height and size are not out of bounds (for the canvas size) what is supported by the device display.

Within AttachmentCarouselPage, the components' onLoad should size dimensions similar to existing approach in ImageView. This component is used for the initial image preview during adding the attachment:

  // Resize the image to max dimensions possible on the Native platforms to prevent crashes on Android. To keep the same behavior, apply to IOS as well.
        const maxDimensionsScale = 11;
        imageZoomWidth = Math.min(imageZoomWidth, roundedContainerWidth * maxDimensionsScale);
        imageZoomHeight = Math.min(imageZoomHeight, roundedContainerHeight * maxDimensionsScale);

The solution is to adjust the imageHeight and imageWidth calculation within the onLoad events in [AttachmentCarouselPage](https://github.com/Expensify/App/blob/5e7022d8cc519ab8787aa0e0d70d5692c6c27945/src/components/Attachments/AttachmentCarousel/Pager/AttachmentCarouselPage.js( with similar approach as ImageView. AttachmentCarouselPage to ensure the maximum dimensions are not too large for the canvas:

imageWidth = Math.min(imageWidth, canvasWidth * maxDimensionsScale);
imageHeight = Math.min(imageHeight, canvasHeight * maxDimensionsScale);

What alternative solutions did you explore? (Optional)

Additionally, if there are an intended maximum dimensions for general image attachments this validation can be added before the image is uploaded.

In AttachmentPicker, we can add a function to check the size dimensions for an image (can check by height, width, and overall size):

isValidResolution(image) {
        return getImageResolution(image).then(
            (resolution) =>
                resolution.height >= CONST.ATTACHMENT_MIN_HEIGHT_PX &&
                resolution.width >= CONST.ATTACHMENT_WIDTH_PX &&
                resolution.height <= CONST.ATTACHMENT_MAX_HEIGHT_PX &&
                resolution.width <= CONST.ATTACHMENT_MAX_WIDTH_PX,
        );
    }

For native Android/iOS, we can also configure react-native-image-picker to automatically resize the image:

maxWidth
maxHeight

For informing the user, a similar message could be displayed (if it is not desirable to automatically resize) as with the Avatar image upload

Copy link

melvin-bot bot commented Nov 14, 2023

📣 @giltron! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@giltron
Copy link

giltron commented Nov 14, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01314357fa1f5cb83d

Copy link

melvin-bot bot commented Nov 14, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

Copy link

melvin-bot bot commented Nov 14, 2023

@adelekennedy, @thesahindia Whoops! This issue is 2 days overdue. Let's get this updated quick!

@adelekennedy
Copy link

I think for this one we do want the image to be resized and/or a warning is included that the image is too large with specified dimensions

@melvin-bot melvin-bot bot removed the Overdue label Nov 14, 2023
@giltron
Copy link

giltron commented Nov 14, 2023

@adelekennedy Please let me know on the image dimension requirements I can update my proposal to include it.

Copy link

melvin-bot bot commented Nov 17, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Nov 17, 2023
@giltron
Copy link

giltron commented Nov 17, 2023

@3owa
Copy link

3owa commented Nov 18, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01f65412f3e14305bf

Copy link

melvin-bot bot commented Nov 18, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@suneox
Copy link
Contributor

suneox commented Nov 18, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Android - Attachment- App crashes on opening specific image

What is the root cause of that problem?

Due to provided image too large so when render on android will be out-of-memory

What changes do you think we should make in order to solve the problem?

By default on android largeheap is false so we need add config android:largeheap="true" for AndroidManifest.xml at <application> tag

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Nov 20, 2023

@adelekennedy, @thesahindia Huh... This is 4 days overdue. Who can take care of this?

@thesahindia
Copy link
Member

I am not in a good shape. Please reassign @adelekennedy.

@melvin-bot melvin-bot bot removed the Overdue label Nov 20, 2023
@s77rt
Copy link
Contributor

s77rt commented Nov 20, 2023

Taking this as C+

@s77rt
Copy link
Contributor

s77rt commented Nov 20, 2023

This is a dupe #24337. We can close this one @adelekennedy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

9 participants