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

[BUG] Can't open camera on adding new element #733

Closed
Linskun opened this issue Jul 31, 2023 · 31 comments · Fixed by #738 or #763
Closed

[BUG] Can't open camera on adding new element #733

Linskun opened this issue Jul 31, 2023 · 31 comments · Fixed by #738 or #763

Comments

@Linskun
Copy link

Linskun commented Jul 31, 2023

Hello,

i have a Pixel 6a with latest Android 13 update.
I can't add a picture on adding new element/food, the UI say that "There was a problem using the camera"
If i use camera to scan a bar code it work, so It doesn't look like a permissions issue

@davidhealey
Copy link
Owner

Works here on my pixel 6a running LineageOS/Android 13.

Have you changed the default camera app?

@Linskun
Copy link
Author

Linskun commented Jul 31, 2023

No, my phone is stock with latest Google official firmware and official photo apps

Here the video Issue

@licaon-kter
Copy link

licaon-kter commented Aug 7, 2023

Seeing the same on Divest OS 20 (aka Android 13) based on Lineage

Trying the older version, which opens the camera fine fyi, it appears that now you don't ask for Storage permissions of any kind (Photos and whatnot)?

But testing on Android 11 I get asked for Storage on start and the camera works fine.

/PS: you've bumped targetSDK from 31 to 33... maybe it needs more work?
Eg. Conversations had the same issue on the same upgrade, as apps updated might get permissions granted previously while new installs might not without extra code: https://codeberg.org/iNPUTmice/Conversations/commit/f7f34c6bdd14f2d9a230484af04d3335ee6c4bae
And of course, Android 11 or older will work just fine so you might not see these bugs.

@davidhealey
Copy link
Owner

I'm using Android 13 (Lineage) on my Pixel 6a without issue. So I don't think it's a universal problem.

@licaon-kter
Copy link

licaon-kter commented Aug 7, 2023

There's no obvious crash:

2679 E OpenGLRenderer: Unable to match the desired swap behavior.
2349 I BpBinder: onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
2219 D ShellBackPreview: Finishing gesture with event action: 1
2349 I BpBinder: onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
2219 D ShellBackPreview: onGestureFinished() mTriggerBack == false
2219 D ShellBackPreview: BackAnimationController: finishAnimation()
8900 D PluginManager: getPlugin - put: Camera
2350 I ActivityTaskManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.permissioncontroller cmp=com.android.permissioncontroller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10144
2350 D CompatibilityChangeReporter: Compat change id reported: 197654537; UID 10144; state: ENABLED
 931 D [email protected]: LAUNCH ON
8900 W PluginManager: THREAD WARNING: exec() call to Camera.takePicture blocked the main thread for 27ms. Plugin should use CordovaInterface.getThreadPool().
8790 D CordovaActivity: Paused the activity.
5869 W ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (3417668)
8383 D CoreBackPreview: Window{ccb4a49 u0 com.android.permissioncontroller/com.android.permissioncontroller.permission.ui.GrantPermissionsActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@21f786f, mPriority=0}
1670 I system_server: JIT allocated 89KB for compiled code of boolean android.app.admin.IDevicePolicyManager$Stub.onTransact(int, android.os.Parcel, android.os.Parcel, int)
1730 I ActivityTaskManager: Displayed com.android.permissioncontroller/.permission.ui.GrantPermissionsActivity: +97ms
 931 D [email protected]: LAUNCH OFF
6168 V GrantPermissionsViewModel: Logged buttons presented and clicked permissionGroupName=android.permission-group.CAMERA uid=10144 selectedLocations=0 package=com.waist.line presentedButtons=44 clickedButton=4 sessionId=612020356854897286 targetSdk=33
6168 V GrantPermissionsViewModel: Permission grant result requestId=612020356854897286 callingUid=10144 callingPackage=com.waist.line permission=android.permission.CAMERA isImplicit=false result=4
8790 D CordovaActivity: Resumed the activity.
3413 W InputManager-JNI: Input channel object 'ccb4a49 com.android.permissioncontroller/com.android.permissioncontroller.permission.ui.GrantPermissionsActivity (client)' was disposed without first being removed with the input manager!
2411 D CoreBackPreview: Window{ccb4a49 u0 com.android.permissioncontroller/com.android.permissioncontroller.permission.ui.GrantPermissionsActivity EXITING}: Setting back callback null

...clean data, start, go straight to camera, grant permission, error.

Note that touching the area near the camera/picker it might open the camera eventually, eg. I pressed 2 dozen times just for kicks really fast (see the log entry with "Camera.takePicture blocked" so maybe there's a race?) but the picture was not saved (since you don't ask nor get the permission to store the picture lol)

@licaon-kter
Copy link

@davidhealey

So I don't think it's a universal problem.

So you've installed fresh today and works fine for you?

@davidhealey
Copy link
Owner

I haven't reinstalled it today, I'm using the latest version from fdroid.

@licaon-kter
Copy link

licaon-kter commented Aug 7, 2023

Please do, as said, latest from F-Droid works fine, but that's on tagetSDK 31...

But this APK: https://github.com/davidhealey/waistline/releases/tag/3.7.1 and whatever F-Droid will build in the next cycle (https://gitlab.com/fdroid/fdroiddata/-/commit/022728913b80bed68a7a69753c68c070e778b962) won't open the camera nor open the files on Android 13.

@davidhealey
Copy link
Owner

Aha ok I'll try that. @EmilJunker I seem to recall you updated the SDK version?

@Linskun
Copy link
Author

Linskun commented Aug 7, 2023

I've tried also the latest downloaded from GitHub

Did you see my video ?
The App have already authorization on camera (Default official Google gcam)
If i click on barcode It work
If i try to add a new food elementi It don't work

Tell me if you Need other information, logcat

@licaon-kter
Copy link

previous:
previous

vs.

now:
now

@Linskun
Copy link
Author

Linskun commented Aug 7, 2023

Now on official Google Firmware
No storage asking permissions

Screenshot_20230807-131118

@EmilJunker
Copy link
Contributor

@Linskun @licaon-kter Are you able to create a database backup from Settings > Import/Export > Backup Database? That should also require storage access permission.

@Linskun
Copy link
Author

Linskun commented Aug 7, 2023

@EmilJunker : Export Failed
And i think that Is normal, the App don't ask storage permissions

@EmilJunker
Copy link
Contributor

@Linskun Thank you for confirming. I thought so. Then it must have something to do with the changed storage access permissions that were introduced in Android 13 (SDK 33). I guess we need to add some permissions to the config.xml besides READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE.

@EmilJunker
Copy link
Contributor

Or actually we may have to wait for the camera plugin itself to get fixed, see apache/cordova-plugin-camera#825 (comment)

@davidhealey
Copy link
Owner

@EmilJunker What was the reason for updating the SDK?

@EmilJunker
Copy link
Contributor

The main reason was because I wanted to add support for themed app icons (issue #675) which is a new feature in Android 13 that requires Cordova Android 12 and SDK 33.

@davidhealey
Copy link
Owner

Ah yes, I remember now, thanks

@licaon-kter
Copy link

Isn't Google forcing everyone anyway?

@EmilJunker
Copy link
Contributor

Unfortunately yes, from August 31, apps submitted to the Play Store are required to target at least SDK 33: https://developer.android.com/google/play/requirements/target-sdk

On the plus side, that would give us three more weeks to make and publish a version that targets SDK 32 (which is unaffected by the issue).

To make a working version that targets SDK 33, it looks like we'll need to wait for the camera plugin and the file plugin to be fixed:

@davidhealey
Copy link
Owner

Uh why they always breaking stuff!!! :)

@licaon-kter
Copy link

licaon-kter commented Aug 11, 2023

Wait, ain't Android/data inaccessible by other apps? How can I backup the backup files ?!

@EmilJunker
Copy link
Contributor

@licaon-kter Yes, some file managers block access to Android/data. But there are also file manager apps that let you access the folder. So if you don't see it in the default files app on your phone, try a different one.

@licaon-kter
Copy link

You got it backwards, Google blocks their access... but yeah.

Are you really really sure Documents is blocked?

@EmilJunker
Copy link
Contributor

Are you really really sure Documents is blocked?

I couldn't find a way to write to the Documents folder on Android 13. Maybe there is a way to do it with a native app, but with Cordova we have to rely on plugins to provide this functionality. You are welcome to try to make it work, though. The app is open source ;)

@licaon-kter
Copy link

Maybe there is a way to do it with a native app, but with Cordova we have to rely on plugins to provide this functionality.

Ah, so a matter of time :)

@davidhealey davidhealey reopened this Aug 14, 2023
@davidhealey
Copy link
Owner

Hi,

I've incorporated Emil's temporary fix, but I since I had to install some new stuff I would appreciate if a few of you could test it before I make an official release.

waistline-release.zip

@EmilJunker
Copy link
Contributor

@davidhealey I installed your APK on my S21 running Android 13 and can confirm that it's fixed. I can add pictures to food items and the backup is also working as expected.

@davidhealey
Copy link
Owner

davidhealey commented Aug 14, 2023

Perfect thanks, in that case I'll go ahead and make the release.

I'll leave this issue open until the official plugin is fixed.

@schklom
Copy link

schklom commented Aug 23, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants