iakmds / librecamera

A free and open source camera app for Android written in Flutter and Dart
https://f-droid.org/packages/com.iakmds.librecamera/
GNU General Public License v3.0
278 stars 27 forks source link

App requires network permission? #4

Closed Glitchy-Tozier closed 1 year ago

Glitchy-Tozier commented 1 year ago

Fdroid detects this app requiring network -permission. Why is that?

If not needed, it would be great if unnecessary permissions could be removed.

Screenshot_20221005-073734_F-Droid.jpg

Glitchy-Tozier commented 1 year ago

If none of your packages require networking-permissions (which at first glance I don't think they do), this may be due to one of the the following:

  1. You accidentally released the debug-build of your app
  2. You might need to manually remove the requested internet-access from some xml-file in your android-directory
iakmds commented 1 year ago

You are right โ€“ it shouldn't require network permissions.

Currently I don't know where it may be coming from. There is no internet access in the AndroidManifest.xml set, and the F-Droid team surely hasn't built the app in debug mode. We'll have to see if it still occurs in the next F-Droid release.

Glitchy-Tozier commented 1 year ago

You're right, you seem to use the exact same files as I do in my app (that doesn't require internet access).

Also you seem to be using the same build commands I do:

No idea what is going on.

iakmds commented 1 year ago

Interesting. Let's see if it will be there in the next release too.

I wonder if it has anything to do with the packages I am using. Do you know whether packages in Flutter can effect permission use?

Glitchy-Tozier commented 1 year ago

I wonder if it has anything to do with the packages I am using. Do you know whether packages in Flutter can effect permission use?

I'm not 100% certain (it's been a while), but I think they can. If you check out my app on F-Droid, you'll see it requires some permissions. However, I haven't explicitly enabled them in my AdroidManifest.xml. In my case I'm pretty sure a package (probably flutter_local_notifications) automatically added them.

iakmds commented 1 year ago

Well, that may at least be a hint, thank you.

Loughty commented 1 year ago

Ey, @iakmds, I read the thread and for curiosity I made a quick search using the words "network" and "internet", and with the last one foud this in the source:

Screenshot 2022-10-11 at 05-23-15 Search ยท internet ยท iakmds_librecamera

https://github.com/iakmds/librecamera/blob/2de3b697072c5e0ca44d76a49e9918a8e6d3cf96/android/app/src/profile/AndroidManifest.xml

https://github.com/iakmds/librecamera/blob/2de3b697072c5e0ca44d76a49e9918a8e6d3cf96/android/app/src/debug/AndroidManifest.xml

I hope this could be usefull :smile:

iakmds commented 1 year ago

Hi,

thanks for the idea; Sadly the AndroidManifest.xml in these folders (profile and debug) are not merged with the final apk (it's a Flutter thing), therefore it cannot be the problem. What is interesting is that F-Droid marks the permission as view network connections which isn't even real "internet access", let's see and wait if it's still the same in the new version once it comes to F-Droid

Loughty commented 1 year ago

:thinking:

Well, for now, I gonna leave this links from the F-Droid: This is the source that F-Droid uses, maybe comparing both sources (from F-Droid and Github) could give to you some hint, I think there's programs that make the comparision more easy: https://f-droid.org/repo/com.iakmds.librecamera_1_src.tar.gz And this is the log of the compiling process: https://f-droid.org/repo/com.iakmds.librecamera_1.log.gz

Also, I extracted the AndroidManifiest directly from the APK of the F-Droid version, and yeah, there's nothing about network or internet: AndroidManifest.txt Maybe you could see something that I don't.

iakmds commented 1 year ago

In the AndroidManifest.xml you extracted, it actually does say the following on line 13:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

So it is the thing F-Droid detected, we need to find out where it comes from (especially if it's still there in the next F-Droid version)

iakmds commented 1 year ago

Good news everyone ๐ŸŽ‰

The next version won't require the permission for Network Access ๐Ÿฅณ๐ŸŽ‰

For the ones interested, here is how I fixed it: The cause for the Network Access permission request was the package video_player (to my surprise), which I used for displaying the video preview/thumbnail. I discovered this by creating a new blank project and adding all the packages from Libre Camera. I then removed the packages in different combinations, built the apk and inspected it's AndroidManifest for the permission. And after a couple of tries, the video_player package was left. Now, the app will be using the video_thumbnail package instead โ€“ no need for any permissions ๐ŸŽ‰
Glitchy-Tozier commented 1 year ago

Great to hear, good job! ๐ŸŽ‰

iakmds commented 1 year ago

Version 1.3.1 is now on F-Droid, and as you can see, the permission is gone! permission

Can we close this issue? :tada:

Glitchy-Tozier commented 1 year ago

Sure :)