syncthing / syncthing-android

Wrapper of syncthing for Android.
https://syncthing.net/
Mozilla Public License 2.0
3.35k stars 375 forks source link

Add support for encrypted folders #1650

Open imsodin opened 3 years ago

Schwefelholz commented 3 years ago

I can confirm that the issue is exactly what is described in https://github.com/syncthing/syncthing/issues/7634

hiqua commented 3 years ago

Is the wrapper 1.16.0 supposed to crash when connecting to an untrusted (for one folder) device? Or do you only expect the web ui to complain?

If I don't pause sync with the untrusted device, it crashes every time.

meinto commented 3 years ago

With 1.17.0 the app still crashes.

imsodin commented 3 years ago

Nothing should crash. It's expected that there's no support for untrusted/encrypted devices, meaning one needs to configure everything through the web UI. And if not properly configured, it's expected that the connection gets dropped. If something is crashing, please provide logs. Otherwise please write on https://forum.syncthing.net to get support.

hiqua commented 3 years ago

@imsodin ok thanks, I wanted to be sure that this was supported before filling a full bug report.

I think this occurred when: A, B trusted, C untrusted by A C trusted by B (password not inserted when it should have been)

This results in a warning in the web UI on computers, but a crash in the Android-wrapper.

@meinto can you confirm that this is the situation you have?

I've fixed my config since then (I've added the password in B), but I'll try to create a new folder and make it crash again to confirm this as well. I'll update this issue with the proper logs once it's done.

hiqua commented 3 years ago

I managed to reproduce it, using the following steps:

  1. create a folder on A
  2. share it with B and C, use a password on C
  3. on C, accept the request from A
  4. on B, accept the request from A, and share with C via the wrapper (without specifying the password)

This results in a crash whenever a connection is established between B and C. I no longer get the "Syncthing has crashed" message from Android though, not sure why, but the app closes, and when I restart it all connections are interrupted.

There's no crash in the logs (nothing after "beginning of crash"), only INFO level logs with personal info.

@meinto can you reproduce the bug using the same steps? And that should be enough to convince others that this bug is indeed reproducible (since the logs aren't telling much).

Again, that's of course a faulty setup, since B should use a password to share with C. But the wrapper should still avoid crashing.

imsodin commented 3 years ago

No need for any reproducers, I believe you that it's happening. If anyone can provide logs/crash reports (from logcat, as apparently our own "log facilities" are hit and miss at best) please do comment with that.

meinto commented 3 years ago

@imsodin, @hiqua Hi, sorry for my late response, I stopped using syncthing for a while because it constantly crashes. Today I opened the app again and waited a few seconds. This is the adb logcat | grep syncthing output of the crash:

Version of the app: 1.17.0

07-07 16:03:27.995   980   980 D EdgeLightingManager: hideForNotification : packageName = com.nutomic.syncthingandroid
07-07 16:03:27.995   980   980 D EdgeLightingPolicyManager:NotificationGroup: remove : sbn : StatusBarNotification(pkg=com.nutomic.syncthingandroid user=UserHandle{0} id=1565 tag=null key=0|com.nutomic.syncthingandroid|1565|null|10246: Notification(channel=02_syncthing_notifications shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 actions=2 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0))
07-07 16:03:27.996   980  4198 D ApplicationPolicy: isStatusBarNotificationAllowedAsUser: packageName = com.nutomic.syncthingandroid,userId = 0
07-07 16:03:27.997   980  4198 D ApplicationPolicy: isStatusBarNotificationAllowedAsUser: packageName = com.nutomic.syncthingandroid,userId = 0
07-07 16:03:28.002 27426 27426 E AndroidRuntime: Process: com.nutomic.syncthingandroid, PID: 27426
07-07 16:03:28.002 27426 27426 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.RestApi.lambda$getEvents$12(RestApi.java:675)
07-07 16:03:28.002 27426 27426 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.-$$Lambda$RestApi$A22A7F2tuiG8xzqwONwkzIuFgy0.onSuccess(Unknown Source:2)
07-07 16:03:28.002 27426 27426 E AndroidRuntime:    at com.nutomic.syncthingandroid.http.ApiRequest.lambda$connect$0(ApiRequest.java:98)
07-07 16:03:28.002 27426 27426 E AndroidRuntime:    at com.nutomic.syncthingandroid.http.-$$Lambda$ApiRequest$PMSqTR1xIfC3Gvk4ksGvnlwcmKY.onResponse(Unknown Source:4)
07-07 16:03:28.003  1407  1407 D FaceWidgetNotificationManager: removeFaceWidgetMusicNotification() key : 0|com.nutomic.syncthingandroid|1565|null|10246
07-07 16:03:28.005  2098  2098 I Notification4R_GO: NotificationListener.onNotificationRemoved-com.nutomic.syncthingandroid
07-07 16:03:28.006   980  4198 W ActivityManager: crash : com.nutomic.syncthingandroid,10246
07-07 16:03:28.008   980  4198 W ActivityTaskManager:   Force finishing activity com.nutomic.syncthingandroid/.activities.FolderActivity
07-07 16:03:28.011   980  4198 V WindowManager: Setting visibility of Window{4991b8f u0 com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.MainActivity}: true, caller=com.android.server.wm.WindowContainer.sendAppVisibilityToClients:1004 com.android.server.wm.ActivityRecord.setClientVisible:6367 com.android.server.wm.ActivityRecord.setVisibility:4842 com.android.server.wm.ActivityRecord.setVisibility:4746 com.android.server.wm.ActivityRecord.makeVisibleIfNeeded:5385
07-07 16:03:28.012   980  4198 D MARsPolicyManager: onPackageResumedFG pkgName = com.nutomic.syncthingandroid, userId = 0
07-07 16:03:28.015   980  4198 V WindowManager: Changing focus from Window{227a573 u0 com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.FolderActivity} to null displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:566 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6297 com.android.server.wm.DisplayContent.setFocusedApp:6774 com.android.server.wm.ActivityTaskManagerService.setResumedActivityUncheckLocked:6690
07-07 16:03:28.016   980  4198 D WindowManager: rotationForOrientation, orientationSource=ActivityRecord{fcffc56 u0 com.nutomic.syncthingandroid/.activities.MainActivity t14371}
07-07 16:03:28.016   980  4198 D WindowManager: rotationForOrientation, orientationSource=ActivityRecord{fcffc56 u0 com.nutomic.syncthingandroid/.activities.MainActivity t14371}
07-07 16:03:28.017   980  4198 D WindowManager: rotationForOrientation, orientationSource=ActivityRecord{fcffc56 u0 com.nutomic.syncthingandroid/.activities.MainActivity t14371}
07-07 16:03:28.018   980  4198 D MARsPolicyManager: onPackageResumedFG pkgName = com.nutomic.syncthingandroid, userId = 0
07-07 16:03:28.021   980  4198 W ActivityTaskManager:   Force finishing activity com.nutomic.syncthingandroid/.activities.MainActivity
07-07 16:03:28.038  2098  2098 I Notification4R_GO: WearableManager.Action-no actions for 0|com.nutomic.syncthingandroid|1565|null|10246
07-07 16:03:28.039   980  1014 D GameManagerService: notePauseComponent(), received paused-component: com.nutomic.syncthingandroid
07-07 16:03:28.039  2098 26995 I Notification4R_GO: ForwardManager.processRemoveNotificationOnPhone-windowId : 0|com.nutomic.syncthingandroid|1565|null|10246, packageName: com.nutomic.syncthingandroid
07-07 16:03:28.042  4173  4173 I SDHMS:PowerAnomaly:GATHERERAPPERROR: update AppError : uid=10246, pkg=com.nutomic.syncthingandroid, errorType=crash
07-07 16:03:28.045   980  1012 I DecorView: updateCaptionType >> DecorView@b3a29a4[syncthingandroid], isFloating=true, isApplication=false, hasWindowDecorCaption=false, hasWindowControllerCallback=false
07-07 16:03:28.045   980  1012 D DecorView: setCaptionType = 0, this = DecorView@b3a29a4[syncthingandroid]
07-07 16:03:28.048  4173  4173 I SDHMS:PowerAnomaly:ANALYZERAPPERROR: analyze app error : uid=10246, pkg=com.nutomic.syncthingandroid, appErrorCount=1
07-07 16:03:28.070   627  1756 I SurfaceFlinger: id=31261 createSurf (0x0),-1 flag=80004, 7841a64 Application Error: com.nutomic.syncthingandroid#0
07-07 16:03:28.073   980  1012 V WindowManager: Changing focus from null to Window{7841a64 u0 Application Error: com.nutomic.syncthingandroid} displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:566 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6297 com.android.server.wm.WindowManagerService.addWindow:1958 com.android.server.wm.Session.addToDisplayAsUser:182
07-07 16:03:28.078   980  1014 D GameManagerService: noteResumeComponent(), received resumed-component: com.nutomic.syncthingandroid
07-07 16:03:28.078   980  1014 I GameSDK@LifeCycle: noteResumeComponent(): package name  : com.nutomic.syncthingandroid
07-07 16:03:28.081   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: setView = com.android.internal.policy.DecorView@b3a29a4 TM=true
07-07 16:03:28.086   980  1014 D GameManagerService: notePauseComponent(), received paused-component: com.nutomic.syncthingandroid
07-07 16:03:28.111   980  1012 V WindowManager: Relayout Window{7841a64 u0 Application Error: com.nutomic.syncthingandroid}: viewVisibility=0 req=1080x774
07-07 16:03:28.113   627  1756 I SurfaceFlinger: id=31265 createSurf (1092x786),1 flag=4, Application Error: com.nutomic.syncthingandroid#0
07-07 16:03:28.115   980  1012 D WindowManager: makeSurface duration=2 name=Application Error: com.nutomic.syncthingandroid
07-07 16:03:28.120   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: Relayout returned: old=(0,117,1080,2280) new=(0,1506,1080,2280) req=(1080,774)0 dur=6 res=0x7 s={true 486074402096} ch=true fn=-1
07-07 16:03:28.120   980  1015 V WindowManager: Setting visibility of Window{227a573 u0 com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.FolderActivity}: false, caller=com.android.server.wm.WindowContainer.sendAppVisibilityToClients:1004 com.android.server.wm.ActivityRecord.setClientVisible:6367 com.android.server.wm.ActivityRecord.onAnimationFinished:7119 com.android.server.wm.ActivityRecord.postApplyAnimation:4989 com.android.server.wm.ActivityRecord.commitVisibility:4971
07-07 16:03:28.120   980  1015 D ActivityTaskManager: finishFixedRotationTransform, r=ActivityRecord{1028300 u0 com.nutomic.syncthingandroid/.activities.FolderActivity t14371 f}}, caller=com.android.server.wm.WindowToken.finishFixedRotationTransform:664 com.android.server.wm.DisplayContent$FixedRotationTransitionListener.onAppTransitionFinishedLocked:7024 com.android.server.wm.AppTransition.notifyAppTransitionFinishedLocked:543 com.android.server.wm.ActivityRecord.onAnimationFinished:7140 com.android.server.wm.ActivityRecord.postApplyAnimation:4989
07-07 16:03:28.120   980  1015 V WindowManager: Setting visibility of Window{4991b8f u0 com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.MainActivity}: false, caller=com.android.server.wm.WindowContainer.sendAppVisibilityToClients:1004 com.android.server.wm.ActivityRecord.setClientVisible:6367 com.android.server.wm.ActivityRecord.onAnimationFinished:7119 com.android.server.wm.ActivityRecord.postApplyAnimation:4989 com.android.server.wm.ActivityRecord.commitVisibility:4971
07-07 16:03:28.120   980  1015 D ActivityTaskManager: finishFixedRotationTransform, r=ActivityRecord{fcffc56 u0 com.nutomic.syncthingandroid/.activities.MainActivity t14371 f}}, caller=com.android.server.wm.WindowToken.finishFixedRotationTransform:664 com.android.server.wm.DisplayContent$FixedRotationTransitionListener.onAppTransitionFinishedLocked:7024 com.android.server.wm.AppTransition.notifyAppTransitionFinishedLocked:543 com.android.server.wm.ActivityRecord.onAnimationFinished:7140 com.android.server.wm.ActivityRecord.postApplyAnimation:4989
07-07 16:03:28.138   980  1015 D SurfaceControl: hide : mNativeObject = 481777418960 - sc.mNativeObject = 481240482800 - Surface(name=ActivityRecord{1028300 u0 com.nutomic.syncthingandroid/.activities.FolderActivity t14371})/@0x3fbf739
07-07 16:03:28.138   980  1015 D SurfaceControl: nativeSetFlags Done : Surface(name=ActivityRecord{1028300 u0 com.nutomic.syncthingandroid/.activities.FolderActivity t14371})/@0x3fbf739
07-07 16:03:28.138   980  1015 D SurfaceControl: hide : mNativeObject = 481780682880 - sc.mNativeObject = 481240572736 - Surface(name=com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.FolderActivity$_27426)/@0x6347063
07-07 16:03:28.138   980  1015 D SurfaceControl: nativeSetFlags Done : Surface(name=com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.FolderActivity$_27426)/@0x6347063
07-07 16:03:28.157   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:10951 android.view.ViewRootImpl.performTraversals:3845 android.view.ViewRootImpl.doTraversal:2618
07-07 16:03:28.157   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] pd() Asnyc report
07-07 16:03:28.206   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938
07-07 16:03:28.206   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] rdf()
07-07 16:03:28.206   980  1012 D WindowManager: finishDrawingWindow: Window{7841a64 u0 Application Error: com.nutomic.syncthingandroid} mDrawState=DRAW_PENDING
07-07 16:03:28.211   980  1015 I WindowManager: Reparenting to leash, surface=Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea, leashParent=Surface(name=WindowToken{e41d091 android.view.ViewRootImpl$W@bcc72a})/@0xa3d88db
07-07 16:03:28.211   627  1756 I SurfaceFlinger: id=31267 createSurf (0x0),-1 flag=24004, Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea - animation-leash#0
07-07 16:03:28.213   980  1015 D WindowManager: makeSurface duration=1 leash=Surface(name=Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea - animation-leash)/@0x482f78
07-07 16:03:28.225  2098  2098 I Notification4R_GO: NotificationListener.onNotificationPosted-com.nutomic.syncthingandroid[0/1565] : null
07-07 16:03:28.229  1706  1706 I Launcher.NotificationListener: onNotificationPosted : com.nutomic.syncthingandroid number : 0
07-07 16:03:28.230  1706  1836 I Launcher.NotificationListener: notificationIsValidForUI : com.nutomic.syncthingandroid missingTitleAndText : false isGroupHeader : false
07-07 16:03:28.230  2098  2098 I Notification4R_GO: NotificationListener.isSendableNotification-[  2][ true]  0 |  62347, ********* / com.nutomic.syncthingandroid | null | greyOut: false
07-07 16:03:28.239   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: MSG_RESIZED_REPORT: frame=(0,1506,1080,2280) ci=(0,0,0,0) vi=(0,0,0,0) or=1
07-07 16:03:28.240   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:10951 android.view.ViewRootImpl.access$1200:256 android.view.ViewRootImpl$ViewRootHandler.handleMessage:6101
07-07 16:03:28.244   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: MSG_WINDOW_FOCUS_CHANGED 1 1
07-07 16:03:28.249   980  1012 V WindowManager: Relayout Window{7841a64 u0 Application Error: com.nutomic.syncthingandroid}: viewVisibility=0 req=1080x774
07-07 16:03:28.252  2098 26995 I Notification4R_GO: PendingManager.[*P] com.nutomic.syncthingandroid|0|UsingPhone
07-07 16:03:28.253   980  1012 I SurfaceControl: release : mNativeObject = 481240514720 - Surface(name=Application Error: com.nutomic.syncthingandroid)/@0x29dc43 / android.view.SurfaceControl.assignNativeObject:567 android.view.SurfaceControl.copyFrom:587 com.android.server.wm.WindowSurfaceController.getSurfaceControl:561 com.android.server.wm.WindowManagerService.createSurfaceControl:2954
07-07 16:03:28.254   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: Relayout returned: old=(0,1506,1080,2280) new=(0,1506,1080,2280) req=(1080,774)0 dur=6 res=0x1 s={true 486074402096} ch=false fn=2
07-07 16:03:28.254   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] pd() Asnyc report
07-07 16:03:28.255  1407  1407 D InterruptionStateProvider: No bubble up: not allowed to bubble: 0|com.nutomic.syncthingandroid|1565|null|10246
07-07 16:03:28.256  1407  1407 D InterruptionStateProvider:  no Heads up : edgelighting enabled app. 0|com.nutomic.syncthingandroid|1565|null|10246
07-07 16:03:28.264   627   627 D SurfaceFlinger:      DEVICE | 0x7174f86030 | 0000 | RGBA_8888    |    6.0    0.0 1086.0  712.0 |    0 1568 1080 2280 | Application Error: com.nutomic.syncthingandroid#0
07-07 16:03:28.264   627   642 E BufferQueueProducer: [Application Error: com.nutomic.syncthingandroid#0](id:2730000196e,api:0,p:-1,c:627) disconnect: not connected (req=1)
07-07 16:03:28.276   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938
07-07 16:03:28.276   980  1012 I ViewRootImpl@bcc72a[syncthingandroid]: [DP] rdf()
07-07 16:03:28.276   980  1012 D WindowManager: finishDrawingWindow: Window{7841a64 u0 Application Error: com.nutomic.syncthingandroid} mDrawState=HAS_DRAWN
07-07 16:03:28.510   980  1014 W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{1028300 u0 com.nutomic.syncthingandroid/.activities.FolderActivity t14371 f}}
07-07 16:03:28.526   980  1015 I WindowManager: Reparenting to original parent: Surface(name=WindowToken{e41d091 android.view.ViewRootImpl$W@bcc72a})/@0xa3d88db, destroy=true, surface=Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea
07-07 16:03:28.527   980  1015 I SurfaceControl: release : mNativeObject = 481240368000 - Surface(name=Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea - animation-leash)/@0x482f78 / android.view.SurfaceControl$Transaction.remove:3449 com.android.server.wm.SurfaceAnimator.removeLeash:418 com.android.server.wm.SurfaceAnimator.reset:384 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0$SurfaceAnimator:110
07-07 16:03:28.528   627  1756 I Layer   : id=31267 removeFromCurrentState Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea - animation-leash#0 (148)
07-07 16:03:28.528   627  1756 I SurfaceFlinger: id=31267 Removed Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea - animation-leash#0 (148)
07-07 16:03:28.543   627   627 I Layer   : id=31267[1] Destroyed Surface(name=7841a64 Application Error: com.nutomic.syncthingandroid)/@0x3a2adea - animation-leash#0
hiqua commented 3 years ago

@meinto not completely sure, but this bug might be fixed with https://github.com/syncthing/syncthing/issues/7724 closed, so in v1.18.0. I wanted to wait until I get this version before commenting again, and possibly see if there are still cases where not everything works. Maybe imsodin will chime in, but we'll be able to test soon enough anyway!

Once you have v1.18.0, I suggest you delete and readd the folder if you still have issues.