gsantner / dandelion

a unofficial diaspora* client for Android
https://github.com/gsantner/dandelion
Other
113 stars 32 forks source link

Sharing image to another app crashes app on Oreo #173

Closed vanitasvitae closed 7 years ago

vanitasvitae commented 7 years ago

General information

Steps to reproduce

  1. Long click on image
  2. Share

Expected result

What is the expected output? Dialog pops up for share target selection

What do you see instead? App crashes

According to this page the URI shared to other apps should not be a file:// URI, but instead a content://. A fix would probably involve utilizing a content provider.

10-23 13:55:09.209 31052 31052 D AndroidRuntime: Shutting down VM
10-23 13:55:09.218 31052 31052 E AndroidRuntime: FATAL EXCEPTION: main
10-23 13:55:09.218 31052 31052 E AndroidRuntime: Process: com.github.dfa.diaspora_android, PID: 31052
10-23 13:55:09.218 31052 31052 E AndroidRuntime: android.os.FileUriExposedException: file:///storage/emulated/0/Pictures/Diaspora/1508759708741.png exposed beyond app through ClipData.Item.getUri()
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.net.Uri.checkFileUriExposed(Uri.java:2348)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.content.ClipData.prepareToLeaveProcess(ClipData.java:941)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.content.Intent.prepareToLeaveProcess(Intent.java:9735)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.content.Intent.prepareToLeaveProcess(Intent.java:9741)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.content.Intent.prepareToLeaveProcess(Intent.java:9720)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1609)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.app.Activity.startActivityForResult(Activity.java:4472)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.app.Activity.startActivityForResult(Activity.java:4430)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:871)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.app.Activity.startActivity(Activity.java:4791)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.app.Activity.startActivity(Activity.java:4759)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.content.ContextWrapper.startActivity(ContextWrapper.java:366)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at com.github.dfa.diaspora_android.web.ContextMenuWebView$1$3.onPostExecute(ContextMenuWebView.java:174)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at com.github.dfa.diaspora_android.web.ContextMenuWebView$1$3.onPostExecute(ContextMenuWebView.java:165)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.os.AsyncTask.finish(AsyncTask.java:695)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.os.AsyncTask.-wrap1(Unknown Source:0)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:105)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:164)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6544)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at com.android.internal.os.ExecInit.main(ExecInit.java:50)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
10-23 13:55:09.218 31052 31052 E AndroidRuntime:    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:284)
10-23 13:55:09.226 31052 31052 E AndroidRuntime: Error reporting crash
10-23 13:55:09.226 31052 31052 E AndroidRuntime: java.lang.RuntimeException: Bad file descriptor
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at android.os.BinderProxy.transactNative(Native Method)
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at android.os.BinderProxy.transact(Binder.java:748)
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at android.app.IActivityManager$Stub$Proxy.handleApplicationCrash(IActivityManager.java:4321)
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:115)
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
10-23 13:55:09.226 31052 31052 E AndroidRuntime:    at java.lang.Thread.dispatchUncaughtException(Thread.java:1953)
10-23 13:55:09.226 31052 31052 I Process : Sending signal. PID: 31052 SIG: 9
10-23 13:55:09.307  4510  5883 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=43, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@5592048)
10-23 13:55:09.307  4510  7165 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=42, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@e78dee1)
10-23 13:55:09.307  4510 19253 I ActivityManager: Process com.github.dfa.diaspora_android (pid 31052) has died: fore TOP 
v4-adi commented 7 years ago

I will look into it.

v4-adi commented 7 years ago

@gsantner in which class I should define common constants? I can't find common constants class in the project?

gsantner commented 7 years ago

what constant(s) are needed? Im not aware of an global constants file

v4-adi commented 7 years ago

@gsantner I need to provide authorities in FileProvider constructor. Currently, I am using BuildConfig.APPLICATION_ID for authorities. I think it would be better to define it at one place. Or if I should make a utility function for the same in which class I should do so? you can see my changes at following link https://github.com/Diaspora-for-Android/dandelion/pull/174/commits/5660787e57bd95410869a75a2b7aec1eda4f0edc What do you suggest?

gsantner commented 7 years ago

what currently is in the pr looks very fine to me. I have to admit, do what you think fits best, no pteference here

v4-adi commented 7 years ago

@gsantner I have updated the pull request. Let me know if any changes are required. And let me know if you need help with any of the other bug-fixes or projects.

gsantner commented 7 years ago

@v4-adi thanks for your help! currently I am not aware of a special crash, but maybe take a look at MemeTastic (MainActivity), and the one open PR (at MemeCreateActivity) if you find something bad related to e.g. this.