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

Unable to import events/profiles #56

Closed
craftyguy opened this issue Jan 14, 2018 · 20 comments
Closed

Unable to import events/profiles #56

craftyguy opened this issue Jan 14, 2018 · 20 comments
Labels
bug General label for all bugs (i.e. things not working as intended) compatibility Bugs related to compatibility (of device or OS)

Comments

@craftyguy
Copy link

craftyguy commented Jan 14, 2018

I exported on 0.47 (fdroid version) and tried to import on the latest (0.52 from github), however the file picker won't let me select the exported zip file. This is on Android 8.1.

This screenshot shows that the exports from Easer are not selectable:

screenshot_20180113-192100

@renyuneyun
Copy link
Owner

Hmm... Do you have any other file pickers? Do they behave the same way (i.e. also have this problem)?

Maybe Android 8.0 changed some behaviors in the file manager/selector, but I doubt other apps have followed the change (yet).

@craftyguy
Copy link
Author

I tried with Amaze, it lets me select the file but Easer doesn't actually import it. There is nothing generated in the easer log either :(

@renyuneyun
Copy link
Owner

Hmm... I figured out where possibly went wrong.
Can you try the import function with a clean Easer (e.g. after "clean data")? I think this is because the data directories already exist so Easer refused to import.

@craftyguy
Copy link
Author

Hmm, no that did not work. I tried:

  1. clear data/cache

  2. uninstall/install Easer

  3. settings->import

  4. used two different pickers (Amaze & Dirs, stock Android 8 picker still doesn't allow selecting .zip export..)

  5. after selecting, I am taken to the Easer settings menu again but when I go to Events or Profiles, they are empty.

Is there a directory on /sdcard or something that I need to clear out?

@renyuneyun
Copy link
Owner

renyuneyun commented Jan 17, 2018

No, that's not in /sdcard. Just to clarify: the only two scenarios where Easer will write to external storage (/sdcard) are: 1. Exporting; 2. Logging.

If you wish, I can provide a patch to (hopefully) solve this problem. Though I'd rather test things more and include this in v0.5.3.

p.s. If you have root access, you may also try to copy-paste the file structure to /data/data/ryey.easer/. The structure in the zip file is identical to the data (events, profiles...) there.

@craftyguy
Copy link
Author

Hmm, so I cleared out everything that the app creates and it doesn't import. I'd definitely test a patch or the next release, whatever is easiest for you!

@craftyguy
Copy link
Author

So when you say 'the data directories already exist' is causing this, if I go to (in Android not easer app) 'settings'-->apps-->easer and 'clear data & cache', this should delete all data the app has created under /data... right? Doing that doesn't seem to help the problem, I still cannot import the file.

@renyuneyun
Copy link
Owner

renyuneyun commented Jan 18, 2018

@craftyguy I have a guess. The only affected lines are (in ryey.easer.core.data.Helper):

File newFile; // initialized elsewhere; represents the corresponding file in the app storage for one file in the zip
if (!new File(newFile.getParent()).mkdirs()) {
    throw new IOException(String.format("failed to create parent dird for <%s>", newFile.toString()));
}

So, I guess directories are also treated as a ZipEntry, which makes this problem happen (since creating "the parent directory of a subdirectory in the app storage" is equivalent to creating "the app storage directory", which will always fail [because this directory will always exist when the app runs]).

@renyuneyun
Copy link
Owner

(As a progress indicator:)

Splitting Events to Event Logic + Scenarios has been done and tested.

I'm trying to find a best way to add the control of continuation / persistance / repeatable (as in #55) to Events. After that, the most important change of v0.5.3 will be done and it will be pushed (unless there is anything else important).

@craftyguy
Copy link
Author

@renyuneyun Ah, your guess makes sense, though I should see that exception printed somewhere if it were true.. right? I don't see it in the Easer log though (under /sdcard), would it be printed to the system log (logcat)?

@craftyguy
Copy link
Author

@renyuneyun

Ok, I think this confirms your theory. I re-ran Easer and tried to import the zip with logcat running, here's the exception that was printed to logcat:

01-18 16:02:03.261 25601 25601 D pickup  : file
01-18 16:02:03.376 25507 25507 W System.err: java.io.IOException: failed to create parent dird for </data/user/0/ryey.easer/files/event/Charging.xml>
01-18 16:02:03.376 25507 25507 W System.err:    at ryey.easer.core.a.c.a(Unknown Source:69)
01-18 16:02:03.376 25507 25507 W System.err:    at ryey.easer.core.ui.setting.SettingsActivity$a.onActivityResult(Unknown Source:15)
01-18 16:02:03.376 25507 25507 W System.err:    at android.app.Activity.dispatchActivityResult(Activity.java:7293)
01-18 16:02:03.376 25507 25507 W System.err:    at android.app.ActivityThread.deliverResults(ActivityThread.java:4265)
01-18 16:02:03.376 25507 25507 W System.err:    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4313)
01-18 16:02:03.376 25507 25507 W System.err:    at android.app.ActivityThread.-wrap19(Unknown Source:0)
01-18 16:02:03.376 25507 25507 W System.err:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1645)
01-18 16:02:03.376 25507 25507 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:106)
01-18 16:02:03.376 25507 25507 W System.err:    at android.os.Looper.loop(Looper.java:164)
01-18 16:02:03.376 25507 25507 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:6497)
01-18 16:02:03.376 25507 25507 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
01-18 16:02:03.376 25507 25507 W System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-18 16:02:03.376 25507 25507 W System.err:    at com.android.internal.os.ExecInit.main(ExecInit.java:49)
01-18 16:02:03.376 25507 25507 W System.err:    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
01-18 16:02:03.376 25507 25507 W System.err:    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:285)

@renyuneyun
Copy link
Owner

renyuneyun commented Jan 22, 2018

v0.5.3 is out :)

F-droid version may be out a few days later since #57 mentioned that they figured out the problem.

@craftyguy
Copy link
Author

Thanks, I will test this right now!

@craftyguy
Copy link
Author

@renyuneyun importing my exported profiles worked with v0.5.3, however it locked up when trying to view a profile, and after force-closing it, it now just immediately closes when I try to 'start' the Easer service again.

I will try to provide a log when i get home. Note that I got a warning that my data was 'old' and to covert it, which I did do under settings.

@renyuneyun
Copy link
Owner

Hmm, I don't remember a compability change in these versions (though I was hoping to LOL).

The warning for "old data" is for the old xml format. Have you succeeded in converting the data format (e.g. a toast stating success, or this warning is not shown again on next start up)? Does this problem still exist after converting to the new format?

@craftyguy
Copy link
Author

Here's the sequence of events:

  1. install 0.5.3

  2. started easer, then settings->import

  3. used Amaze to pick the zip

  4. Went to profiles, saw them listed, selected one

  5. Easer froze (white screen). Force-closed it

  6. Started Easer again, was prompted to convert

  7. went to settings->convert data

  8. went back to easer main screen and selected 'start' from menu

  9. easer 'crashed to desktop' after tapping on 'start'

Subsequent attempt so repeat steps 8-9 have the same effect, Easer closes immediately after tapping on 'start'

@renyuneyun
Copy link
Owner

That seems to be a result of "bad" data. The curious part is that bad data should be ignored when encountered... (Plus, there shouldn't be any bad data in your situation...)

It would be the best if you can provide a log (either logcat or the logging stored in /sdcard/logger/ by easer [if you enabled that]).

p.s. If appropriate (e.g. there aren't any sensitive data), you can also provide the exported data (the .zip file) so I can debug directly on my side.

@craftyguy
Copy link
Author

craftyguy commented Jan 23, 2018

logcat of steps 8 & 9 here: https://craftyguy.net/paste/vLbIYD2q

I also attached the zip file. I modified this zip to obfuscate MAC addresses. If you need the original I can email it directly to you.

Easer.2018-01-13.06:52:11.zip

@renyuneyun
Copy link
Owner

renyuneyun commented Jan 23, 2018

They ought to be fixed in v0.5.3.1 :)
Note: clear the data before trying v0.5.3.1... There are really data corruptions previously (which happens during "convert")...

There are three bugs involved in total...

@craftyguy
Copy link
Author

@renyuneyun looks like it works! I was able to successfully import my exported data and start Easer (after clearing data first, as you suggested). Thank you for fixing this!! 😄

The only other issue is with the default picker on Android 8 not recognizing the Easer data export as a valid file to pick. I could make a new issue for this if you want, or keep this one open, or ??
Only reason I suggest keeping that one open is that it seems wrong to require users (presumably with Android 8) to install a file manager app just to be able to use the import feature on Easer. I guess that's ultimately up to you.

@renyuneyun renyuneyun added bug General label for all bugs (i.e. things not working as intended) compatibility Bugs related to compatibility (of device or OS) labels Jan 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug General label for all bugs (i.e. things not working as intended) compatibility Bugs related to compatibility (of device or OS)
Projects
None yet
Development

No branches or pull requests

2 participants