BelledonneCommunications / linphone-android

Linphone.org mirror for linphone-android (https://gitlab.linphone.org/BC/public/linphone-android)
https://linphone.org
GNU General Public License v3.0
1.12k stars 689 forks source link

App crashes upon start in KNOX 3.8 on Android 12 (Samsung A33) #1704

Closed screenio5 closed 2 years ago

screenio5 commented 2 years ago

Describe the bug Whan app is started INSIDE Samsung KNOX, app crashes immediately

To Reproduce Steps to reproduce the behavior:

  1. Install latest 4.7.0 ("linphone-android-release-4.7.0-alpha.231+622275812.apk" as of this writing)
  2. Go into KNOX "Secure Folder" and add the app into KNOX and run it from inside KNOX
  3. While in the KNOX app instance, add a SIP account and make sure it connects and works
  4. Do NOT uninstall the app from outside KNOX yet.
  5. Restart phone and run app from INSIDE KNOX. It should work fine
  6. Now uninstall the app from outside KNOX
  7. Run app from INSIDE KNOX (it doesnt exist outside KNOX anymore). It still should work fine
  8. Restart phone
  9. Run app from INSIDE KNOX (it doesnt exist outside KNOX anymore). APP CRASHES and will never work from now on!
  10. The only way to make it work again (in KNOX) is to re-install it outside KNOX. It seems as if when run inside KNOX it needs to locate and find something OUTSIDE KNOX.

The above behavior did not occur prior to Android 12 & KNOX 3.8

Please complete the following information

SDK logs Cant have logs as app crashes immediately upon start

Additional context Up to Android 11 running Samsung KNOX 3.7 app was working always fine INSIDE KNOX

Viish commented 2 years ago

PXL_20220622_124111795 MP~2

PXL_20220622_124304712 MP~2

Viish commented 2 years ago

I just merged the fix for the crash in master branch of the SDK, tonight's Android APK nightly build should have the fix.

screenio5 commented 2 years ago

Thanks. I will download it. I checked the official Samsung notes regarding the June security patch level. None suggest anything regarding any possible fix regarding our issue (it could be of course that it is undocumented). I dont know what else to say but simply hope that when it gets officially released for my A33 phones it will fixed. I was thinking of maybe purchasing for testing purposes a Z Fold 2 but once I found out the price I dropped the idea.

One last interesting note:

While I had in secure folder the app not being able to connect to the sip server (because the outside secure folder instance was absent) I accidentally installed outside the secure folder NOT THE SAME version as the one inside the secure folder. Although it was successfully installed, the inside still couldn't connect. It was only when I installed outside the IDENTICAL apk as the one inside that made the inside finally connect to the sip server. So, for whatever reason, both the inside and outside must have been installed from the same apk (maybe something like a common GUID/hash or whatever comes to play...)

Viish commented 2 years ago

I just tried at home with my A7 tablet that has June update and I don't have the crash, so it seems latest firmware is the key to the fix.

screenio5 commented 2 years ago

Does the A7 support KNOX? Alas, I really hope Samsung releases also for the A33. Then we will definitely know if this fixes it after all. Can you please check whether your A7 also turns on the screen when receiving calls? (while the app is of course in secure folder and it is protected with a password)

Viish commented 2 years ago

Yes A7 tablet has KNOX as well (same version / API level). But indeed same incoming call notification issue.

screenio5 commented 2 years ago

I have this idea regarding the failure of the incoming call. Can you please check my question and whether it is feasible in the other relevant topic #1705? Moving forward, I am afraid this will never be fixed in KNOX and only some kind of workaround like my proposal might be a radical fix.

screenio5 commented 2 years ago

So, I got a brand new A32 in my hands with the following versions:

KNOX: 3.8 (API level 35) Secure folder: 1.7.01.68 One UI: 4.1 Kernel: 4.14.186 Patch level: June 1 (which is identical with the Jun 16 patch level)

I was really hoping that Linphone wouldn't crash but it does. Since this phone has the latest June patch level as your 2 phones I have to assume that this is not the root cause. I see that the secure folder version is different than yours but at the same time your 2 phones have an identical secure folder version and the one works and the other crashes. Kernels are different but I assume that this has to be due to different phone models.

Viish commented 2 years ago

What version of the app did you used? It shouldn't crash anymore as the fix has been merged. Can you also try to update secure folder to latest version?

screenio5 commented 2 years ago

I am using the latest version which includes the wake up screen fix.

I am sorry for typing "crash". I should have said "does not connect to server" as the crash has been handled. The linphone instance inside the secure folder remains disconnected from server until I install Linphone outside the secure folder. As soon as I install it, it connects immediately.

Unfortunately there is no way for updating the secure folder. It simply says that it is the latest version (and I am not sure this would fix the problem). Do you have any idea why simply the existence of Linphone outside the secure folder allows the inside one to receive permissions for resolving dns names? It does not make any sense. Could it be that the existence of the outside creates some kind of GUID which satisfies some authority?

Viish commented 2 years ago

I have no idea how secure folder or KNOX works, so no I don't know how it happens nor why and even less how to fix it, sorry.

screenio5 commented 2 years ago

Question:

1) if no SIP account has been set in Linphone, does the app try to resolve/connect to anything when it starts? 2) if a SIP account has been set, does the app try to resolve/connect to anything else besides the set SIP server?

I am trying to perform some tests (regarding the secure folder). What I am trying to figure out is whether the app tries to connect or resolve anything else besides the requested server

Viish commented 2 years ago
  1. It may, for example for checking if a new version is available on the play store. It may also contact our account manager if you are using the assistant.
  2. It also may, for example when using a sip.linphone.org account it will create, upload & fetch keys for LIME encryption from/to a key server. It may also send packets to the STUN server, etc...
screenio5 commented 2 years ago

I see. What I would like to test -but I think is impossible- is this:

1) Linphone starts (in secure folder) and has no SIP account set and does not try to connect or resolve anything. Does it "crash"? (when instance outside secure folder does not exist). Please note that when I say "crash" I mean execution of the new exception handling 2) Linphone starts (in secure folder) and has a SIP account to a server with IPs for server and proxy settings. Linphone will not try to connect/resolve anything else (so DNS resolving is out of the question). Again, will it "crash"?

screenio5 commented 2 years ago

I just realized that substituting domain/proxy server from hostnames to IPs does not work. Is it mandatory indeed to have hostnames instead of IPs?

Viish commented 2 years ago

Is it mandatory indeed to have hostnames instead of IPs?

No it isn't. But let me remind you the issue isn't just the DNS resolver, it's the inability to create a socket. Yes sockets are used by DNS resolver, but a socket is also required to send/receive packets to/from an IP as well. The only solution I see for you is to contact samsung and explain the issue, hoping they'll fix it for your A32 device as they did for the others in latest firmware.

screenio5 commented 2 years ago

This is exactly what I want to find out: whether it is only the resolving or the resolving + socket creation. Unfortunately apart from the A32 it also happens to the A33 (and your S10). It seems there are more models that it happens than those that doesnt.

I am seriously thinking of purchasing an A7 just for the sake of it......

screenio5 commented 2 years ago

From https://en.wikipedia.org/wiki/Samsung_Galaxy_Tab_A7#:~:text=Samsung%20announced%20the%20Galaxy%20Tab,it%20on%20September%2011%2C%202020.:

"Samsung announced the Galaxy Tab A7 10.4 on September 2, 2020, and released it on September 11, 2020.[1] The Samsung Galaxy Tab A7 Lite was a smaller, more compact and affordable version. It was announced on May 27, 2021, and released on June 18, 2021.[2]"

Which one is yours? The normal or the Lite? Can you please provide the actual model?

"SM-Txxx??

Viish commented 2 years ago

Which one is yours?

Galaxy Tab A7 (2020) 32 Go - WiFi + 4G