May 8, 2012 ... Access to device resources via JS API. – Device and Platform ... JavaScript. CSS
... W3C DAP APIs: Battery Status, Network Info, Vibration, … –.
Tizen Web Runtime Ming Jin, Samsung Electronics (May 8, 2012)
Contents • •
What is Web Application & Web Runtime Tizen Web Application – –
•
Tizen Web Runtime – – – –
•
2
Packaging & Configuration Network Access Installer Core Runtime Core Plugin Core Access Control
Summary of Web Application
tizen.org
What is Web Application & Web Runtime • Web Application – Using Web based technologies – Accessing local device / platform resources – Can be installed on the device
• Web Runtime – – – – – 3
HTML JavaScript CSS
Web Application
Lifecycle Management of web applications Execution of web application Access to device resources via JS API Device and Platform integration Access control of web applications
Web Runtime
OS/Platform
tizen.org
Tizen Web Application
Tizen Web Application Overview (1/2) •
W3C/HTML5 specifications – – – –
•
Miscellaneous Web specifications –
•
Widget Spec: Widget P&C, Widget Interface, Widget URI, … HTML5 & CSS3: Video/Audio, Web Storage, Web Workers, HTML5 Forms, … W3C DAP APIs: Battery Status, Network Info, Vibration, … Lagacy Web Standards : HTML4.1, CSS 2.1, DOM level 2, …
WebGL, Typed Arrays, ‘viewport’ metatag
Tizen Web specifications –
Tizen Device API • • • • •
–
Application, Alarm Contact, Calander Call, Messaging, System Info NFC, Bluetooth Etc.
Tizen Web UI FW
https://developer.tizen.org/documentation
5
tizen.org
Tizen Web Application Overview (2/2) Web Application Onload handler …
Launch as service
Onload handler Onload handler
Applications
•
One web app has only one process
•
Web Application has multiple pages
•
W3C Events are handled per page
•
Web Application can be Launched as service by other app
•
Web Application launches browser for external web pages that are not listed in config.xml
Visibility handler … … … …
6
Launch Browser
tizen.org
Packaging • W3C Widget Packaging and Configuration
7
File Extension
.wgt(Zip archive file format)
Configuration
config.xml
Localization
localized content -> locales folder non localized content -> root folder
tizen.org
Configuration • W3C Widget Packaging and Configuration myapp
Namespace Tizen Web Application: http://tizen.org/ns/widgets 8
tizen.org
Network Access from Web Apps • If external page is specified in configuration, load it in current web app; Otherwise, launch Browser;
External URL: Google (Listed in config.xml) External URL: Twitter (Not listed in config.xml)
Same Webview Page 9
Browser Page tizen.org
Tizen Web Runtime
Tizen Web Runtime Overview App Layer
Tizen Web Application Installer Core
Security Core
Network
…
Platform Layer
Runtime Core
Core Layer
Plugin Core Tizen Device API
Plugin Core Webkit (WebCore, JSCore)
11
UI
Multimedia
PIM
tizen.org
Installer Core •
Main functionality –
Install Request From menuscreen or appstore client
Installing web app • •
•
Invoke webapp installer by Tizen pkgmgr server
–
Removing web app • •
Web Application Installer (Install Core)
Web App Install Module
•
–
Appstore Client native app • •
–
>
In this case, all web app are signed app Not yet activated (will be integrated with appstore client when it’s ready)
Myfiles native app •
12
Unregister web app and remove its resources Triggered by MenuScreen or Setting app
Installation triggered by
Register Web App
User can execute the webapp by clicking its icon on menuscreen
Follow install process of W3C P&C Check security policy for access control Register web app and save its resources
•
In this case, all web app are sideloaded The policy might change later to disallow side-loaded web apps
tizen.org
Runtime Core User requests execution of installed webapp by clicking its icon on menuscreen
•
Main functionality –
– –
System events
• •
•
View module
rendering Webkit
Handle jobs related to view including webview creation and deletion Add Custom JS objects to Webkit view to access Tizen device APIs (PIM, Messaging, Bluetooth, NFC, … ) Handle events of WebKit like resource loading, creation of new webview.
Start launching from – –
Menuscreen Other 3rd-party applications •
In the case when the webapp is registered as service
view events …
MSG
PIM
13
Handle jobs related to launch / suspend / resume / reset / terminate webapp internally
View module •
Lifecycle module
Receive system events from platform Request handling of these events properly to Lifecycle module
Lifecycle module •
Web Application Process (Runtime Core)
Client module
Client module • •
Tizen launchpad executes the webapp process
>
tizen.org
Web App Lifecycle
MenuScreen ① User request received for new app launch
Web Application main(argc, argv) ④ Register user-defined callback functions for lifecycle transition
② aul_launch_app (pkgname, bundle);
appcore_efl_main(…) ③
Launch PAD
⑤ Call ‘reset’ callback (check if this launch is for service)
create
no - WRT initialization ⑥ - Creating new webview - Rendering it
App Utility ibrary Window manager Sensor framework System manager
Module 14
Event Loop
Rendering
Call “reset” callback Call “pause” callback Call “resume” callback Call system event callback (e.g. language change) Call “terminate” callback
Legend Process
⑦ start event loop
yes - Find the service page URL ⑥ - Removing existing webview - Rendering service page
- Send invisibility event to page - Pause javascript & plugins - Send visibility event to page - Resume javascript & plugins - Handling each system events - Removing existing webview - WRT deinitialization
operation
flow event
Clear resources (callbacks) tizen.org
Plugin Core … tizen.messaging.getMessageServices( "messaging.sms", serviceListCB, errorCallback);
•
Tizen Web Runtime Plugin
•
Major functionality
…
Web Application Process (Plugin Core)
Loading module
Request Custom JS object on demand
Webkit (JavaScriptCore) Widget Interface
NFC
Message
Platform Resources
– Enable web app access to device/platform resources via JavaScript APIs – Includes Tizen Plugins and W3C widget interface Plugin
– Creation of new JavaScript objects
• JS binding to device/platform resources • Direct communication with JavaScript Core • On demand plugin loading during runtime, except for widget interface plugin
> 15
tizen.org
Access Control Engine • Component responsible for Tizen policy management • Evaluates policy per single request • Manages policy and prompt verdict cache
Access Control Engine Access Control Engine verdict the request
FileSystem Device API Plugin Plugin implementation Calls checkFunctionCall()
16
ALLOW Execute the API implem entation
DENY Return to JS and call error callback
tizen.org
Summary of Web Application Websites
Tizen Web Application
Browser
Web Runtime
W3C Standard JS API
W3C Standard JS API
Tizen Device API
Webkit
Webkit
Plugins
Native Platform
17
tizen.org
Thank You.