Closed umranium closed 13 years ago
Newly installed widely distributed version on LG-P500 handset. Failed with this problem first 2 times it was started. First time after 90 secs, second after 1 or 0 samples, seemed to correspond with screen turning off. Couldn't get to fail again after calibration.
Stack trace from LG-P500 handset.
Exception Thrown By Thread:9 'activity.classifier.service.RecorderService-Thread' java.lang.RuntimeException: Unable to start accelerometer. Faulty accelerometer. at activity.classifier.accel.async.AsyncRealAccelReader.assignSample(AsyncRealAccelReader.java:150) at activity.classifier.accel.async.AsyncSampler.run(AsyncSampler.java:100) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:123) at activity.classifier.service.RecorderService.run(RecorderService.java:441) at java.lang.Thread.run(Thread.java:1096)
Whenever there is a hardware fault that may not be easy to recover from, (e.g. the accelerometer doesn't turn on, running out of internal space), the application shouldn't throw an exception and crash. Instead, there should be a way of properly handling such events. Currently the application crashes and leaves a log file with the exception trace. The exception trace is important, but doesn't help the user figure out what is wrong. Since such hardware faults are beyond our level of control, the best we can do is inform the user of the problem with hardware.
This is what I propose: When a hardware fault occurs, generate a special type of exception Have a high-level point where such special exceptions are caught At that point, stop the service Have a special area on the screen for displaying long-standing messages (normal notifications live for only a short while, then disappear, hence easy to miss) Place an error message on this long-standing error/warning message area Clear the messages Turn the service automatically back on after some time (e.g. half an hour or hour), perhaps the hardware fault has rectified itself!