29
Embedded Software Lab. @ SKKU 29 1 Sungkyunkwan University Tizen v2.3 Application Model

Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!1

Sungkyunkwan University

Tizen v2.3 Application Model

Page 2: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!2

1. Web Application Model

Page 3: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!3

• Web 应⽤用程序 – Using web based technologies (HTML/JS/CSS/etc.) – Accessing local device / platform resources – Can be installed on the device

• Web 运⾏行时 – Package management (installation, update, etc.) – Execution and lifecycle (launching, pause, resume, etc.) – Runtime security (API/network access, sandboxing, etc.) – Device and platform integration

什么是Web应⽤用程序和Web运⾏行时

Page 4: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!4

Tizen web app ecosystem

Page 5: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!5

• Environment within which all web 应⽤用程序s run on Tizen • To access local device and platform resources

Tizen上的Web进⾏行时

Page 6: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!6

Tizen Web 运⾏行时内部时钟

Page 7: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!7

• Describes the web application itself • Follows W3C widget Spec, and Tizen-

specific features • <name> : application name • <widget version=“x.y.z”> attribute • <content src=“start_file_name.html”/> • <icon src=“icon_file_name.png” /> • <author> • <feature>: Each feature has a corresponding

URL from which you can obtain more information about the feature

config.xml• <tizen:privilege> element. List any privileges

application requires • <tizen:application id=“…”> attribute. Unique

application identifier • <tizen:application required_version=“”>

attribute. The minimum required platform on which the application can run

• <tizen:app-control> To make use of certain functionality provided by another application

• <tizen:app-widget> Show some dynamically updated content from another application directly on the home screen

Page 8: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!8

• 基于开源的javascript库 – Such as jQuery mobile, jquery, globalize

• 提供许多具有相同外貌与观感的组件

Tizen Web UI framework

Page 9: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!9

• 概述 – JavaScript开发移动web应⽤用程序的框架 –包括优化等功能UI控件,事件处理程序,动画效果,Ajax通信 –包括HTML、CSS、JavaScript –基于html5的⽤用户界⾯面系统旨在使响应web站点和应⽤用程序 –移动⽤用户界⾯面;使⽤用基于标记的HTML标记(数据- *属性、css类)

• ⽀支持平台 –Apple iOS, Android, Windows Phone, Blackberry, Palm WebOS, Firefox Mobile, Chrome for

Android, Skyfire, Opera Mobile, Meego, Tizen, Samsung Bada, Kindle, … • 下载

– From jquerymobile.com or using jQuery Mobile CDN (Contents Delivery Network) • Comparison with Sencha Touch

–Superior in terms of portability, performance, entry barrier, and library size

jQuery Mobile

Page 10: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!10jQuery Mobile (example)

jQuery Mobile libraryjQuery libraryjQuery Mobile stylesheets

Page 11: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!11

• 设计和开发为多种⽂文化服务的应⽤用程序 • jQuery.glob.all.js 包括⼤大概350种⽂文化 (date, number, currency)

Globalization

Page 12: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!12

2. Native Application Model

Page 13: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!13

• 界⾯面应⽤用程序 –有⼀一个图形⽤用户界⾯面 –只有⼀一个可以在前台

• 服务应⽤用程序 –它没有图形⽤用户界⾯面(背景) –显⽰示任务切换器(它提供了所有正在运⾏行的应⽤用程序)的列表,但是没有事件发⽣生时如果⽤用户选择

–有⽤用的执⾏行需要定期运⾏行或持续的活动,但不需要任何⽤用户干预

Native 应⽤用程序

Page 14: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!14

• Tizen多任务 –只有⼀一个Tizen⽀支持UI应⽤用程序可以运⾏行在前台,其余应⽤用程序在后台运⾏行 –确定哪些UI应⽤用程序是运⾏行在前台

• 使⽤用任务切换器 • 使⽤用主菜单图标

–当结束键或终⽌止系统内存低 • 内存溢出政策

–低内存运⾏行系统时,系统开始终⽌止应⽤用程序⼀一个接⼀一个,直到⾜足够的内存再次可⽤用 –⽤用户最后放置他们的背景

• 多任务优先级

Native 应⽤用程序模型

Low Background UI 应⽤用程序s

Service 应⽤用程序s

Background media players

Foreground UI 应⽤用程序

Foreground media player

应⽤用程序 launcher

Page 15: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!15

• 系统事件处理 –电池的事件

• 检查设备的电池电量使⽤用OnBatteryLevelChanged()或OnBatteryLevelChangedInPercentage()事件处理程序 • 例)空;终⽌止应⽤用程序,关键;停⽌止使⽤用多媒体功能

–内存事件 • 使⽤用OnLowMemory()事件处理程序来释放堆中未使⽤用的内存

– 屏幕事件(只适⽤用于UI应⽤用程序) • 当OnScreenOff(),减少电⼒力消耗通过释放激活资源(如3 d、媒体和传感器)不再是⽤用来进⼊入睡眠模式

– 检查点的事件 • 为了避免由于意外终⽌止导致的数据丢失,使⽤用OnAppChechpointing()事件处理程序保存应⽤用程序状态或上下⽂文的应⽤用程序注册表或设备存储

Native 应⽤用程序模型

Page 16: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!16

• ⼀一个框架是由UI应⽤用程序,由AddFrame()初始化 • 应⽤用程序初始化后,它可以处理事件和其状态设置为运⾏行 • 应⽤用程序使⽤用OnAppTerminating()事件处理程序释放资源

Life Cycle of Native Applications

Page 17: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!17

• 启动 – UI应⽤用程序;从主菜单中,任务切换器,运⾏行应⽤用程序或者当注册条件满⾜足 –服务应⽤用;从另⼀一个应⽤用程序

• 开始的时候, –进程管理器加载必要的库和可执⾏行⼆二进制到内存中 –创建实例的应⽤用程序,执⾏行OspMain()

• 初始化,之前应⽤用程序加载,OnAppInitializing()

启动应⽤用程序

Page 18: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!18

• When, – Tizen native 应⽤用程序 itself calls the Terminate() – The system forced the 应⽤用程序 to shut down

• Memory or battery power is extremely low – Handled in the OnAppTerminating()

• Free its resources and terminates • Allocated UI controls, such as the form and its child controls are also released • save the 应⽤用程序's states into 应⽤用程序 registry

• urgent termination – triggered by the power-off and OOM – this method is not likely to be called, so the 应⽤用程序 should save the critical data

as often as possible. (check point or callback for low memory)

• normal termination – triggered by self or other 应⽤用程序s – this method is executed properly (more time but limit of 3-5 seconds)

终⽌止应⽤用程序

Page 19: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

29

!19应⽤用程序状态转换

Paused •Application is not visible for the user

Running•While the UI app is running, it can switch between the background and foreground•During the switch, the window state of the app changes •The service app always runs in the background

Initializing•App framework initializes the application•The app data saved on the previous run is restored•For UI app, the app's frame must be created and added explicitly in app_create_cb()

Terminated•App framework removes the app from memory

Page 20: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!20

• full-screen Tizen::Ui::Controls::Frame container that creates the top-level window –必须有⾄至少⼀一个帧/应⽤用程序

• 表单元素⼜又包含指标栏,⻚页眉、⻚页脚、和UI控件 –可以有多种形式/应⽤用程序

Tizen ⽤用户接⼝口

Page 21: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!21

• One frame in a UI application which is the top-level main window • The frame has three states

帧状态转换

State: MinimizedStatus: Invisible, Graphic / media processing and sensor manipulations are discontinuedTriggered by:1. HOME key is pressed2. Another UI application has been launched

State: Deactivated Status: No input to deactivated frame, partially shownTriggered by:1. Another frame is located on top of the current frame2. Another window, such as an incoming call, pop-up, or alarm is displayed

State: Activated Status: Fully visible, receive inputTriggered by:1. User selects the application on task switcher2. User presses the main menu icon3. A window that had caused the application to become deactivated is terminated

Page 22: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!22

• 注册有特定的启动条件的应⽤用程序 –启动条件得到满⾜足时,注册的应⽤用程序⾃自动启动

• 注册 – At runtime, AppManager::RegisterAppLaunch() method with privilege

• http://tizen.org/privilege/application.launch –在应⽤用程序安装时,在清单⽂文件中指定的条件

注册启动条件

Type Condition format Description

Due time L"DateTime='mm/dd/yyyy hh:mm:ss'"

Launch at the wall time, 'mm/dd/yyyy hh:mm:ss'.

Period L"DueTime='mm/dd/yyyy hh:mm:ss'LaunchPeriod='mm'"

Launch at the wall time, 'mm/dd/yyyy hh:mm:ss', and every 'mm' minutes. The launch period must be between 60 minutes and 10 years.

Serial L"Serial='keyword'" Launch when receiving 'keyword' as serial communication input.

NFC L"NFC='command'" Launch when receiving 'command' as Near Field Communication (NFC) tag with NFC Data Exchange Format (NDEF) data.

Page 23: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!23

• Tizen::Io::MessagePortManager class –所有Tizen本机应⽤用程序可以使⽤用MessagePort相互通信 –消息数据类型映射数据的键和值 (Tizen::Base::String)

• 两种类型的消息端⼝口 – The Tizen::Io::LocalMessagePort class

• 从另⼀一个接收消息应⽤用程序,设置Tizen:从当地消息:Io::IMessagePortListener接⼝口端⼝口。 – The Tizen::Io::RemoteMessagePort class

• 发送消息到其他应⽤用程序 • 当地消息端⼝口信息可以发送到其他应⽤用程序的双向沟通

Message Port

Page 24: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!24

• SendMessage() –发送消息到另⼀一个应⽤用程序

• OnMessageReceivedN() –另⼀一个应⽤用程序可以接收消息

单向传输

Page 25: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!25

• 在服务器应⽤用程序, – Tizen::Io::LocalMessagePort::RequestLocalMessagePort()

• 请求⼀一个LocalMessagePort实例与指定消息端⼝口名称 – AddMessagePortListener()

• 从客户端应⽤用程序接收消息应⽤用程序 – OnMessageReceivedN()

• 处理从客户端应⽤用程序接收到的消息

• 在客户端应⽤用程序, – Tizen::Io::LocalMessagePort::RequestRemoteMessagePort()

• 检索RemoteMessagePort实例与指定远程应⽤用程序ID和消息端⼝口名称 – SendMessage()

• 从客户机应⽤用程序发送消息到服务器应⽤用程序

单向传输

Page 26: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!26

• SendMessage() –发送消息和本地消息端⼝口信息给另⼀一个应⽤用程序 –这个本地消息端⼝口信息可以⽤用来发送从其他应⽤用程序接收这些消息的响应消息

• OnMessageReceivedN() –接收消息 –远程消息端⼝口信息可以⽤用来发送响应消息的应⽤用程序,发送消息

双向交流

Page 27: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!27

• 服务器端应⽤用程序, – Tizen::Io::LocalMessagePort::RequestLocalMessagePort()

• Requests a LocalMessagePort instance with the specified message port name – AddMessagePortListener()

• 从客户端应⽤用程序接收消息 – OnMessageReceivedN()

• 处理从客户端应⽤用程序接收⽽而来的消息 • 使⽤用RemoteMessagePort实例响应从客户端应⽤用程序接收⽽而来的消息

• 客户端应⽤用程序, – RequestRemoteMessagePort() / RequestLocalMessagePort()

• Retrieve the RemoteMessagePort/LocalMessagePort instance with specified remote 应⽤用程序 ID and message port name / just message port name

– SendMessage() • 发送客户端应⽤用程序的消息给服务器端应⽤用程序

– OnMessageReceivedN() • 处理从服务器端应⽤用程序接受⽽而来的消息

Bi-directional communication

Page 28: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!28

• 应⽤用程序 controls and data controls – Create the author certificated and register the created certificate to IDE

• Execute certificate-generator.sh or certificate-generator.bat with shell • Output is pkcs12 file

– Give permission by 应⽤用程序 certificate in the manifest editor • Other 应⽤用程序s with which have the same permission can access the exported

functionality of the 应⽤用程序

• Message port communication – RequestTrustdLocalMessagePort(), RequestTrustedRemoteMessagePort()

• Get the trusted message port instance • Only if both 应⽤用程序s are signed with a certificate that is uniquely assigned to its

developer

Trusted Communication

Page 29: Tizen v2.3 Application Model...• Output is pkcs12 file – Give permission by 应程序 certificate in the manifest editor • Other 应程序 s with which have the same permission

Embedded Software Lab. @ SKKU

136

!29

• Trusted shared directory – To share trusted data – GetAppSharedPath()

• to get the trusted shared directory of the target application • If other applications try to access this path, the E_ILLEGAL_ACCESS error

Trusted Communication