Closed mdwelsh closed 12 years ago
Should be done.
We will make sure this works.
Junxian, the app you sent me fixes the System Log, with one exception. When I look at the system log, I only see messages since the last 7-10 minutes or so, even though the app has been running for hours. I noticed that the first entry in the log was "Scheduler starting" (from about 7 minutes ago).
I think I know what is going on here. The app is getting evicted due to high memory pressure on the device (I am running a lot of stuff on this phone, including things known to be memory hogs). When the app restarts, it is starting with an empty log, and also clearing the measurement results (both background and user-initiated results). I bet it is also forgetting its measurement schedule when it starts.
We need to persist these things - the system log, the measurement results, and the measurement schedule - across app restarts caused by OS evictions. It is fine if these things do not persist across user-initiated restarts of the app (e.g., the user force kills the app, or reboots the phone). The point here is that the user expects the app to accurately represent its state since the user started it (either manually or by booting the phone). When these things evaporate at random times due to OS evictions, this creates a jarring user experience.
I was under the impression that the original Speedometer app already persisted at least the measurement results and perhaps the log as well. This is easy to do and there are several ways of accomplishing persistent state in Android. Please review the Android app lifecycle (e.g., http://mobileorchard.com/android-app-development-activity-life-cycle/) for background on this.
This is also important to get right as it impacts how much data we can collect. If the app runs measurements and then gets evicted, then if the results are cleared they never get uploaded to our server. Likewise if the app has to get a new schedule every time it restarts it may miss opportunities to run measurements that it would otherwise have run. So let's figure out how to persist this state correctly.
Let me know if you have questions.
Thanks! I will look into this issue tomorrow before our meeting!
In the MeasurementScheduler.java's onCreate and onDestroy, there are already code pieces to store the data and restore the data. I don't think we ever change the code.
I will do more testing to see whether it works. From my test in the last 24 hours, everything was working fine. What I plan to test is manually closing the app and reopening to see if the results are persistent
saveConsoleContent restoreConsole are the two functions for storing and restoring contents in MeasurementScheduler.java
Looks like this is still a problem - there are results showing up on the server which are not visible on the phone's scheduled results page.
Can we close this issue now? I think the system log empty issue is fixed.
I think this is now fixed.
The system log needs to show which actions the app took, which we can use for debugging. This needs to persist across app invocations. When I start up the app the system log is empty.