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

Creating multiple user not working with profile pic #4072

Open
xtanion opened this issue Dec 22, 2021 · 10 comments · May be fixed by #5468
Open

Creating multiple user not working with profile pic #4072

xtanion opened this issue Dec 22, 2021 · 10 comments · May be fixed by #5468
Assignees
Labels
bug End user-perceivable behaviors which are not desirable. Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. Z-ibt Temporary label for Ben to keep track of issues he's triaged.

Comments

@xtanion
Copy link

xtanion commented Dec 22, 2021

Describe the bugl
While creating multiple users in the app, after adding a profile photo and name in respective fields I wasn't able to create new profile the "Done" button wasn't working or responding to clicks.

P.S. A new profile can be added w/o profile picture,and it works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Switch Profile from the
  2. Click on 'add account'
  3. Click on the Profile Picture icon and add a photo
  4. Fill your username and click on done.

Expected behavior
This should create new profile, but it doesn't do anything when clicked on done.

Demonstration

VN20211222_201745.mp4

Environment

  • Device/emulator being used: Xiaomi Redmi Note 10 Pro
  • Android or SDK version: Android 11
  • App version (you can get this through system app settings or via the admin controls menu in-app): 1.0

Additional context
Add any other context about the problem here.

@xtanion xtanion changed the title Creting multiple user not working with profile pic Creating multiple user not working with profile pic Dec 22, 2021
@anandwana001
Copy link
Contributor

anandwana001 commented Dec 27, 2021

Hi, @xtanion This is working for me on the latest develop branch to date. Could you please post the log also in the issue of what you are getting when clicking on create icon?
I had tested this on pixel 3a.

@xtanion
Copy link
Author

xtanion commented Dec 27, 2021

image
I guess the error is org.oppia.android E/ProfileManagementController: Failed to store user submitted avatar image and hence it can't access the profile pic from internal storage open failed: ENOENT (No such file or directory)

@BenHenning
Copy link
Member

Might be a permission issue specific to this device, or maybe an SD card image was selected (the app doesn't have read SD card permissions). It seems like more investigation is needed here.

@xtanion
Copy link
Author

xtanion commented Jan 7, 2022

Seems like it was a MIUI specific issue, I tried recreating the same issue on the same device with a custom ROM and it worked fine.

@Broppia Broppia added issue_type_bug Impact: Low Low perceived user impact (e.g. edge cases). labels Jun 13, 2022
@BenHenning BenHenning added Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Z-ibt Temporary label for Ben to keep track of issues he's triaged. issue_user_learner and removed Impact: Low Low perceived user impact (e.g. edge cases). labels Sep 15, 2022
@seanlip seanlip added bug End user-perceivable behaviors which are not desirable. and removed issue_user_learner labels Mar 29, 2023
@adhiamboperes adhiamboperes self-assigned this Jul 24, 2023
@adhiamboperes adhiamboperes added the Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. label Jul 31, 2023
@adhiamboperes adhiamboperes removed their assignment Aug 19, 2023
@adhiamboperes adhiamboperes self-assigned this Aug 19, 2023
@adhiamboperes adhiamboperes added this to the 1.0 Global availability milestone Sep 7, 2023
@adhiamboperes adhiamboperes added the good first issue This item is good for new contributors to make their pull request. label Oct 17, 2023
@adhiamboperes adhiamboperes removed their assignment Jan 24, 2024
@adhiamboperes
Copy link
Collaborator

@Tejas-67, PTAL.

@Tejas-67
Copy link
Contributor

hey @adhiamboperes, tried reproducing this error and it worked on all the devices in my case. Maybe this is a device-specific issue.

@adhiamboperes adhiamboperes removed the good first issue This item is good for new contributors to make their pull request. label Mar 1, 2024
@adhiamboperes
Copy link
Collaborator

Unable to reproduce this issue on a Redmi device with the same specs as the reporting device

WhatsApp.Video.2024-08-06.at.16.12.34.mp4

@adhiamboperes
Copy link
Collaborator

Actually, never mind, I found a way to repro this issue. In my previous video, I selected the pictures using google photos app, but the issue occurs when using the MIUI gallery app(com.miui.gallery apk).

@adhiamboperes
Copy link
Collaborator

With the MIUI gallery app, the image path is device image path content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDCIM%2FCamera%2FIMG_20240804_134024.jpg.

With google photos, the path is content://com.google.android.apps.photos.contentprovider/1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F1000423837/ORIGINAL/NONE/image%2Fjpeg/1045458194

Now I have to choose an image that is on device only, using both apps:

miui content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDownload%2F1%20(13).png

google photos content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F1000049236/ORIGINAL/NONE/image%2Fpng/210299334

Key Differences:

MIUI Gallery is accessing the image directly from the device's file system.
Google Photos is accessing the image from its own content provider.
MIUI Gallery's URI is simpler and more directly related to the file path.
Google Photos' URI is more complex.

Due to these, when accessing the image file name via avatarImageUri.lastPathSegment, the MIUI uri returns /storage/emulated/0/DCIM/Camera/IMG_20240803_194219.jpg(we are actually only interested in the "IMG_20240803_194219.jpg" bit), while google will return210299334`.

To solve this, we need to only get the last substring from the uris. Instead of using pathSegments.last() or avatarImagePath.lastPathSegment, avatarImagePath.path?.substringAfterLast("/") is a more definite way of getting the last path segment, and this does solve this issue.

@BenHenning
Copy link
Member

This can get pretty complicated, I think, since content providers can basically format their paths in any way that they want (meaning there isn't a guarantee the path ends with the image filename), as better indicated by Google Photos here.

There might be a way to get a proper display name by querying the image content provider directly, but I do wonder: how much does it matter? Could we just come up with an internal name, instead, when saving the image?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug End user-perceivable behaviors which are not desirable. Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. Z-ibt Temporary label for Ben to keep track of issues he's triaged.
Development

Successfully merging a pull request may close this issue.

8 participants