nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.26k stars 1.77k forks source link

Crash on set Image as Wallpaper #11502

Open SebastianReitzner opened 1 year ago

SebastianReitzner commented 1 year ago

⚠️ Before posting ⚠️

Steps to reproduce

  1. Open a folder containing about 271 high resolution pictures (240 dpi, 24 bit depth, ~1,37GB total folder size, 3-7MB each picture).
  2. Click on the picture which you want to set as Wallpaper.
  3. Click the hamburger/3-dots menu
  4. Select "Use picture as"
  5. Select Google photos "wallpaper" option
  6. Frame picture accordingly and set it for both

Expected behaviour

The picture is set and the app does not crash

Actual behaviour

The picture is set, but the app crashes

Android version

13

Device brand and model

XIAOMI POCO F1

Stock or custom OS?

Custom (explain in "additional information")

Nextcloud android app version

3.24.2

Nextcloud server version

25.0.2

Using a reverse proxy?

Yes

Android logs

Cause of error

Exception in thread "main" java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nextcloud.client/com.owncloud.android.ui.preview.PreviewImageActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.nextcloud.ui.fileactions.FileActionsBottomSheet: could not find Fragment constructor
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3641)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3778)
    at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5779)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5670)
    at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:138)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2303)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7884)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: Exception in thread "main" androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.nextcloud.ui.fileactions.FileActionsBottomSheet: could not find Fragment constructor
    at androidx.fragment.app.Fragment.instantiate(Fragment.java:678)
    at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
    at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:507)
    at androidx.fragment.app.FragmentState.instantiate(FragmentState.java:81)
    at androidx.fragment.app.FragmentStateManager.<init>(FragmentStateManager.java:85)
    at androidx.fragment.app.FragmentManager.restoreSaveStateInternal(FragmentManager.java:2505)
    at androidx.fragment.app.Fragment.restoreChildFragmentState(Fragment.java:1989)
    at androidx.fragment.app.Fragment.onCreate(Fragment.java:1965)
    at com.owncloud.android.ui.fragment.FileFragment.onCreate(FileFragment.java:61)
    at com.owncloud.android.ui.preview.PreviewImageFragment.onCreate(PreviewImageFragment.java:175)
    at androidx.fragment.app.Fragment.performCreate(Fragment.java:3090)
    at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
    at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:2884)
    at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:252)
    at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:220)
    at com.owncloud.android.ui.activity.BaseActivity.onCreate(BaseActivity.java:58)
    at com.owncloud.android.ui.activity.DrawerActivity.onCreate(DrawerActivity.java:902)
    at com.owncloud.android.ui.activity.FileActivity.onCreate(FileActivity.java:202)
    at com.owncloud.android.ui.preview.PreviewImageActivity.onCreate(PreviewImageActivity.java:108)
    at android.app.Activity.performCreate(Activity.java:8341)
    at android.app.Activity.performCreate(Activity.java:8320)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3622)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3778)
    at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5779)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5670)
    at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:138)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2303)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7884)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: Exception in thread "main" java.lang.NoSuchMethodException: com.nextcloud.ui.fileactions.FileActionsBottomSheet.<init> []
    at java.lang.Class.getConstructor0(Class.java:2363)
    at java.lang.Class.getConstructor(Class.java:1759)
    at androidx.fragment.app.Fragment.instantiate(Fragment.java:663)
    at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
    at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:507)
    at androidx.fragment.app.FragmentState.instantiate(FragmentState.java:81)
    at androidx.fragment.app.FragmentStateManager.<init>(FragmentStateManager.java:85)
    at androidx.fragment.app.FragmentManager.restoreSaveStateInternal(FragmentManager.java:2505)
    at androidx.fragment.app.Fragment.restoreChildFragmentState(Fragment.java:1989)
    at androidx.fragment.app.Fragment.onCreate(Fragment.java:1965)
    at com.owncloud.android.ui.fragment.FileFragment.onCreate(FileFragment.java:61)
    at com.owncloud.android.ui.preview.PreviewImageFragment.onCreate(PreviewImageFragment.java:175)
    at androidx.fragment.app.Fragment.performCreate(Fragment.java:3090)
    at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
    at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:2884)
    at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:252)
    at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:220)
    at com.owncloud.android.ui.activity.BaseActivity.onCreate(BaseActivity.java:58)
    at com.owncloud.android.ui.activity.DrawerActivity.onCreate(DrawerActivity.java:902)
    at com.owncloud.android.ui.activity.FileActivity.onCreate(FileActivity.java:202)
    at com.owncloud.android.ui.preview.PreviewImageActivity.onCreate(PreviewImageActivity.java:108)
    at android.app.Activity.performCreate(Activity.java:8341)
    at android.app.Activity.performCreate(Activity.java:8320)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3622)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3778)
    at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5779)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5670)
    at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:138)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2303)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7884)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

App information

Device information

Firmware

Server error logs

No response

Additional information

Lineage OS 20.0, build from 2023.04.01

Crash only happened the first time, when trying the same procedure again it worked without crashing. Inbetween trying to reproduce the error I shared the folder containing the pictures with another user.

jsoberg commented 1 year ago

I experienced a similar crash while rotating my device while a bottom sheet was open for a file - Pixel 6, 30240290 from Google Play. It appears that this Fragment (FileActionsBottomSheet) just needs a public constructor so that the OS can recreate it

jsoberg commented 1 year ago

Additionally, the result listener from each parent fragment is only set when the actions bottom sheet/dialog is created - therefore, after a configuration change when the parent fragment is recreated (when the FileActionsBottomSheet constructor is made public), any actions that the user chooses won't trigger.