AmazeFileManager icon indicating copy to clipboard operation
AmazeFileManager copied to clipboard

Crash on dialog when trying to delete 16000 files

Open EmmanuelMess opened this issue 2 years ago • 11 comments

Press "delete" witg 16000 files selected, the list is unscrollable, and the activity crashes:

-------------------------------------
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@2b08861 is not valid; is your activity running?
 at android.view.ViewRootImpl.setView(ViewRootImpl.java:748)
 at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:343)
 at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
 at android.widget.Toast$TN.handleShow(Toast.java:504)
 at android.widget.Toast$TN$2.handleMessage(Toast.java:384)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:154)
 at android.app.ActivityThread.main(ActivityThread.java:6351)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:786)
-------------------------------------

EmmanuelMess avatar Jul 22 '21 21:07 EmmanuelMess

Dupe to #1063 ?

VishalNehra avatar Jul 22 '21 21:07 VishalNehra

No, that happens on the delete, this happens on the dialog.

EmmanuelMess avatar Jul 22 '21 21:07 EmmanuelMess

Ok, maybe update the description / title to avoid confusion?

VishalNehra avatar Jul 22 '21 21:07 VishalNehra

Initial suggestion would be to disable file listing in dialog if it crosses certain threshold, say 50 files. Total size calculation may remain, subject to testing.

VishalNehra avatar Jul 22 '21 21:07 VishalNehra

Initial suggestion would be to disable file listing in dialog if it crosses certain threshold, say 50 files. Total size calculation may remain, subject to testing.

Maybe something like ..."and X more files", and directory listing should cancel when the user presses "accept".

EmmanuelMess avatar Jul 22 '21 21:07 EmmanuelMess

And x more files makes sense, but listing should cancel? I mean, will it buffer? Not a good idea, I think it'll be unnecessary complication. It isn't practical to list hundreds of files in a dialog, let alone thousands.

VishalNehra avatar Jul 22 '21 21:07 VishalNehra

And x more files makes sense, but listing should cancel? I mean, will it buffer? Not a good idea, I think it'll be unnecessary complication.

The listing should cancel, otherwise it will have to finish before the delete actually takes place, and the listing can take very long on some directories.

EmmanuelMess avatar Jul 23 '21 16:07 EmmanuelMess

I'm saying we will not list all the files. Will ve something like

Directories
1. A
2. B
3. C
.
.
25. Xyz
And 25 more...
Total - xx GB

Here the listing has finished. So listing 25/ whatever number wouldn't take that long.

VishalNehra avatar Jul 23 '21 20:07 VishalNehra

I'm saying we will not list all the files. Will ve something like

Directories
1. A
2. B
3. C
.
.
25. Xyz
And 25 more...
Total - xx GB

Here the listing has finished. So listing 25/ whatever number wouldn't take that long.

So listing 25/ whatever number wouldn't take that long.

No, but the "total" would need the entire list, and would take long, as it does now.

EmmanuelMess avatar Aug 03 '21 16:08 EmmanuelMess

No, but the "total" would need the entire list, and would take long, as it does now.

Yes. I missed it probably. We can keep something like

Total: xx GB and processing and keep it updating. LiveData should help in this case.

VishalNehra avatar Aug 04 '21 06:08 VishalNehra

No, but the "total" would need the entire list, and would take long, as it does now.

Yes. I missed it probably. We can keep something like

Total: xx GB and processing and keep it updating. LiveData should help in this case.

But when the user clicks "delete" the listing has to be cancelled, otherwise, as it is implemented, I think the deletion doesn't start.

EmmanuelMess avatar Aug 04 '21 14:08 EmmanuelMess