Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for "non-primary" external storage provider folder uris. #139

Conversation

quantum-byte
Copy link
Contributor

@quantum-byte quantum-byte commented Mar 14, 2023

Implemented a fix to support non "primary" external storage document provider uris like "home:" for the "documents" folder.

Fixed Issue / How to reproduce:

  1. Create a folder "Documents" under "storage/emulated/0" ( under Android 9 or 10 - for example on the android emulator)
  2. Try to define this folder as a Backup folder
  3. Crash
java.lang.NullPointerException: path must not be null
	at de.lolhens.resticui.util.DirectoryChooser$Companion$DefaultDirectoryChooser.register$lambda$0(DirectoryChooser.kt:48)
	at de.lolhens.resticui.util.DirectoryChooser$Companion$DefaultDirectoryChooser.$r8$lambda$jK8O1H1CKL7PB9Zkehlu4Bw5Rh0(Unknown Source:0)
	at de.lolhens.resticui.util.DirectoryChooser$Companion$DefaultDirectoryChooser$$ExternalSyntheticLambda0.onActivityResult(Unknown Source:6)
	at androidx.activity.result.ActivityResultRegistry$1.onStateChanged(ActivityResultRegistry.java:149)
	at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:360)
	at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:271)
	at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:313)
	at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:151)
	at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
	at androidx.fragment.app.Fragment.performStart(Fragment.java:3167)
	at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:588)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:279)
	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.dispatchStart(FragmentManager.java:2902)
	at androidx.fragment.app.Fragment.performStart(Fragment.java:3171)
	at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:588)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:279)
	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.dispatchStart(FragmentManager.java:2902)
	at androidx.fragment.app.FragmentController.dispatchStart(FragmentController.java:274)
	at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:359)
	at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1433)
	at android.app.Activity.performStart(Activity.java:7924)
	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3332)
	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loop(Looper.java:224)
	at android.app.ActivityThread.main(ActivityThread.java:7560)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

The content uri looks like the this: content://com.android.externalstorage.documents/tree/home%3A/document/home%3A and causes the issue.

quantum-byte and others added 2 commits March 14, 2023 12:49
…provider uris like "home:" for the "documents" folder
@lhns lhns merged commit 20c99fb into lhns:main Mar 14, 2023
@quantum-byte
Copy link
Contributor Author

Regarding 2066bb4.

Ah my bad. I wanted to exclude that. git commit -a strikes again 😅

@lhns
Copy link
Owner

lhns commented Mar 14, 2023

Just released your fix with v0.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants