How to PTU over HMI with Android SDL - CustomSDL/sdl_android_launcher GitHub Wiki

Run SDL Core

First of all we need to change endpoint in sdl_preloaded_pt file. To do this in file sdl_android_launcher/app/src/main/cpp/src/appMain/sdl_preloaded_pt.json in endpoints section put appropriate local IP-address (not 'localhost') instead of predefined x.x.x.x for 0x07 service (e.g. 192.168.1.129).

Then we need to build SDL core for Android under EXTERNAL_PROPRIETARY policy flow. To do this we need following changes:

  • Add argument "-DEXTENDED_POLICY=EXTERNAL_PROPRIETARY" to sdl_android_launcher/app/build.gradle file:

gradle_external_flow

  • Modify line 62 in sdl_android_launcher/app/src/main/cpp/CmakeLists.txt: change from PROPRIETARY to EXTERNAL_PROPRIETARY:

cmake_external_flow

After this sync project with gradle files. After successful synchronization in file app/src/main/cpp/src/appMain/build_config.txt line "EXTENDED_POLICY:STRING=PROPRIETARY" will be replaced with line "EXTENDED_POLICY:STRING=EXTERNAL_PROPRIETARY".

And then build and run SDL on Android Emulator as usual.

Run HMI in insecure mode:

Note: Emulator should already be started at this point

First of all, locate ADB tool which is by default in your SDK folder:

Android/Sdk/platform-tools

Run the following commands from terminal:

./adb root (to allow adb push and adb pull commands, which are needed to transfer policy data from host machine to emulator)

./adb forward tcp:8087 tcp:8087

This will redirect TCP port 8087 from your host machine to 8087 port of your emulated device.

Then go to sdl_hmi folder and run the next command from this folder:

chromium --disable-web-security --user-data-dir=/tmp index.html

On a start page switch on External Policies check-box and press OK button

Run deploy server

From the sdl_hmi folder open a terminal and run following:

export PATH="<Directory with Andoid platform tools>/:$PATH"

In my case:

export PATH="/home/<user_name>/Android/Sdk/platform-tools/:$PATH"

And then run deploy server with "android" argument:

./deploy_server.sh android

Run Policy Server

In short how to build and run SDL Policy Server:

Setup packages:

  • sudo apt-get install npm

Setup Policy server:

  • Clone https://github.com/smartdevicelink/sdl_server repository
  • Switch to 1.0.0 tag version
  • Build server by command npm install
  • Update content of ./data/policies/default.json file accordingly since it will be used as PTU. Note, that you cannot change name of this file, it is hard-coded. The content of this file should be wrapped like below:

{ "data": [

{ "policy_table": { (put here content for valid update) }}

]}

For example, you can download this file, which is compatible with sdl_server, and put it to ./data/policies/ instead of initial default.json file.

Also don't forget to change endpoint in this file: in endpoints section put appropriate local IP-address (not 'localhost') instead of predefined x.x.x.x for 0x07 service (e.g. 192.168.1.129) (as in sdl_preloaded_pt before).

  • In config/index.js in line 63 define appropriate local IP-address (e.g. replace undefined with '192.168.1.129')
  • Run SDL Policy Server by command npm start.

There will be message in console: [INFO]: Listening on http://localhost:3000

Policy manager

As precondition you may need to install tornado package:

pip3 install tornado

Run policy manager script (sdl_android_launcher/app/src/main/cpp/src/appMain/sample_policy_manager.py) with --android argument:

python3 sample_policy_manager.py --pack_port 8088 --unpack_port 8089 --add_http_header --encryption --android

After run of this script you may face with connection issue (HMI doesn't see SDL, but SDL is running). To fix that you need to stop/start SDL again, and after this your environment will be ready to perform PTU.

Update policy tables

On HMI open menu "System Request" and set on check-box "PTU using in-vehicle modem":

In settings->Policies click on "UpdateSDL":

If everything is OK HMI console should have following messages:

ptu_success

⚠️ **GitHub.com Fallback** ⚠️