Closed Bug 1089984 Opened 10 years ago Closed 7 years ago

[User Story] Launching a mobile-data-restricted app

Categories

(Firefox OS Graveyard :: Gaia::Cost Control, defect)

x86
macOS
defect
Not set
normal

Tracking

(tracking-b2g:backlog)

RESOLVED WONTFIX
tracking-b2g backlog

People

(Reporter: pdol, Unassigned)

References

Details

(Keywords: feature, Whiteboard: [ucid:SMRTDATA-2-3][NaBfT])

User Story

As a cost-conscious user who has previously set a particular app to only use WiFi, when the app attempts to use mobile data while it is in the foreground, I want to be made aware that I have previously restricted that app to WiFi only in case I forgot so that it doesn't appear broken to me.

Acceptance Criteria:
1. After restricting an app from using mobile data and when that app attempts to use mobile data while in the foreground, a prompt is displayed which describes why the app is unable to connect, per UX spec.
2. Dismissing the prompt results in the app functioning as if there is no mobile data connection.
3. Interaction and Visual Design matches UX spec.

Attachments

(2 files)

No description provided.
Whiteboard: [ucid:SMRTDATA-2-3] → [ucid:SMRTDATA-2-3][NaBfT]
blocking-b2g: --- → 2.2?
blocking-b2g: 2.2? → backlog
feature-b2g: --- → 2.2?
User Story: (updated)
Summary: [User Story] Launching a mobile-data-restricted app [DRAFT] → [User Story] Launching a mobile-data-restricted app
feature-b2g: 2.2? → 2.2+
QA Contact: jlorenzo
Assignee: nobody → chrislord.net
Status: NEW → ASSIGNED
My current problem with implementing this is that the app mobile-data property is only available with the web-apps management permission (fine), but the network error page is implemented in the actual app process instead of the system wrapper. As far as I know there's no way to distinguish between certified code running in an uncertified app that does stuff like this vs. code from the app, so I don't think there's a secure way of changing the mobile data settings from within the app. This needs to be done in the system or costcontrol apps, I would suppose. I had a look at handling neterror in the system app instead of the app itself, which would seem feasible, but the 'mozbrowsererror' signal doesn't contain enough information and it seems the about:neterror url doesn't get propagated to the browser element's src either? If we wanted this to be seamless (i.e. you press the button and the stuff happens without bringing up more screens and whatnot), that button needs to be in a certified app - I suppose perhaps we could use a web activity in the system app to do this? I'll continue looking.
(In reply to Chris Lord [:cwiiis] from comment #3) > My current problem with implementing this is that the app mobile-data > property is only available with the web-apps management permission (fine), > but the network error page is implemented in the actual app process instead > of the system wrapper. > > As far as I know there's no way to distinguish between certified code > running in an uncertified app that does stuff like this vs. code from the > app, so I don't think there's a secure way of changing the mobile data > settings from within the app. This needs to be done in the system or > costcontrol apps, I would suppose. > > I had a look at handling neterror in the system app instead of the app > itself, which would seem feasible, but the 'mozbrowsererror' signal doesn't > contain enough information and it seems the about:neterror url doesn't get > propagated to the browser element's src either? > > If we wanted this to be seamless (i.e. you press the button and the stuff > happens without bringing up more screens and whatnot), that button needs to > be in a certified app - I suppose perhaps we could use a web activity in the > system app to do this? I'll continue looking. I think this could be treated in the same way as permissions are handled. May be this error should trigger a chrome event and the chrome event should be returned to system to allow system to show the proper dialog. This dialog could redirect you via web activity to Smart Data / Settings or simply allow to change the preference directly.
(In reply to Salvador de la Puente González [:salva] from comment #4) > I think this could be treated in the same way as permissions are handled. > May be this error should trigger a chrome event and the chrome event should > be returned to system to allow system to show the proper dialog. This dialog > could redirect you via web activity to Smart Data / Settings or simply allow > to change the preference directly. We won't be able to provide the flow we want like this though, it means after pressing the button, the user will have to perform some other action outside of the page before going back to the page - ideally, the user would press the button and continue seamlessly. Perhaps we could do this as a stop-gap, but I'd rather shoot for a better solution first time, if it's feasible (which it should be). We should be able to re-architect things so that the net-error handling can be done in chrome immediately rather than in-process, much like cert-errors and permissions. I think this would be the way to go. We would easily be able to do this now, but for some reason, the browser element doesn't fire the locationchange signal for loading the neterror page. If it did, we could just change that page to a blank page and parse the uri in the AppWindow (and display the UI there, where we can also make sure the title-bar doesn't collapse, and such like).
ok, having digged and thought about this some more, I think we have 2 options: 1- As suggested, allow the per-app data restriction flag permission to be requested on-demand, like camera/gps/etc. This would add an extra door-hangar to the process laid out by the spec, but perhaps has the benefit of making more clear to the user the consequences of what they're doing 2- Extend the browser element's 'error' signal to provide more information about the actual error (beyond fatal and non-fatal) and use that to handle neterror in the chrome rather than in the app. I prefer 2 as I think there's less security risk and it allows us to provide the UX specified. I don't know which of either of these is more effort, but I'm going to look into the second. n?daleharvey for comment on extending the error signal, if any.
Flags: needinfo?(dale)
So there's already a TODO comment about adding more error types to this signal, so this is looking like a viable way to go: http://mxr.mozilla.org/mozilla-central/source/dom/browser-element/BrowserElementChildPreload.js#1205
Depends on: 1106132
The patch in bug 1106132 will allow us, I think, to handle this situation in browser chrome. We don't necessarily need to move all the net-error handling into Chrome (though I think doing so would make sense in the long run). Cancelling n?daleharvey.
Flags: needinfo?(dale)
Attached file WIP: Implement feature
The feature now works, or at least, it would if the platform feature also worked (thus the commented out bits in the patch, but ignore that). This is a bit untidy, but I'd like to get some early feedback before going any further in case you'd prefer a different approach/would like to give some advice now. My personal preference is for all error handling to be done system-side - the current pref hack is kind of against what b2g is about imho (e.g. the user can't provide their own custom net-error handling when using a browser element). This is a first step towards that, after this it would be pretty trivial to also move the rest of the net-error handling into system. That said, I like how the current net-error handling is more modular, code-wise, and it would be good to restructure this patch to replicate that somehow. Suggestions most welcome.
Attachment #8532533 - Flags: feedback?(etienne)
Attachment #8532533 - Flags: feedback?(alive)
Comment on attachment 8532533 [details] WIP: Implement feature I wonder where is the API agreed to go and please if there is, please link me the discussion/mail. * What if on tablet/TV/watch? It seems you are always rendering the dialog. It's bad to see the dialog on other device which is not a mobile. * It'd be better if the code moved into another instantiatable class such as Net Restriction Dialog.
Attachment #8532533 - Flags: feedback?(alive)
Comment on attachment 8532533 [details] WIP: Implement feature Looks like Alive is on it :) If it's pref-based can we cover it with Server [1] based integration tests? [1] https://github.com/mozilla-b2g/gaia/blob/master/apps/system/test/marionette/browser_private_sanity_test.js#L22-25
Attachment #8532533 - Flags: feedback?(etienne)
[Tracking Requested - why for this release]:
feature-b2g: 2.2+ → ---
tracking-b2g: --- → ?
Assignee: chrislord.net → nobody
Status: ASSIGNED → NEW
blocking-b2g: backlog → ---
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: