Bug 1042851 (b2g-nfc-privilege)

(meta) [NFC] Make NFC APIs available to privileged webapps

RESOLVED FIXED in 2.2 S6 (20feb)

Status

Firefox OS
NFC
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: Garner Lee, Assigned: vchang)

Tracking

({dev-doc-complete})

unspecified
2.2 S6 (20feb)
x86_64
Linux
dev-doc-complete
Dependency tree / graph

Firefox Tracking Flags

(feature-b2g:2.2+)

Details

(Reporter)

Description

4 years ago
Current NFC APIs, as represented by MozNFCTag and MozNFCPeer are certified only by permission settings. Improving NFC APIs and investigating how to open them up to more than certitified app permissions will be necessary, as the complimentary Secure Element APIs (Bug 879861) will also be targeted at privilaged level permissions eventually.
(Reporter)

Updated

4 years ago
Blocks: 860906
Blocks: 934289
Summary: [NFC] Make NFC APIs available to privilaged webapps instead of certified only. → (meta) [NFC] Make NFC APIs available to privilaged webapps instead of certified only.

Comment 1

4 years ago
noming for 2.2
feature-b2g: --- → 2.2?
Depends on: 1003268
No longer depends on: 1082303
Summary: (meta) [NFC] Make NFC APIs available to privilaged webapps instead of certified only. → (meta) [NFC] Make NFC APIs available to privileged webapps instead of certified only.
Summary: (meta) [NFC] Make NFC APIs available to privileged webapps instead of certified only. → (meta) [NFC] Make NFC APIs available to privileged webapps
Alias: b2g-nfc-privilege
feature-b2g: 2.2? → 2.2+
According to Comment 0, the purpose is to let privilege app to use NFC API. Remove dependencies as most bugs are not related to this.
No longer depends on: 1087925
No longer depends on: 1090803

Updated

4 years ago
Depends on: 996397
(In reply to Yoshi Huang[:allstars.chh] from comment #2)
> According to Comment 0, the purpose is to let privilege app to use NFC API.
> Remove dependencies as most bugs are not related to this.

Given now there's no User Story defined how to read a tag, operate on a tag, or using other NFC Technology to operator on it, or how foreground app should acquire the tag, and also using custom P2P Sharing UI is not defined yet (Can custom Sharing UI override HOME key? Does it need to vibrate?) There are many things unclear yet, so I also removed the dependencies here.

Updated

4 years ago
User Story: (updated)

Comment 4

4 years ago
Hi Yoshi, I have updated the user story to indicate priority 1 and priority 2 use cases. Can you help list any open items for each? The priority 2 items could go its own separate bug if needed, and we can use this bug for priority 1 items.
Flags: needinfo?(allstars.chh)
Hi Sandip
This is a meta bug for engineering bugs, please file a seperate bug for User Story.
Also the meta bug for NFC user story is Bug 933150.
Flags: needinfo?(allstars.chh)
Summary: (meta) [NFC] Make NFC APIs available to privileged webapps → (meta) [NFC] Make NFC Peer APIs available to privileged webapps
[NI to Jonas and Tim as head up]
Hope the communication isn't too late.
We are about to make these NFC p2p sharing APIs privileged in 2.2.
But within 2.2 timeframe it's less likely to move shrinking UI out of system app clearly. 
The current plan is to approach the final goal step by step.
Flags: needinfo?(timdream)
Flags: needinfo?(jonas)
I basically agree with Jonas on our previous conclusion that we should aim to expose a proper API and solid app-launch flow than expose and change it later. But obviously you have some other concerns.

Jonas can help you on how to migrate it.
Flags: needinfo?(timdream)
Like I've said since before the current API landed: We need to move the UX from the API and into apps themselves. The current API is not a generic NFC API, it's a NFC sharing API, no other use cases are currently possible.

If we want to support sharing through NFC exposed to third party apps, it's better that we do that through WebActivities.
Flags: needinfo?(jonas)
User Story: (updated)
(In reply to Jonas Sicking (:sicking) from comment #8)
> If we want to support sharing through NFC exposed to third party apps, it's
> better that we do that through WebActivities.

I think what Jonas meant is we need to implement a MozActivity which implements share through 'nfc', see some comments from Bug 963531.

And this MozActivity could be from System app or a 3rd party app if user wants a different sharing exprience.

If this is what we are going to do, then make Share API privilege should be landed *after* shared by Activity is done.
Writing the sharing activity will also help to validate NFC sharing API as a whole before exposing it.
I assume we could introduce an 'nfc-share' activity handler (nfcManager seems a good place), which will: 
1. Validate the payload.
2. Start to listen for onpeerfound.
3. Show visual info requesting the user to put the phone against nfc peer, show cancel share button. 
4. Send the payload once nfc peer is detected. Update UI to show status of sending.
5. Stop listening for onpeerfound and close activity handler.
Is the Activity going to be the only way for non-certified apps to do peer-to-peer interactions with NFC?

Or can privileged apps use the API directly instead of having the experience mediated via the Activity?
(Assignee)

Comment 12

4 years ago
I think we can use sendNDEF/sendFile/onpeerready in privileged application after this bug is fixed.
Since Jonas suggests not to open NFC Share API, I'll update the subject and dependencies.
Summary: (meta) [NFC] Make NFC Peer APIs available to privileged webapps → (meta) [NFC] Make NFC APIs available to privileged webapps
No longer depends on: 1082453, 1082493, 1082992
No longer depends on: 1093483

Updated

4 years ago
QA Whiteboard: [COM=NFC]
No longer depends on: 1095417

Updated

4 years ago
QA Whiteboard: [COM=NFC] → [COM=NFC][2.2-feature-qa+]

Comment 14

4 years ago
Can we find someone to own this meta bug? Thanks.
Flags: needinfo?(whuang)
Assignee: nobody → vchang
Flags: needinfo?(whuang)
(Assignee)

Updated

4 years ago
Target Milestone: --- → 2.2 S6 (20feb)

Updated

3 years ago
Status: NEW → ASSIGNED

Updated

3 years ago
QA Whiteboard: [COM=NFC][2.2-feature-qa+] → [COM=NFC]

Updated

3 years ago
QA Whiteboard: [COM=NFC]
(Assignee)

Comment 15

3 years ago
All the dependent bugs are fixed, let's close this.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Keywords: dev-doc-needed
(Assignee)

Comment 16

3 years ago
Hi Yoshi, can we close this bug? It looks like all the dependency bugs are fixed in 2.2 and m-c.
Flags: needinfo?(allstars.chh)
Status: REOPENED → RESOLVED
Last Resolved: 3 years ago3 years ago
Flags: needinfo?(allstars.chh)
Resolution: --- → FIXED
I've gone through the MDN docs and made sure that it is clear that NFC is privileged in 2.2+.

https://developer.mozilla.org/en-US/docs/Web/API/NFC_API
https://developer.mozilla.org/en-US/Apps/Build/App_permissions
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.