My first thought on this is testing, I am guessing we dont have any current mechanism in which to simulate low / ran out of storage capacity for integration tests, but we likely should
indexedDB and deviceStorage (and as far as I remember appcache) fail in predictable ways when there is no space left on the device, and some apps attempt to fallback gracefully (I know we did some work in the camera for that) however these cases are very rarely exercised and have seen them to have obvious bugs go unnoticed for a long time due to them being edge cases. I dont particularly understand why we would introduce another low storage notification api for apps when the existing storage mechanisms already have well defined error handling mechanisms (localstorage being the exception, I dont really know what happens there, but if it doesnt already have one it seems like we would just want it added to localstorage, and use existing ones for the rest) The system wide notification makes sense though On 2 September 2013 19:31, Fernando Jiménez Moreno <[email protected]>wrote: > Hi folks! > > As some of you already know, if a Firefox OS device gets out of free space > in its data partition it becomes unusable and might not even boot again. We > tried to fix this issue for v1.0.1 introducing a disk space watcher > component [1] based on fanotify [2] that notifies about a low storage > situation and makes indexedDB [3], localStorage [4] and offlineCache [5] to > switch to a read only mode while the device has between 5Mb and 10Mb of > free space. Even if this solved the more urgent issue avoiding that a > Firefox OS could run out of space (in normal conditions), we still have > some work left to do. The resulting UX is far from being acceptable as the > user is notified about the low storage condition but no other pointers are > provided about how can she free space or why the device and apps are > behaving unexpectedly wrong (i.e., changes in settings won't work [6], > incoming messages won't be stored, etc.). My intention opening this thread > is to start a debate about how can we improve > the UX and which are the potential technical solutions (with special > interest in the notifications part). > > A few quick thoughts about this: > > (0). Application manager. > We definitely need a way for users to check how much device storage an app > is consuming and a way to clear this busy space. I am aware of some work > already happening around this and a related discussion about the kind of > API required for this feature at [7], so I would not comment about this > feature on this thread and I will focus on the notifications part. > > 1. System notifications. > Currently, we show and pin a system notification in the toolbar as soon as > we notice that the device is running out of space, but that's all. As I > mentioned above, if the user keeps using her phone, every app trying to > write in indexedDB, localStorage or offlineCache will fail in unknown ways, > and the user will probably not get an appropriate explanation about the > failure. > > I think that we need to show a system notification (I'll let UX decide how > the notification should look like) every time an user attempts to perform > an action associated with a write in the data partition during a low > storage situation (that is a write in indexedDB, localStorage and > offlineCache). That means that we will probably need to trigger this > notifications from each API implementation. > > 2. App notifications. > We currently have a way for apps to get a notification as soon as we > notice a low storage situation. Basically, apps can listen for apps > deviceStorage 'onchange' events with a 'low-disk-space' reason. Check [8] > and [9]. > > IMHO, at least all Gaia apps that depends on indexedDB, localStorage or > offlineCache should be listening for this notification and react > accordingly. I'm thinking about a "low storage mode" for Gaia apps where > writes via these APIs should be avoided and a proper UI should be presented > to the user. This would certainly require quite a significant work > depending on the specifics of each app. > > Unfortunately, we cannot relay on 3rd party apps doing the same, that's > why I suggested the system notification above. > > > Any thoughts? > > Cheers, > > / Fernando > > [1] https://bugzilla.mozilla.org/show_bug.cgi?id=853350 > [2] http://www.xypron.de/projects/fanotify-manpages/man7/fanotify.7.html > [3] https://bugzilla.mozilla.org/show_bug.cgi?id=861903 > [4] https://bugzilla.mozilla.org/show_bug.cgi?id=861920 > [5] https://bugzilla.mozilla.org/show_bug.cgi?id=861894 > [6] https://bugzilla.mozilla.org/show_bug.cgi?id=903903 > [7] https://groups.google.com/forum/#!topic/mozilla.dev.webapi/UMu7nqWoQZM > [8] > https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/storage_watcher.js > [9] https://bugzilla.mozilla.org/show_bug.cgi?id=861921 > _______________________________________________ > dev-b2g mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-b2g > _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
