biotinker / LibreTasks

An updated form of Omnidroid
Apache License 2.0
82 stars 22 forks source link

Crash when using "Time is day of week" filter #178

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'd like to create a rule based on "Time is ", using the weekdays.

When I try to create it using these steps, I get a crash:

1. Create new rule
2. Time is > Time is > Add Filter > Time > Time is day of week

The messages indicates:

"Sorry! The application Omnidroid (process.edu.nyu.cs.omnidroid.app) has 
stopped unexpectedly. Please try again."

Clicking "Force close" makes it crash again with the same message.

Clicking "Force close" again brings back the initial welcome screen.

I am using CyanogenMod 7.2 (an unofficial port for the HTC Wildfire S - 
http://wiki.cyanogenmod.com/wiki/Unofficial_Ports#CyanogenMod_7_2). I also 
reproduced this same behavior on a Nook Color running CyanogenMod 7.1 (based on 
Android 2.3.7).

Original issue reported on code.google.com by magic...@gmail.com on 5 Mar 2012 at 5:03

GoogleCodeExporter commented 8 years ago
crash affects me too on CM10 nightly Xperia Pro.

Original comment by hendri...@gmail.com on 8 Apr 2013 at 4:59

GoogleCodeExporter commented 8 years ago
E/AndroidRuntime(11415): FATAL EXCEPTION: main
E/AndroidRuntime(11415): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{edu.nyu.cs.omnidroid.app/edu.nyu.cs.omnidroid.app.view.simple.Acti
vityDlgFilterInput}: java.lang.IllegalArgumentException: Unknown filter ID: 12
E/AndroidRuntime(11415):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
E/AndroidRuntime(11415):    at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime(11415):    at 
android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime(11415):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime(11415):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(11415):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(11415):    at 
android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime(11415):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime(11415):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(11415):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(11415):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(11415):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(11415): Caused by: java.lang.IllegalArgumentException: Unknown 
filter ID: 12
E/AndroidRuntime(11415):    at 
edu.nyu.cs.omnidroid.app.view.simple.factoryui.RuleFilterViewFactory.buildUIForF
ilter(RuleFilterViewFactory.java:107)
E/AndroidRuntime(11415):    at 
edu.nyu.cs.omnidroid.app.view.simple.ActivityDlgFilterInput.initializeUI(Activit
yDlgFilterInput.java:72)
E/AndroidRuntime(11415):    at 
edu.nyu.cs.omnidroid.app.view.simple.ActivityDlgFilterInput.onCreate(ActivityDlg
FilterInput.java:51)
E/AndroidRuntime(11415):    at 
android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime(11415):    at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime(11415):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime(11415):    ... 11 more

Original comment by inkubo3@gmail.com on 4 Feb 2015 at 11:17

seylerius commented 8 years ago

Another report on this one: I'm using CM12.1 nightly on a Galaxy Note 3.

biotinker commented 8 years ago

Thanks for the report! Could you post a logcat of the crash if you have one?

biotinker commented 8 years ago

Looking at the one above I'm guessing it's a bug with the filter not being properly inserted into the database

maltek commented 8 years ago

I'm running into the same exception, only with different line numbers. (This is version 0.5.0 from F-Droid.) I'm running a recent Cyanogenmod 13 Nightly on a LG G3.

05-29 00:46:42.277  2344  2344 E AndroidRuntime: FATAL EXCEPTION: main
05-29 00:46:42.277  2344  2344 E AndroidRuntime: Process: libretasks.app, PID: 2344
05-29 00:46:42.277  2344  2344 E AndroidRuntime: Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overl
ay:system}
05-29 00:46:42.277  2344  2344 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{libretasks.app/libretasks.app.view.simple.ActivityDlgFilterInput}: java.lan
g.IllegalArgumentException: Unknown filter ID: 12
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.ActivityThread.-wrap11(ActivityThread.java)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5461)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-29 00:46:42.277  2344  2344 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unknown filter ID: 12
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at libretasks.app.view.simple.factoryui.RuleFilterViewFactory.buildUIForFilter(RuleFilterViewFactory.java:125)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at libretasks.app.view.simple.ActivityDlgFilterInput.initializeUI(ActivityDlgFilterInput.java:90)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at libretasks.app.view.simple.ActivityDlgFilterInput.onCreate(ActivityDlgFilterInput.java:69)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:6251)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
05-29 00:46:42.277  2344  2344 E AndroidRuntime:        ... 9 more
biotinker commented 8 years ago

Yeah, this bugfix didn't make it into this release. I'll try to get it into the next one.

mvglasow commented 7 years ago

I did some analysis on this one. As far as I can tell, RuleFilterViewFactory.buildUIForFilter() gets called with a modelFilter argument that is in the database (modelFilter.getDatabaseId() returns 12 on my install), but none of the if statements matches (there is no code that tells us how to build that particular UI).

mvglasow commented 7 years ago

I got one step further: After adding a value to RuleFilterViewFactory$AllFilterID and the corresponding if statement to RuleFilterViewFactory.buildUIForFilter() (so far, only with code to throw an IllegalArgumentException with a custom message), I get my custom message in the logcat.

The next step would be to replace the throw statement with code to build the appropriate UI. Alas, a glance at ViewItemFactory reveals UIs for all kinds of data types, but not OmniDayOfWeek. Also, browsing the contents of the libretasks.app.view.simple.viewitem package does not reveal a UI for weekdays. Looks like this needs to be implemented from scratch, because so far nobody has. Working on it…

mvglasow commented 7 years ago

Got the UI working, but the data doesn’t get stored. Will keep investigating...

mvglasow commented 7 years ago

Got it. The issue with the data getting stored was due to a bug I’d introduced in an earlier commit in my private branch. This is now fixed, and weekday rules now work in my branch.

mvglasow commented 7 years ago

And the commit is: https://github.com/mvglasow/LibreTasks/commit/6de9c84aa3f57e538223fa2440852abcc55949ab

Still waiting for #218 to get merged, plus some of my features which introduce functionality needed for this fix (which is really an addition of a feature that has been half-implemented up to now).

mvglasow commented 7 years ago

218 is merged, but it turns out some other fixes (#222, #226 and possibly #225) became necessary—two for proper build environment support, one which fixes a bug with PowerOffAction not being inserted during a DB upgrade. Once they’re added, I can file a pull request for the fix.

@biotinker I have a few things in the queue, several new features (events for WiFi and Bluetooth connect/disconnect, battery percentage change and GPS fix change; attribute for headset presence; action for speech output) as well as some UI changes (consistent use of default device theme). The fix (being really a completion of an incomplete feature) relies on code introduced with at least one of these features. Do you prefer one big pull request, or would you like me to break it down to one per feature? Also, during development I have bumped the DB version once for each new feature (six versions in total)—is that OK or would you like me to consolidate it to something like one new version per pull request?