Closed Dominik-K closed 10 years ago
I will look into the sharing issue. But importing is very easy (by design). Just copy all the lines from the txt file to import and paste it in the add task edit box. And Preston all tasks imported.
A quick look at the Android source code reveals that Tthe share receiver for bluetooth creates a html file if you share plain/text (which is what Simpletask does)
Only way to share as a plain text file is by providing a Uri to the file in EXTRA_STREAM. This in turn seems to imply that all items need to be copied to a temporary file.
I probably wont add this anytime soon. But you might be lucky because I think sharing very big files also fails, so I will need to add this to fix that issue anyway.
Latest builds at http://mpcjanssen.nl/files/simpletask/master use a content provider which should share a plain text file. @Dominik-K could you check?
Sorry, it doesn't work for me: If I choose a Bluetooth phone in the list, the Bluetooth app crashes (with dialog) and nothing else happens. Tested with just one task.
Sharing to Clipboard app results also in no text to paste.
I tested it with changeset 54b15839, self built (-: .
As a suggestion: Name the APKs on your webspace also with date and short changeset, e.g. simpletask-cloudless--2014-08-08--54b15839.apk Then it would be easier for us testers to name the version which we actually used.
Maybe it would be also better to put the changes for this issue in an extra branch until we fixed it successfully.
Good points. I will include the change set in the temporary builds. The date doesn't really add any information, because it's the change set that matters and that won't change. The build you tried works for me so a logcat would help a lot. If any further changes are needed for this issue, I will create a topic branch.
e4cf5291f6a6f6768a7f8fb37e95354f3b62afc0 adds the git revision to the built apk name. The actual revision can also be found in settings.
Hope the logcat will help.
Thanks for adding the revision. Unfortunately, it's on the path, not at the apk, yet.
Thanks, will investigate the logcat. In the mean time I have found a way to include rev and date in the filename without cluttering up the build directory with different versions.
This is the issue
08-08 11:34:55.090 D/UriDataUtils( 3311): [MMI][UriDataUtils.getUriData][getUriData() - Content: content://nl.mpcjanssen.simpletask.provider/simpletask.txt] 08-08 11:34:55.091 W/ActivityManager( 497): Permission denied: checkComponentPermission() owningUid=10064 08-08 11:34:55.091 W/ActivityManager( 497): Permission denied: checkComponentPermission() owningUid=10064 08-08 11:34:55.091 W/ActivityManager( 497): Permission Denial: opening provider nl.mpcjanssen.simpletask.CachedFileProvider from ProcessRecord{425f0a58 3311:com.mediatek.bluetooth/u0a10035} (pid=3311, uid=10035) that is not exported from uid 10064 08-08 11:34:55.091 W/System.err( 497): java.lang.SecurityException: Permission Denial: opening provider nl.mpcjanssen.simpletask.CachedFileProvider from ProcessRecord{425f0a58 3311:com.mediatek.bluetooth/u0a10035} (pid=3311, uid=10035) that is not exported from uid 10064 08-08 11:34:55.092 W/System.err( 497): at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:6994) 08-08 11:34:55.092 W/System.err( 497): at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7245) 08-08 11:34:55.092 W/System.err( 497): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:637) 08-08 11:34:55.092 W/System.err( 497): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1832) 08-08 11:34:55.092 W/System.err( 497): at android.os.Binder.execTransact(Binder.java:351) 08-08 11:34:55.092 W/System.err( 497): at dalvik.system.NativeStart.run(Native Method)
Could you retry with build from http://mpcjanssen.nl/files/simpletask/master/2014-08-12-c87fc8c/
Sorry for the wrong references above. I'm quite new using git in combination with a fork at github.
I tried several ways to solve the following bug, using d4d863fbc9947b74104205e444dbd5d608475ff2 as base:
This is the error with putExtra(android.content.Intent.EXTRA_STREAM, fileUri)
as you coded it:
08-14 21:34:43.566 730-730/? W/Bundle﹕ Key android.intent.extra.STREAM expected ArrayList but value was a android.net.Uri$StringUri. The default value <null> was returned.
08-14 21:34:43.576 730-730/? W/Bundle﹕ Attempt to cast generated internal exception:
java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList
at android.os.Bundle.getParcelableArrayList(Bundle.java:1223)
at android.content.Intent.getParcelableArrayListExtra(Intent.java:4544)
at com.mediatek.bluetooth.BluetoothShareGatewayActivity.onCreate(BluetoothShareGatewayActivity.java:118)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.access$600(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Using
ArrayList<Uri> fileUris = new ArrayList<Uri>();
fileUris.add(Uri.parse("content://" + CachedFileProvider.AUTHORITY + "/"
+ Constants.SHARE_FILE_NAME));
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, fileUris);
results in:
08-14 21:44:40.094 5927-5927/nl.mpcjanssen.simpletask W/Bundle﹕ Key android.intent.extra.STREAM expected Parcelable but value was a java.util.ArrayList. The default value <null> was returned.
08-14 21:44:40.128 5927-5927/nl.mpcjanssen.simpletask W/Bundle﹕ Attempt to cast generated internal exception:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.os.Parcelable
at android.os.Bundle.getParcelable(Bundle.java:1179)
at android.content.Intent.getParcelableExtra(Intent.java:4516)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7041)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7026)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3388)
at android.app.Activity.startActivityForResult(Activity.java:3349)
at android.app.Activity.startActivity(Activity.java:3584)
at android.app.Activity.startActivity(Activity.java:3552)
at nl.mpcjanssen.simpletask.Simpletask.shareText(Simpletask.java:564)
at nl.mpcjanssen.simpletask.Simpletask.access$3100(Simpletask.java:92)
at nl.mpcjanssen.simpletask.Simpletask$ActionBarListener.onActionItemClicked(Simpletask.java:1469)
at android.widget.AbsListView$MultiChoiceModeWrapper.onActionItemClicked(AbsListView.java:6342)
at com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onActionItemClicked(PhoneWindow.java:2573)
at com.android.internal.app.ActionBarImpl$ActionModeImpl.onMenuItemSelected(ActionBarImpl.java:941)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:156)
at android.widget.AdapterView.performItemClick(AdapterView.java:298)
at android.widget.AbsListView.performItemClick(AbsListView.java:1128)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2812)
at android.widget.AbsListView$1.run(AbsListView.java:3571)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Using
Bundle uriBundle = new Bundle();
uriBundle.putParcelable(null, fileUri);
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, uriBundle);
results in no error before the IntentChooser is shown, but after clicking on "Bluetooth" it gets this:
08-14 21:57:17.727 6173-6173/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40fd79a8)
08-14 21:57:17.733 6173-6173/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mediatek.bluetooth/com.mediatek.bluetooth.BluetoothShareGatewayActivity}: java.lang.ClassCastException: android.os.Bundle cannot be cast to android.net.Uri
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.access$600(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: android.os.Bundle cannot be cast to android.net.Uri
at com.mediatek.bluetooth.BluetoothShareGatewayActivity.onCreate(BluetoothShareGatewayActivity.java:105)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.access$600(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
I should mention the system I'm using: Fairphone 1 (Android 4.2.2, build W20-HL.V0025) with Mediatek code (see first error). What system(s)/device(s) are you using and/or testing on?
According to the docs EXTRA_STREAM requires an Uri, so it seems the bluetooth app is to blame.
Can you try to share to any other app suchs as gmail?
Possible solution may be to use SEND_MULTIPLE instead.
I will create a test build with this later today.
Hmm of course using SEND_MULTIPLE will reduce the apps you can share with. I would really like to know if it works for gmail.
I suspect SEND_MULTIPLE with an ArrayList will work. Build at http://mpcjanssen.nl/files/simpletask/master/2014-08-15-1cc1085/
Sorry for the delay. Also using ACTION_SEND_MULTIPLE didn't work out. #134 inspired me to test if there would be a problem with using both EXTRA_TEXT and EXTRA_STREA. But this didn't work as well.
I think you're right, the Bluetooth app (from Mediatek!?) is to blame. So I put this bug report "upstream" to a Fairphone developer on XDA.
Here are the logs for documentation:
Does not work, either. The following error occurs on executing line
startActivity(Intent.createChooser(shareIntent, "Share"));
09-07 14:55:12.877 20747-20747/nl.mpcjanssen.simpletask W/Bundle﹕ Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String. The default value <null> was returned.
09-07 14:55:12.927 20747-20747/nl.mpcjanssen.simpletask W/Bundle﹕ Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1334)
at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:4600)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7058)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7026)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3388)
at android.app.Activity.startActivityForResult(Activity.java:3349)
at android.app.Activity.startActivity(Activity.java:3584)
at android.app.Activity.startActivity(Activity.java:3552)
at nl.mpcjanssen.simpletask.Simpletask.shareText(Simpletask.java:555)
at nl.mpcjanssen.simpletask.Simpletask.access$3100(Simpletask.java:91)
at nl.mpcjanssen.simpletask.Simpletask$ActionBarListener.onActionItemClicked(Simpletask.java:1460)
at android.widget.AbsListView$MultiChoiceModeWrapper.onActionItemClicked(AbsListView.java:6342)
at com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onActionItemClicked(PhoneWindow.java:2573)
at com.android.internal.app.ActionBarImpl$ActionModeImpl.onMenuItemSelected(ActionBarImpl.java:941)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:156)
at android.widget.AdapterView.performItemClick(AdapterView.java:298)
at android.widget.AbsListView.performItemClick(AbsListView.java:1128)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2812)
at android.widget.AbsListView$1.run(AbsListView.java:3571)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
09-08 11:05:19.012 768-768/? W/Bundle﹕ Key android.intent.extra.STREAM expected ArrayList but value was a android.net.Uri$StringUri. The default value <null> was returned.
09-08 11:05:19.014 768-768/? W/Bundle﹕ Attempt to cast generated internal exception:
java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList
at android.os.Bundle.getParcelableArrayList(Bundle.java:1223)
at android.content.Intent.getParcelableArrayListExtra(Intent.java:4544)
at com.mediatek.bluetooth.BluetoothShareGatewayActivity.onCreate(BluetoothShareGatewayActivity.java:118)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.access$600(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
09-08 11:05:19.015 768-768/? E/BluetoothShareGatewayActivity﹕ uris is null
09-08 11:05:19.134 497-14010/? W/ContextImpl﹕ Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1118 android.server.BluetoothEventLoop.onPropertyChanged:374 dalvik.system.NativeStart.run:-2 dalvik.system.NativeStart.run:-2 <bottom of call stack>
09-08 11:05:20.468 497-14010/? W/ContextImpl﹕ Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1118 android.server.BluetoothEventLoop.onPropertyChanged:374 dalvik.system.NativeStart.run:-2 dalvik.system.NativeStart.run:-2 <bottom of call stack>
09-08 11:05:20.472 21644-21644/? W/ContextImpl﹕ Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1104 android.content.ContextWrapper.sendBroadcast:338 com.android.settings.bluetooth.DevicePickerFragment.sendDevicePickedIntent:175 com.android.settings.bluetooth.DevicePickerFragment.onDevicePreferenceClick:140 com.android.settings.bluetooth.DeviceListPreferenceFragment.onPreferenceTreeClick:149
09-08 11:05:21.066 768-28838/? W/UriDataUtils﹕ [MMI][UriDataUtils.getUriData][getUriData() - no query result for content uri: content://nl.mpcjanssen.simpletask.provider/simpletask.txt]
Thanks for reporting back and good luck with the upstream issue.
If I share a task with Bluetooth, the receiver gets an HTML file with the task in the body.
I would suggest that the file sent should be a simple text file (e.g. todo-shared.txt) with the normal todo.txt format. Then, an option to import todos from a todo.txt would be nice, too. (-: