Launch SDL HMIs via xwalk-launcher. 05/27705/2 accepted/tizen/ivi/20140919.141712 submit/tizen_ivi/20140918.175344
authorOssama Othman <ossama.othman@intel.com>
Tue, 16 Sep 2014 20:56:56 +0000 (13:56 -0700)
committerOssama Othman <ossama.othman@intel.com>
Wed, 17 Sep 2014 22:40:27 +0000 (15:40 -0700)
Since there is currently no browser in Tizen IVI, package the
SDL sample HMI as a Crosswalk widget, and have the SDL core
launch the HMI via xwalk-launcher.

Bug-Tizen: TC-1579

Change-Id: I801fae70380b2dd3df114d12d12ec59c094c23bd
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
SDL_Core/CMakeLists.txt
SDL_Core/src/appMain/appMain.cpp
packaging/config.xml [new file with mode: 0644]
packaging/manifest.json [new file with mode: 0644]
packaging/smartdevicelink.spec

index 6c45010..f10d634 100644 (file)
@@ -17,8 +17,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "-s") #It will be appended to CMAKE_CXX_FLAGS in rel
 
 add_definitions(-DSDL_LOG4CXX_PROPERTIES_FILE="/etc/smartdevicelink/log4cxx.properties")
 add_definitions(-DSDL_HMI_LINK_FILE="/etc/smartdevicelink/hmi_link")
-add_definitions(-DSDL_HMI_BROWSER_PATH="/usr/bin/xwalk" -DSDL_HMI_BROWSER_ARG0="xwalk" -DSDL_HMI_BROWSER_ARG1="")
-add_definitions(-DSDL_AUDIO_SAMPLE="/usr/share/smartdevicelink/audio.8bit.wav")
+add_definitions(-DSDL_HMI_BROWSER_PATH="/usr/bin/xwalk-launcher" -DSDL_HMI_BROWSER_ARG0="xwalk-launcher")
 
 option( BUILD_SHARED_LIBS "Build all libraries as shared (if ON) or static (if OFF)" OFF)
 
index e20aa5f..2655b10 100644 (file)
@@ -78,7 +78,10 @@ namespace {
 
 const char kBrowser[] = SDL_HMI_BROWSER_PATH;
 const char kBrowserName[] = SDL_HMI_BROWSER_ARG0;
+
+#ifdef SDL_HMI_BROWSER_ARG1
 const char kBrowserParams[] = SDL_HMI_BROWSER_ARG1;
+#endif
 
 /**
  * Initialize HTML based HMI.
@@ -124,7 +127,12 @@ file_str.close();
 
 if (stat(hmi_link.c_str(), &sb) == -1) {
   LOG4CXX_INFO(logger, "HMI index.html doesn't exist!");
-  return false;
+  // The hmi_link file in Tizen contains the Crosswalk application ID,
+  // not a top-level HMI web page such as index.html, since we're
+  // launching the HMI through xwalk-launcher.  Ignore the fact that
+  // such a file doesn't exist.
+  //
+  // return false;
 }
 // Create a child process.
 pid_hmi = fork();
@@ -140,6 +148,7 @@ switch (pid_hmi) {
       LOG4CXX_WARN(logger, "Open dev0 failed!");
       return false;
     }
+
     // close input/output file descriptors.
     close(STDIN_FILENO);
     close(STDOUT_FILENO);
@@ -151,7 +160,11 @@ switch (pid_hmi) {
     dup2(fd_dev0, STDERR_FILENO);
 
     // Execute the program.
-    execlp(kBrowser, kBrowserName, kBrowserParams, hmi_link.c_str(),
+    execlp(kBrowser, kBrowserName,
+#ifdef SDL_HMI_BROWSER_ARG1
+           kBrowserParams,
+#endif
+           hmi_link.c_str(),
            reinterpret_cast<char*>(0));
     LOG4CXX_WARN(logger, "execl() failed! Install chromium-browser!");
 
diff --git a/packaging/config.xml b/packaging/config.xml
new file mode 100644 (file)
index 0000000..bf45b6a
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
+       id="http://com.intel.tizen/smartdevicelink" version="1.0.0" viewmodes="maximized">
+       <access origin="*" subdomains="true"></access>
+       <tizen:application id="SDL0000001.SmartDeviceLink"
+               package="SDL0000001" required_version="2.0" />
+       <content src="index.html" />
+       <icon src="images/sdl/devices.png" />
+       <name>SmartDeviceLink</name>
+       <tizen:privilege name="http://tizen.org/privilege/application.launch" />
+       <tizen:privilege name="http://tizen.org/privilege/filesystem.read" />
+       <tizen:privilege name="http://tizen.org/privilege/filesystem.write" />
+       <tizen:privilege name="http://tizen.org/privilege/fullscreen" />
+       <tizen:privilege name="http://tizen.org/privilege/content.read" />
+        <tizen:privilege name="http://tizen.org/privilege/bluetooth.admin" />
+        <tizen:privilege name="http://tizen.org/privilege/bluetooth.spp" />
+        <tizen:privilege name="http://tizen.org/privilege/bluetooth.gap" />
+        <tizen:privilege name="http://tizen.org/privilege/speech" />
+       <tizen:privilege name="http://tizen.org/privilege/vehicle" />
+       <tizen:setting screen-orientation="portrait"
+               context-menu="enable" background-support="disable" encryption="disable"
+               install-location="auto" hwkey-event="enable" />
+</widget>
diff --git a/packaging/manifest.json b/packaging/manifest.json
new file mode 100644 (file)
index 0000000..cefc5bc
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "name": "SmartDeviceLink HMI",
+  "xwalk_version": "0.0.2",
+  "app": {
+    "launch":{
+      "local_path": "index.html"
+    }
+  },
+  "icons": {
+    "128": "images/sdl/devices.png"
+  }
+}
index 6abb140..7e54acf 100644 (file)
@@ -1,13 +1,15 @@
 Name:          smartdevicelink
-Summary:       GENIVI SmartDeviceLink (SDL)
+Summary:       GENIVI mobile device and HMI integration
 Version:       2.0
 Release:       1
-Group:         Network & Connectivity/Connection Management
+Group:         Automotive/GENIVI
 License:       BSD-3-Clause
 URL:           http://projects.genivi.org/smartdevicelink/
 Source:        %{name}-%{version}.tar.gz
 Source1:       %{name}.xml
 Source1001:    %{name}.manifest
+Source2001:    config.xml
+Source2002:    manifest.json
 BuildRequires: cmake
 BuildRequires: pkgconfig(bluez)
 BuildRequires: pkgconfig(gstreamer-1.0)
@@ -15,9 +17,10 @@ BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(liblog4cxx)
 BuildRequires: pkgconfig(avahi-client)
 BuildRequires: pkgconfig(libpulse-simple)
+BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: doxygen
-BuildRequires: fdupes
-Requires:      avahi-libs
+BuildRequires: zip
+Requires:      crosswalk
 Requires(post): /usr/bin/pkg_initdb
 
 # Custom SDL-enabled HMIs should "Provide" this virtual package.
@@ -41,13 +44,11 @@ automotive head units leverage the complete power of the brought-in
 device using the APIs being executed on the mobile device.
 
 %package sample-hmi
-Group:         Graphics & UI Framework/Automotive UI
-Summary:       Sample SmartDeviceLink capable HMI
+Summary:       Sample HMI
 Provides:      smartdevicelink-hmi
 
 %description sample-hmi
-This package contains a an SmartDeviceLink template-based
-sample/reference HMI.
+This package contains a sample/reference HMI.
 
 %prep
 %setup -q -n %{name}-%{version}
@@ -87,19 +88,30 @@ install -m 0755 SDL_Core/src/thirdPartyLibs/MessageBroker/libMessageBroker.so %{
 install -m 0755 SDL_Core/src/thirdPartyLibs/jsoncpp/libjsoncpp.so %{buildroot}%{_libdir}
 
 # Sample HMI
-mkdir -p %{buildroot}%{_datadir}/%{name}
-install -m 0644 SDL_Core/src/appMain/audio.8bit.wav %{buildroot}%{_datadir}/%{name}
-cp -R SDL_Core/src/components/HMI %{buildroot}%{_datadir}/%{name}
-%fdupes -s %{buildroot}%{_datadir}/%{name}
+# The SDL HMI will be launched with xwalk-launcher so package it as a
+# Crosswalk widget.
+mkdir -p %{buildroot}%{TZ_SYS_APP_PREINSTALL}
+cd %{dirname:%SOURCE2001} \
+  && zip %{buildroot}%{TZ_SYS_APP_PREINSTALL}/%{name}.wgt config.xml manifest.json \
+  && cd -
+cd SDL_Core/src/components/HMI \
+  && zip -r %{buildroot}%{TZ_SYS_APP_PREINSTALL}/%{name}.wgt . \
+  && cd -
 
 # Create the 'hmi_link' file with the location of the sample HMI.
-echo %{_datadir}/%{name}/HMI/index.html > %{buildroot}%{_sysconfdir}/%{name}/hmi_link
+# Normally this would be the path to the top-level index.html file for
+# the SDL HMI, e.g.  %%{_datadir}/%%{name}/HMI/index.html.  However,
+# since we are using xwalk-laucher to launch the HMI we must instead
+# provide the SDL Crosswalk application ID, i.s. SmartDeviceLink,
+# instead.
+echo SDL0000001.SmartDeviceLink > %{buildroot}%{_sysconfdir}/%{name}/hmi_link
 
 # Install Tizen package metadata for smartdevicelink
 mkdir -p %{buildroot}%{_datadir}/packages/
 mkdir -p %{buildroot}%{_datadir}/icons/default/small
 install -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/packages/%{name}.xml
-ln -sf %{_datadir}/%{name}/HMI/images/sdl/devices.png %{buildroot}%{_datadir}/icons/default/small/
+install -m 0644 SDL_Core/src/components/HMI/images/sdl/devices.png \
+                %{buildroot}%{_datadir}/icons/default/small/
 
 %clean
 
@@ -107,19 +119,23 @@ ln -sf %{_datadir}/%{name}/HMI/images/sdl/devices.png %{buildroot}%{_datadir}/ic
 
 %post sample-hmi
 /usr/bin/pkg_initdb
+su app -c "xwalkctl -i %{TZ_SYS_APP_PREINSTALL}/%{name}.wgt"
 
 %postun -p /sbin/ldconfig
 
+%postun sample-hmi
+/usr/bin/pkg_initdb
+su app -c "xwalkctl -u $(su app -c "xwalkctl list | grep SmartDeviceLink | cut -c 1-32")"
+
 %files
 %manifest %{name}.manifest
 %license LICENSE
 %{_bindir}/smartDeviceLinkCore
 %{_libdir}/*.so*
 %config %{_sysconfdir}/%{name}/log4cxx.properties
-%{_datadir}/%{name}/audio.8bit.wav
 
 %files sample-hmi
 %config %{_sysconfdir}/%{name}/hmi_link
-%{_datadir}/%{name}/HMI/*
 %{_datadir}/packages/%{name}.xml
 %{_datadir}/icons/default/small/*.png
+%{TZ_SYS_APP_PREINSTALL}/%{name}.wgt