Initial commit

:Release Notes:
Create project skeleton

:Detailed Notes:
Add README.md
Add skeleton files

:Testing Performed:

:QA Notes:

:Issues Address:

Open-webOS-DCO-1.0-Signed-off-by: Maksym Sditanov <maxim.sditanov@lge.com>

Change-Id: Icbede501dafdf206f0c074458c1c5306abf857f1
Bootd initial implementation

:Release Notes:
Implement auto-launch of apps at boot time

:Detailed Notes:
Implemented reading applist.json for fisrt use, normal boot and preload apps cases
Implemented boot_params getting from the SAM
Implemented firstUseDone API
Implemented showCaseReady API
Implemented getBootStatus API
Implemented upstart notifications by new signals (minimal-boot-done and boot-done)
Implemented proper sequence of the signals during booting

:Testing Performed:
Tested on desktop build

:QA Notes:

:Issues Addressed:

[GF-35846] Create bootd service

Change-Id: Ib77a4e36c16b9d68f30aab96f011b9fcfa52ae5c
Reviewed-on: https://gpro.palm.com/10792
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Tested-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Add *.kdev4 and build-build.stamp to gitignore

:Release Notes:
Add *.kdev4 and build-build.stamp to gitignore

:Detailed Notes:

:Testing Performed:
Localy build

:QA Notes:

:Issues Address:

Open-webOS-DCO-1.0-Signed-off-by: Maksym Sditanov <maxim.sditanov@lge.com>

Change-Id: I2689ffe8ed4e9388db14436b3866e9ba3c6348c2
Reviewed-on: https://gpro.palm.com/11245
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Alan Levi <alan.levi@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Fixes and improvements

:Release Notes:
Fixes for internal logic

:Detailed Notes:
Add first use support
Add firstUse flag into firstUseDone API
Delay before exit after latest signal

:Testing Performed:
Normal boot case Notifications
luna-send -i -f luna://com.webos.bootManager/getBootStatus '{"subscribe":true }'
{
    "bootStatus": "initialBooting",
    "bootMode": "normalBoot",
    "subscribed": true,
    "returnValue": true
}
{
    "bootStatus": "minimalBootDone",
    "bootMode": "normalBoot"
}
{
    "bootStatus": "bootComplete",
    "bootMode": "normalBoot"
}
{
    "serviceName": "com.webos.bootManager",
    "returnValue": false,
    "errorCode": -1,
    "errorText": "com.webos.bootManager is not running."
}

:QA Notes:

:Issues Addressed:

[GF-35846] Create bootd service

Change-Id: I6d62d1156a863231063a97a3c4fc44b0ca67e719
Reviewed-on: https://gpro.palm.com/11218
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Fix checking of empty list

:Release Notes:

:Detailed Notes:
Repalce if (list.size()) with if (!list.empty())

:Testing Performed:
Tested and build on TV

:QA Notes:

:Issues Addressed:

Change-Id: I25ab705276b66718a9400f0b6dd18d6fa4007cba
Reviewed-on: https://gpro.palm.com/11309
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Reviewed-by: Alan Levi <alan.levi@lge.com>
Refactoring of CMakeLists.txt

:Release Notes:
Remove *.cpp/*.h file mask for compilation

:Detailed Notes:
Remove *.cpp/*.h file mask for compilation files
move src/*.h to include/ directory

:Testing Performed:
Locally build and tested

:QA Notes:

:Issues Address:

Change-Id: I0e268dc2ca91fb64b32185fa25f77879bc1fb563
Reviewed-on: https://gpro.palm.com/11306
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
CMakeLists.txt install all files/launch/

:Release Notes:
Add to CMakeLists.txt webos_build_daemon directive

:Detailed Notes:
Add webos_build_daemon (NAME bootd LAUNCH files/launch/) directive

:Testing Performed:
Locally build and tested, installed on TV

:QA Notes:

:Issues Address:

Change-Id: I3bfa39d94a0cab50541850b477357695748d071e
Reviewed-on: https://gpro.palm.com/11305
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Add notification of bootd when showcase ready

:Release Notes:
Add notification of bootd when showcase ready

:Detailed Notes:
When showcase ready, showcase emit upstart signal "showcase-ready".
This upstart task catch signal "showcase-ready" and send notify bootd
via luna-send about starting of showcase

:Testing Performed:
Locally tested

:QA Notes:

:Issues Address:
[GF-37811] Notify bootd about showcase ready (upstart)

Change-Id: I83b99a338bf899bbaf9806ccdcd1c5597b8e2dbc
Reviewed-on: https://gpro.palm.com/11253
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Maksym Sditanov <maxim.sditanov@lge.com>
Improvements for dataflow

:Release Notes:
Proper creation of the file /var/luna/preferences/ran-firstuse after first use
Fixes for upstart script

:Detailed Notes:
Fix incorrect reading of the configuration file

:Testing Performed:
Tested on TV custom build
with first-use mode
fix for upstart scripts
and normal-boot mode
>>console 1
luna-send -i -f luna://com.webos.bootManager/getBootStatus '{"subscribe":true }'
{
    "bootStatus": "minimalBootDone",
    "bootMode": "firstUseBoot",
    "subscribed": true,
    "returnValue": true
}
{
    "bootStatus": "firstUsetDone",
    "bootMode": "normalBoot"
}
{
    "bootStatus": "bootComplete",
    "bootMode": "normalBoot"
}
{
    "serviceName": "com.webos.bootManager",
    "returnValue": false,
    "errorCode": -1,
    "errorText": "com.webos.bootManager is not running."
}
>>console 2
luna-send -n 1 -f luna://com.webos.applicationManager/closeByAppId '{"id" : "com.palm.app.firstuse"}'
luna-send -n 1 -f luna://com.webos.bootManager/firstUseDone '{ }'
ps -aux | grep chromium
>> /bin/sh /opt/lge/chromium/run_webbrowser {"BGMode":"1"}

:QA Notes:

:Issues Addressed:

[GF-38040] BootD has to support FirstUse

Change-Id: Ib45f8f3d0dea46afd31cc2fe59a943c94cf44dd3
Reviewed-on: https://gpro.palm.com/11406
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Tested-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Tested-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Implement WAM waiting for the bootd

:Release Notes:
Implement WAM waiting for the bootd in first use case

:Detailed Notes:
Add subscription for the WAM service and waiting in first-use case

:Testing Performed:
Verified on TV in FirstUse case and NormalBoot by NFS

:QA Notes:

:Issues Address:
[GF-38979] Bootd is not able to launch FirstUse

Change-Id: I8fca33808a5c78b9c62ad314a84a33d5e23e1c8c
Reviewed-on: https://gpro.palm.com/11740
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Tested-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Maksym Sditanov <maxim.sditanov@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Delay starting bootd until SAM is running

:Release Notes:
Delay starting bootd until SAM is running

:Detailed Notes:
bootd will use ls2 to contact SAM.  If this causes SAM to start before its dependencies are done, then it is a problem.

:Testing Performed:
Verified on TV in first use case and normal boot by NFS

:QA Notes:

:Issues Address:
[GF-38979] Bootd is not able to launch FirstUse
Open-webOS-DCO-1.0-Signed-off-by: Alan Levi <alan.levi@lge.com>

Change-Id: I72f9486888ece53f1bc09bff98d43bc9156b68a7
Fix minimal-boot-done signal emission

:Release Notes:
Fix minimal-boot-done signal emission.

:Detailed Notes:
Fix minimal-boot-done signal emission. This signal will be emitted only
after ShowCase is ready or in 10 seconds after bootd attempted to
launch ShowCase.

:Testing Performed:
Tested on TV.

:QA Notes:

:Issues Addressed:
[GF-39948] Bootd should generate 'minimal-boot-done' when showcase is ready

Change-Id: I288faca2e7353485e31f5fc5371475a3ada5a4c1
Reviewed-on: https://gpro.palm.com/12301
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Reviewed-by: Alan Levi <alan.levi@lge.com>
Tested-by: Alan Levi <alan.levi@lge.com>
Add "emits" stanza for the events from bootd

:Release Notes:
Add "emits" stanza for the events emitted from the bootd

:Detailed Notes:
bootd emits minimal-boot-done and boot-done Upstart events and "emits"
stanza can help us to figure out who emits those events.

:Testing Performed:
bootd is executed successfully with this change.

:QA Notes:

:Issues Addressed:
[GF-39588] Add emits stanza to the Upstart script for bootd

Change-Id: Id340119688e8e51d6b32dff83ff94bf7a153485f
Reviewed-on: https://gpro.palm.com/12002
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Tested-by: Oleg Yablokov <oleg.yablokov@lge.com>
boot_params filed in appinfo.json file should be descriptive

:Release Notes:
changed boot_params to bootLaunchParams

:Detailed Notes:
changed boot_params filed in appinfo.json to bootLaunchParams

:Testing Performed:
related to https://gpro.palm.com/#/c/12446/1

:QA Notes:

:Issues Addressed:
[GF-40530] boot_params filed in appinfo.json file should be consistent

Open-webOS-DCO-1.0-Signed-off-by: manjunatha.s <manjunatha.s@lge.com>

Change-Id: Ia7bdcfd6171c5795b7a8bbae54077605dc483986
Reviewed-on: https://gpro.palm.com/12550
Reviewed-by: Manjunatha S <manjunatha.s@lge.com>
Reviewed-by: seokjun lee <sseokjun.lee@lge.com>
Reviewed-by: Alan Levi <alan.levi@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Tested-by: Oleg Yablokov <oleg.yablokov@lge.com>
Allow only ShowCase and FirstUse apps to communicate with bootd

:Release Notes:
Allow only ShowCase and FirstUse apps to communicate with bootd.

:Detailed Notes:
Change LS2 permissions for public and private bus to allow only
ShowCase and FirstUse apps to communicate with bootd.

:Testing Performed:
luna-send -n 1 luna://com.webos.bootManager/firstUseDone '{}'
Check /var/log/legacy-log for errors or warnings.

:QA Notes:

:Issues Addressed:
[GF-37999] Fix permissions for bootd

Change-Id: Ib9584cf992ceba96bceca937cca5503ea7070414
Reviewed-on: https://gpro.palm.com/12943
Tested-by: Oleg Yablokov <oleg.yablokov@lge.com>
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Provide  information to the launched app that they are boot launched

:Release Notes:
Provide  information to the launched app that they are boot launched

:Detailed Notes:
Add parameter into launch parameters like
{"launchHidden": true, ...}

:Testing Performed:
Tested on TV. And manual debugging.

:QA Notes:
:Issues Addressed:
[GF-40046] sam/bootd does not provide any information to the launched app that they are boot launched

Change-Id: Ifb810fb4f95b407f49607eaee192b525fb9fdc86
Reviewed-on: https://gpro.palm.com/12787
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Tested-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Bootd must launch input app

:Release Notes:
Bootd must launch input app

:Detailed Notes:
Add lastInputApp request into bootd
Add template of the inputapp into applist.json now it is {LAST_INPUT_APP}

:Testing Performed:
Tested on TV with NFS
build number 373
tested normal boot with proper launching of the hdmi and livetv
tested first-use boot and first-use app is launched
tested after first-use done I can see proper input app is launched
luna-send -n 1 -f luna://com.webos.applicationManager/running {}
{
    "running": [
        {
            "id": "com.webos.app.hdmi2",
            "processid": "1000"
        }
    ],
    "returnValue": true
}
after first-use
luna-send -n 1 -f luna://com.webos.applicationManager/running {}
{
    "running": [
        {
            "id": "com.webos.app.livetv",
            "processid": "1000"
        }
    ],
    "returnValue": true
}

:QA Notes:
:Issues Addressed:
[GF-44012] launch last input app instead of showcase during boot (unoptimized)

Change-Id: I9171cf06bde8019aedc950eea97c53cca202f217
Reviewed-on: https://gpro.palm.com/13839
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Tested-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Add factoryMode bootmode

:Release Notes:
Add new factoryMode bootMode
Skip FirstUse when booted in factoryMode

:Detailed Notes:
-Check if TV is booted in Factory Mode with TV Service API.
If it is, bootd skips First use step.
-Add LSCallCancel for unsubscribing to TV service and WAM.
-Add debug logs.

:Testing Performed:
Confirmed that FirstApp is not launched in factoryMode.

:QA Notes:
When you flash your TV and boot it first time your TV is in FactoryMode.
Here is luna command that you can use to check your TV is in FactoryMode.

luna-send -n 1 -f luna://com.webos.service.tv.systemproperty/getProperties
'{ "keys" : ["instopCompleted"] }'
{
    "returnValue": true,
    "instopCompleted": "false"
}

So, if this patch takes into effect, your TV shouldn't display FirstUse
when booted first time. The consecutive power on and off still leave
your TV in FactoryMode.
There is a way that you can change your TV into NormalMode by pressing
IN-STOP of Factory SVC Remocon. TV will power off soon with pop up
dialog. After you turn on TV, your TV should display FirstUse App.

:Issues Addressed:
[GF-45071] BootD should check with Factory Mode Check API if current
           boot mode is Factory mode and skip First use step

Change-Id: I41dcee6d24887395520907d075db661f86df86d0
Reviewed-on: https://gpro.palm.com/15617
Reviewed-by: DongHeon Jang <dongheon.jang@lge.com>
Tested-by: DongHeon Jang <dongheon.jang@lge.com>
Reviewed-by: Olexandr Solomakha <oleksander.solomakha@lge.com>
Reviewed-by: Oleg Yablokov <oleg.yablokov@lge.com>
Modify 'minimal-boot-done' signal generation time

:Release Notes:
Modify 'minimal-boot-done' signal generation time

:Detailed Notes:
Bootd generates 'minimal-boot-done' right after launch now.
However, we need to delay the time in order to give
more system resource to last-input-app.
This commit changes 'minimal-boot-done' to first-app ready.

:Testing Performed:
Local #382 + this commit

:QA Notes:
This commit depends on ..
 - https://g2g.palm.com/#/c/3795/
 - https://g2g.palm.com/#/c/3796/

:Issues Addressed:
[GF-44168] [Boottime] Optimize boot sequence

Change-Id: I7232f222285ffbe25363dc5c5f3f82995865cb6c
Merge commit 'refs/changes/63/15563/10' of ssh://gpro.palm.com:29418/webos-pro/bootd