platform/core/api/webapi-plugins.git
3 years ago[ML] Added placeholders for further development 76/251876/3
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 20 Jan 2021 07:39:32 +0000 (08:39 +0100)]
[ML] Added placeholders for further development

[Verification] Code compiles without errors

Change-Id: I2b69891c596e31ae87fb519b60aa3811e949c5d5

3 years ago[Datacontrol] Prevent crashes by purging code with undefined behavior 34/251834/3
Pawel Wasowski [Tue, 19 Jan 2021 01:36:44 +0000 (02:36 +0100)]
[Datacontrol] Prevent crashes by purging code with undefined behavior

The following line caused crashes:

IdMap[info->requestId] = info.release();

Argument evaluation order was not strictly defined in C++
before C++17 - behavior of the expression above was undefined.
C++17 introduced more strict rules and their implementation in GCC
caused a crash after setting -std=c++17 - it seems, that info.release()
would be now called before info->requestId.

[Verification] tct-datacontrol-tizen-tests (auto, c++14 and c++17 build):
100% pass rate

The snippet below crashed apps 100% times when webapi-plugins were
compiled with C++17. Now, the snippet works fine

var PROVIDER_ID =
        "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider";
var DATA_ID = "Dictionary";
var TYPE_SQL = "SQL";
var TYPE_MAP = "MAP";

var globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID,
                                                                 DATA_ID,
                                                                 TYPE_MAP);
function successcb(id) {
  console.log("Ok: reqid " + id);
}

function errorcb(id, error) {
  console.log("Error id: " + id + ", error msg: " + error.message);
}

try {
  globalDataControl.addValue(123, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}

Change-Id: Ibd80f60d100a616b8a9607c27e9eebf8a64e7a10

3 years ago[mediacontroller] Prevent undefined behavior 25/251825/3
Pawel Wasowski [Mon, 18 Jan 2021 21:11:55 +0000 (22:11 +0100)]
[mediacontroller] Prevent undefined behavior

Constructing a std::string from nullptr is undefined behavior and
caused an exception after setting std=c++17 flag in GCC
(no exception was thrown when compiling with std=c++14).
This commit removes the UB.

The problem caused MediaControllerServerInfo_iconURI_attribute test
from tct-mediacontroller-tizen-tests failures.

[Verification] auto tct-mediacontroller-tizen-tests
1. with std=c++14: 100% pass rate
2. with std=c++17: 100% pass rate

Change-Id: I4857e3d9f8ba2940b50223e89ff952625ba37b3c
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[common] Add std::exception handler to ParsedInstance 19/251819/3
Pawel Wasowski [Mon, 18 Jan 2021 19:35:14 +0000 (20:35 +0100)]
[common] Add std::exception handler to ParsedInstance

When an exception derived from std::exception and not PlatformException
is thrown in webapi-plugins code, only the following error message was
logged:

HandleException(393) > Exception: Unknown exception

As std::exception inheritance is a very common practice, especially in
standard library, we add logging std::exception::what() message to make
debugging easier.

[Verification] An exception thrown from std::string is caught and its
what() message is logged properly.

Change-Id: I879ebe80b609cf26a7e68be822a783aa9ef145eb
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML][Common] Add TensorsInfo.getTensorSize 99/251699/2
Rafal Walczyna [Mon, 18 Jan 2021 14:19:54 +0000 (15:19 +0100)]
[ML][Common] Add TensorsInfo.getTensorSize

ACR: TWDAPI-273

Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
console.log(ti.getTensorSize(0))
ti.addTensorInfo("tensor2", "UINT8", [2, 3, 4])
console.log(ti.getTensorSize(1))
ti.addTensorInfo("tensor2", "FLOAT32", [2, 3, 4])
console.log(ti.getTensorSize(2))
console.log(ti.getTensorSize(-1))

[Verification] Built successful. Tested in Chrome Dev console.

Change-Id: I841da30d03a0590cea66ec6217130163a87f59ec
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][Common] Add TensorsInfo.dispose method 16/251616/3
Rafal Walczyna [Fri, 15 Jan 2021 11:56:20 +0000 (12:56 +0100)]
[ML][Common] Add TensorsInfo.dispose method

ACR: TWDAPI-273

Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
ti.getTensorName(0)
ti.dispose()
ti.getTensorName(0)

[Verification] Built successful. Tested in Chrome Dev console.

Change-Id: Icae3447ea266de67404f05e23a5d157e5f899ee9
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][Common] Add TensorsInfo.clone and TensorsInfo.equals 24/251524/4
Rafal Walczyna [Thu, 14 Jan 2021 12:13:12 +0000 (13:13 +0100)]
[ML][Common] Add TensorsInfo.clone and TensorsInfo.equals

ACR: TWDAPI-273

Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
var ti2 = ti.clone();
console.log(ti.equals(ti2))
ti2.setTensorName(0, "different")
console.log(ti.equals(ti2))
ti2.setTensorType(0, "INT8")
console.log(ti.equals(ti2))

[Verification] Built successful, tested in Chrome Dev console.

Change-Id: I30d9b1b73ab97735b6ecfaf1a408b6561912808d
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][Common] Add TensorsInfo getters / setters 35/251435/9
Rafal Walczyna [Wed, 13 Jan 2021 12:52:21 +0000 (13:52 +0100)]
[ML][Common] Add TensorsInfo getters / setters

ACR: TWDAPI-273

Methods added:
TensorsInfo.getTensorName
TensorsInfo.setTensorName
TensorsInfo.getTensorType
TensorsInfo.setTensorType
TensorsInfo.getDimensions
TensorsInfo.setDimensions

Test code:

var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
console.log(ti.getTensorName(0));
ti.setTensorName(0, "changedName");
console.log(ti.getTensorName(0));
console.log(ti.getTensorType(0));
ti.setTensorType(0, "INT8");
console.log(ti.getTensorType(0));
console.log(ti.getDimensions(0));
ti.setDimensions(0, [2,4]);
console.log(ti.getDimensions(0));

[Verification] Built successful, tested in Chrome Dev console.

Change-Id: I197072bfbc48812fd44a00cfaceb09ee8928f1a1
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][Common] Add TensorsInfo constructor and TensorsInfo::addTensorInfo 58/251158/10
Rafal Walczyna [Fri, 8 Jan 2021 15:40:47 +0000 (16:40 +0100)]
[ML][Common] Add TensorsInfo constructor and TensorsInfo::addTensorInfo

ACR: TWDAPI-273

Added:
- TensorsInfo constructor
- TensorsInfo::addTensorInfo method
- TensorsInfo::count property

Test code:
var ti = new tizen.ml.TensorsInfo();
console.log(ti.count)
ti.addTensorInfo(null, "UINT8", [1, 1])
console.log(ti.count)
console.log(JSON.stringify(ti))

[Verification] Built successful, tested in Chrome Dev console

Change-Id: Ic194d71439e4c4ce30b9722de031e9312c1c8183
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][Common] Add MLTensorsInfoManager 57/251157/8
Rafal Walczyna [Fri, 8 Jan 2021 15:39:37 +0000 (16:39 +0100)]
[ML][Common] Add MLTensorsInfoManager

ACR: TWDAPI-273

[Verification] Built successful

Change-Id: I85a0fdcbcbc42ddcce406d5c6ae5a428536d4ce7
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][pipeline] Implement Pipeline::getSwitch() 75/251075/11
Pawel Wasowski [Tue, 12 Jan 2021 15:38:43 +0000 (16:38 +0100)]
[ML][pipeline] Implement Pipeline::getSwitch()

ACR: TWDAPI-274

[Verification] Code tested in Chrome DevTools with below snippets works
fine

var pipeline_def = "videotestsrc is-live=true"
                   + " ! videoconvert"
                   + " ! tensor_converter"
                   + " ! output-selector name=outs outs.src_0"
                   + " ! tensor_sink name=sink0 async=false outs.src_1"
                   + " ! tensor_sink name=sink1 async=false"

var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def, function(state) {console.log(state);})

pipeline.getSwitch('outs')
// Switch {name: "outs", type: "OUTPUT_SELECTOR", _pipeline_id: 3}

pipeline.getSwitch('non existent switch')
//  VM31:1 Uncaught WebAPIException {code: 0, name: "InvalidValuesError"

Change-Id: Ia7d6838b5e49072c35f0b796151c436d4a3b60e1
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years agoMerge "[ML][common] Add tizen.ml.checkNNFWAvailability method" into tizen
Piotr Kosko [Tue, 19 Jan 2021 06:16:30 +0000 (06:16 +0000)]
Merge "[ML][common] Add tizen.ml.checkNNFWAvailability method" into tizen

3 years ago[ML][Pipeline] Implement getNodeInfo 06/251306/5
Lukasz Bardeli [Tue, 12 Jan 2021 09:24:45 +0000 (10:24 +0100)]
[ML][Pipeline] Implement getNodeInfo

ACR: TWDAPI-274

[Verification] Code compiles without error. Tested in chrome console

var pipeline = tizen.ml.pipeline.createPipeline("videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink")
var nodeinfo = pipeline.getNodeInfo("demux")

Change-Id: I503f0a2a52b151ac676a64e2ad888f45abc51170
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
3 years ago[ML][Pipeline] Implement Start and Stop method. 02/250902/10
Lukasz Bardeli [Mon, 11 Jan 2021 07:29:29 +0000 (08:29 +0100)]
[ML][Pipeline] Implement Start and Stop method.

ACR: TWDAPI-274

[Verification] Code compiles without error.

var pipeline = tizen.ml.pipeline.createPipeline("videotestsrc! tizenwlsink");

pipeline.start()

// pipeline.state = "PLAYING"

pipeline.stop()

// pipeline.state = "PAUSED"

Change-Id: I529c47fd349741d3e11b0b57e265d3a9a930f652
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
3 years ago[ML][common] Add tizen.ml.checkNNFWAvailability method 88/250788/10
Rafal Walczyna [Wed, 23 Dec 2020 07:54:06 +0000 (08:54 +0100)]
[ML][common] Add tizen.ml.checkNNFWAvailability method

ACR: TWDAPI-273

Test code:

var HWType = ["ANY", "AUTO", "CPU", "CPU_NEON", "CPU_SIMD", "GPU", "NPU",
    "NPU_EDGE_TPU", "NPU_MOVIDIUS", "NPU_SR", "NPU_VIVANTE"];

var NNFWType = ["ANY", "ARM_NN", "CUSTOM_FILTER", "EDGE_TPU", "MVNC", "NNFW", "OPEN_VINO",
    "SNPE", "TENSORFLOW", "TENSORFLOW_LITE", "VIVANTE"];

HWType.forEach(hw => {
    NNFWType.forEach(nnfw => {
        console.log(nnfw + ", " + hw + ": " + tizen.ml.checkNNFWAvailability(nnfw, hw))
    });
});

[Verificaion] Tested in Google Chrome Dev Console

Change-Id: I2ac7752f410a70e98d8c0cd387ac5dfcabdbef88
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[ML][pipeline] Prepare room for a bugfix 97/251697/2
Pawel Wasowski [Mon, 18 Jan 2021 13:01:19 +0000 (14:01 +0100)]
[ML][pipeline] Prepare room for a bugfix

Native handles to all pipeline elements (switches, node infos, etc.)
have to be released BEFORE Pipeline::pipeline_ handle.
Pipeline::Dispose() will release them in proper order and from now on
will be called from ~Pipeline() to not repeat the error prone release
logic.

[Verification] Code tested with below snippets in Chrome DevTools works
fine.

var pipeline = tizen.ml.pipeline.createPipeline('videotestsrc ! tizenwlsink',
                                                function(state) {console.log(state);})
// test screen appears

pipeline.dispose() // no errors, test screen disappear;
// DLOG message about successful disposal

<press F5> // no crash; DLOG message tells that pipeline_ has been destroyed

Change-Id: Ibe8b1260bc7bf057fed375ac579b87fce59d8caf
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML][pipeline] Implement Pipeline::dispose() 70/251070/8
Pawel Wasowski [Tue, 5 Jan 2021 21:47:17 +0000 (22:47 +0100)]
[ML][pipeline] Implement Pipeline::dispose()

ACR: TWDAPI-274

[Verification] Tested in Chrome DevTools with the snippet below, works
fine.

var pipeline = tizen.ml.pipeline.createPipeline('videotestsrc ! tizenwlsink',
                                                function(state) {console.log(state);})
// test screen appears

pipeline.dispose() // no errors, test screen disappears

Change-Id: I5401c3210f73619d5577380abf17139fadc390f1
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML][pipeline] Implement Pipeline::state getter 75/250775/12
Pawel Wasowski [Mon, 4 Jan 2021 09:59:39 +0000 (10:59 +0100)]
[ML][pipeline] Implement Pipeline::state getter

ACR: TWDAPI-274

[Verification] Tested in Chrome DevTools with the snippets below. Works fine

 var pipeline = tizen.ml.pipeline.createPipeline('videotestsrc ! tizenwlsink',
                  function(state) {console.log(state);})

<wait a few seconds>

pipeline.state

Change-Id: Iae5e70c63d5c9fd98877defe0949024516c8c41d
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML][Pipeline] Add Pipeline and PipelineManager 25/250425/19
Pawel Wasowski [Thu, 24 Dec 2020 10:36:26 +0000 (11:36 +0100)]
[ML][Pipeline] Add Pipeline and PipelineManager

ACR: TWDAPI-274

[Verification] createPipeline() tested in Chrome
DevTools with the snippet below works fine

var pipeline = tizen.ml.pipeline.createPipeline(
                 'videoteststrc ! tizenwlsink',
                  function(state) {
                    console.log(state);
                  })
//a moment later:
// READY
// PAUSED

tizen.ml.createPipeline()
// WebAPIException: InvalidValuesError

Change-Id: I68beaebf7e248b61bba9dc06ce6124c187c45fae
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML][pipeline] Add placeholders for implementation 38/251138/4
Pawel Wasowski [Fri, 8 Jan 2021 11:06:03 +0000 (12:06 +0100)]
[ML][pipeline] Add placeholders for implementation

ACR: TWDAPI-274

This commit adds placeholders for implementation of PipelineManager and
Pipeline to avoid merge conflicts of changes done by different
committers.

[Verification] Code compiles

Change-Id: Id4a2b33943e390526929bb5c2dba42cd55d7ad12
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years agoMerge "[Download][TDAF-1353] Exception fix for 'start' function" into tizen
Piotr Kosko [Fri, 8 Jan 2021 10:38:08 +0000 (10:38 +0000)]
Merge "[Download][TDAF-1353] Exception fix for 'start' function" into tizen

3 years ago[Download][TDAF-1353] Exception fix for 'start' function 81/251081/4
Arkadiusz Pietraszek [Thu, 7 Jan 2021 19:32:28 +0000 (20:32 +0100)]
[Download][TDAF-1353] Exception fix for 'start' function

`start` function was returning unknown error exception instead of
unsupported error in case when networkType in DownloadRequest wasn't
supported by the device.

Additionally fix enables null values to be used (in accordance with the documentation).

[Verification] Code builds without errors. TCT suites deprecated, download and systeminfo pass rate: 100%.
Tested in developer console on devices with telephony set to true and false.
Below code was used with all network types, as well as invalid values.
```
var downloadRequest = new tizen.DownloadRequest(
                    "http://download.tizen.org/tct/2_1/webapi-tizen-download-test-image-lq.png",
                    null, null, "CELLULAR", null);

tizen.download.start(downloadRequest);
```

Change-Id: I4f2866a07019f129c852024970783b110ef11abc
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
3 years ago[Common] Moved helper functions to decode/encode strings/binary to common 15/250915/2
Rafal Walczyna [Tue, 5 Jan 2021 13:27:05 +0000 (14:27 +0100)]
[Common] Moved helper functions to decode/encode strings/binary to common

[Verification] Built successfully. Metadata and filesystem auto tct 100%.

Change-Id: I751e5cad95f8c7dc907214225f8f27cabbb3e5e7
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years agoMerge "[ML][utils] Add native error to PlatformResult converter" into tizen
Piotr Kosko [Tue, 5 Jan 2021 10:56:42 +0000 (10:56 +0000)]
Merge "[ML][utils] Add native error to PlatformResult converter" into tizen

3 years agoMerge "[ML][pipeline] Add files structure" into tizen
Piotr Kosko [Tue, 5 Jan 2021 10:56:32 +0000 (10:56 +0000)]
Merge "[ML][pipeline] Add files structure" into tizen

3 years agoMerge "[ML] Add files structure" into tizen
Piotr Kosko [Tue, 5 Jan 2021 10:56:07 +0000 (10:56 +0000)]
Merge "[ML] Add files structure" into tizen

3 years agoMerge branch 'tizen_6.0' into tizen 86/250786/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Mon, 4 Jan 2021 12:38:53 +0000 (13:38 +0100)]
Merge branch 'tizen_6.0' into tizen

Change-Id: I8134cac10af7ba5439eecba63db59fb6ea97496f

3 years agoMerge commit 'tizen_5.5' into tizen_6.0 85/250785/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Mon, 4 Jan 2021 12:37:04 +0000 (13:37 +0100)]
Merge commit 'tizen_5.5' into tizen_6.0

Change-Id: I7d175b5f87cdcbc8a2d701dc5228a6f4b98a92a8

3 years agoMerge branch 'tizen_5.0' into tizen_5.5 84/250784/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Mon, 4 Jan 2021 12:25:26 +0000 (13:25 +0100)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: I4663c3fd5eb5bf03bb1f421ffe39cd761c1b30ca

3 years agoMerge branch 'tizen_4.0' into tizen_5.0 83/250783/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Mon, 4 Jan 2021 12:08:04 +0000 (13:08 +0100)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: Ia3f1067915717be06164910e4efa5660cdb4f6aa

3 years agoMerge branch 'tizen_3.0' into tizen_4.0 81/250781/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Mon, 4 Jan 2021 12:06:20 +0000 (13:06 +0100)]
Merge branch 'tizen_3.0' into tizen_4.0

Change-Id: If6af4a7e369bb22bdd3b8817095680e6db7a0abe

3 years ago[ML][utils] Add native error to PlatformResult converter 75/250575/5
Pawel Wasowski [Tue, 29 Dec 2020 15:56:01 +0000 (16:56 +0100)]
[ML][utils] Add native error to PlatformResult converter

[Verification] The code builds fine

Change-Id: I88234f6474850f554dc617bb0ccc5343b6ed7e93
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[version] 2.46 79/250779/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Mon, 4 Jan 2021 11:47:12 +0000 (12:47 +0100)]
[version] 2.46

Change-Id: I1d625296e33677999739d473d445b2c09d1ec4e7

3 years ago[Bluetooth] Prevent "Wrong listener identifier" errors for BLE scan 78/250778/2
Pawel Wasowski [Tue, 1 Dec 2020 09:30:10 +0000 (11:30 +0200)]
[Bluetooth] Prevent "Wrong listener identifier" errors for BLE scan

The following app code caused aforementioned errors:

var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan();
setTimeout(function() {
        adapter.stopScan();
}, 10000);

Now, the error is not thrown.

[Validation] tct-bluetooth-tizen-tests: auto: 100% pass rate,
             manual Bluetooth04_BLE_wearable suite: 100% pass rate
             The code above runs in ChromeDevTools without errors

Change-Id: Id9ec278b4bb1c5ce38d0b3ffb1324498152ab645
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML][pipeline] Add files structure 24/250424/4
Pawel Wasowski [Tue, 22 Dec 2020 11:04:09 +0000 (12:04 +0100)]
[ML][pipeline] Add files structure

ACR: TWDAPI-274

Change-Id: I1941dba3cc1cfab2e0be514608e7b936da12b20e
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
3 years ago[ML] Add files structure 69/250169/7
Rafal Walczyna [Mon, 21 Dec 2020 12:43:54 +0000 (13:43 +0100)]
[ML] Add files structure

[Verification] Build successful, tizen.ml.single and tizen.ml.pipeline
are visible in WebApplication

Change-Id: Iddd81dbff6531db9395495ecbbd94f0a9b81f95c
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[Common] Moved ArrayToString function to utils 65/250765/1
Rafal Walczyna [Mon, 4 Jan 2021 09:44:44 +0000 (10:44 +0100)]
[Common] Moved ArrayToString function to utils

[Verification] TCT-auto filesystem 100% passrate.

Change-Id: I323c80ef353ceef5723b423bed4a0ee4f9844656
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
3 years ago[Common] Moved StringToArray function to utils and applied auto-format 06/248506/2 accepted/tizen/unified/20201210.124550 submit/tizen/20201209.085808
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 27 Nov 2020 07:28:17 +0000 (08:28 +0100)]
[Common] Moved StringToArray function to utils and applied auto-format

[Verification] TCT filesystem 100% passrate.
Checked metadata features in chrome console.

Change-Id: I807d8514bfda1afccd136fe74b37f80ff45190ca

3 years ago[Metadata] Fixes for implementation 41/248441/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 26 Nov 2020 12:19:24 +0000 (13:19 +0100)]
[Metadata] Fixes for implementation

[Verification] Code works as expected by documentation, fixed crash
when calling api without arguments. Verified in chrome console

Change-Id: I80a021d1804d2b0ac55279df1d3d4cc699bc0a8b

3 years ago[Metadata] Add getSyncLyrics to MetadataHandle 23/248423/3
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 26 Nov 2020 08:55:11 +0000 (09:55 +0100)]
[Metadata] Add getSyncLyrics to MetadataHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification] Code compiles withotu errors.
Works well for mp3 file with SYLT data.

// Prectondition - file preparation (with python code)
// important - SYLT need to be UTF-8 or ISO-8859 encoded to be supported on Tizen device
from mutagen.id3 import ID3, SYLT, Encoding

tag = ID3("sample.mp3")
sync_lrc = [("TEST lyrics 1", 100),
            ("another TEST lyrics - 2", 2000),
            ("yet another TEST lyrics", 4000)]  # [(lrc, millisecond), ]
tag.setall("SYLT", [SYLT(encoding=Encoding.UTF8, lang='eng', format=2, type=1, text=sync_lrc)])
tag.save()

tag.getall("SYLT")

// then push file to device

// then run below code in chrome console
var path = "videos/sample.mp3";
var fileHandle = tizen.metadata.createFileHandle(path);
var lyrics_num = fileHandle.get("SYNCLYRICS_NUM");

for (var i = 0; i < lyrics_num; ++i) {
    var lyrics = fileHandle.getSyncLyrics(i);
    console.log("Lyrics " + i + " (" + lyrics.timestamp  + "ms): " + lyrics.lyrics);
}

// expected return be like
console-via-logger.js:173 Lyrics 0 (100ms): TEST lyrics 1
console-via-logger.js:173 Lyrics 1 (2000ms): another TEST lyrics - 2
console-via-logger.js:173 Lyrics 2 (4000ms): yet another TEST lyrics

Change-Id: I01a502f40655532a37fc4055480e35826bb7a697

3 years ago[Metadata] Aded getFrameAtTime method of MetadataFileHandle 90/245090/4
Piotr Kosko [Thu, 1 Oct 2020 08:10:30 +0000 (10:10 +0200)]
[Metadata] Aded getFrameAtTime method of MetadataFileHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification] Code compiles without errors.
Works well for mp4 video.
var path = "videos/sample_video.mp4";
function showBlob(bbb) {
    var elem = document.getElementById("blobImage") || document.createElement("img");
    elem.setAttribute("id", "blobImage");
    elem.setAttribute("height", "240");
    elem.setAttribute("width", "240");
    elem.setAttribute("alt", "invalid frame");
    document.getElementById("test").appendChild(elem)

    var objectURL = URL.createObjectURL(bbb);
    elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var frame = fileHandle.getFrameAtTime(2000, true);
console.log(frame);
showBlob(frame)

Change-Id: Ib39c32566fe1d63711d7ce5ce991f216d7a84389

3 years ago[Metadata] Aded getFrame method of MetadataFileHandle 71/245071/7
Piotr Kosko [Thu, 1 Oct 2020 06:02:45 +0000 (08:02 +0200)]
[Metadata] Aded getFrame method of MetadataFileHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification] Code compiles withotu errors.
Works well for mp4 video.
var path = "videos/sample_video.mp4";
function showBlob(bbb) {
    var elem = document.getElementById("blobImage") || document.createElement("img");
    elem.setAttribute("id", "blobImage");
    elem.setAttribute("height", "240");
    elem.setAttribute("width", "240");
    elem.setAttribute("alt", "invalid frame");
    document.getElementById("test").appendChild(elem)

    var objectURL = URL.createObjectURL(bbb);
    elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var frame = fileHandle.getFrame();
console.log(frame);
showBlob(frame)

Change-Id: I2d5e81b19d7f11ff2c08a0096a0b58fb7e3bfc48

3 years ago[Metadata] Added getArtwork method of MetadataFileHandle 64/245064/6
Piotr Kosko [Wed, 30 Sep 2020 06:23:20 +0000 (08:23 +0200)]
[Metadata] Added getArtwork method of MetadataFileHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification]
Code compiles without errors.
Checked in chrome console with below code.
Precondition: sample.mp3 with artwork need to be pushed on device

// test artwork
var path = "videos/sample.mp3";
function showBlob(bbb) {
    var elem = document.getElementById("blobImage") || document.createElement("img");
    elem.setAttribute("id", "blobImage");
    elem.setAttribute("height", "240");
    elem.setAttribute("width", "240");
    elem.setAttribute("alt", "invalid blob");
    document.getElementById("test").appendChild(elem)

    var objectURL = URL.createObjectURL(bbb);
    elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var artwork = fileHandle.getArtwork();
console.log(artwork);
showBlob(artwork)

Change-Id: Ia0cbe5ade542ad71224a91c0c1a4618072b5538e

3 years agoMerge branch 'tizen_6.0' into tizen 30/247930/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:28:05 +0000 (12:28 +0100)]
Merge branch 'tizen_6.0' into tizen

Change-Id: I2d08f181e8b6b7f3673d959c22f17cc67e8358f1

3 years agoMerge branch 'tizen_5.5' into tizen_6.0 29/247929/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:27:12 +0000 (12:27 +0100)]
Merge branch 'tizen_5.5' into tizen_6.0

Change-Id: If24e8f3bf63cc1315e49ea67801d2742b8f7eb55

3 years agoMerge branch 'tizen_5.0' into tizen_5.5 27/247927/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:25:23 +0000 (12:25 +0100)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: I813db4cffb3862ced142c7a94e62679259f53c6d

3 years agoMerge branch 'tizen_4.0' into tizen_5.0 26/247926/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:21:12 +0000 (12:21 +0100)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: I660b3b2b74fb33acbb89b9d06b7a230abee28315

3 years agoMerge branch 'tizen_3.0' into tizen_4.0 24/247924/4
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:15:48 +0000 (12:15 +0100)]
Merge branch 'tizen_3.0' into tizen_4.0

Change-Id: Ia0f2c393b1aa339c1881c084636dbfb91245602d

3 years ago[version] 2.45 35/247935/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:13:52 +0000 (12:13 +0100)]
[version] 2.45

Change-Id: I96f465c583720abbb514635a56adf50988bdac4f

3 years ago[Filesystem] Fix the position property when writing non-single-byte-signs 18/247918/3
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 08:15:07 +0000 (09:15 +0100)]
[Filesystem] Fix the position property when writing non-single-byte-signs

[Bug] When FileStream object writes non-single-byte-signs, position members
was not properly updated.

[Verification] TCT filesystem - 100%
Below code:
(function writeKoreanOldAPI(fileName) {
    var dirPath = "documents/";
    var fullPath = dirPath + fileName;
    console.log("fullPath : " + fullPath);
    console.log("fileName : " + fileName);

    tizen.filesystem.resolve(fullPath, function (fileResult) {
        fileResult.openStream("w", function (fileStream) {
            fileStream.write("한글 확인 파일입니다\n");
            fileStream.write("한글111 확인 파일입니다\n");
            fileStream.write("한글22222 확인 파일입니다\n");

            fileStream.write("한글 확인 파일입니다\n");
            fileStream.write("한글 확인111 파일입니다\n");
            fileStream.write("한글 확인22222 파일입니다\n");

            fileStream.write("한글 확인 파일입니다\n");
            fileStream.write("한글 확인 파일입니다111\n");
            fileStream.write("한글 확인 파일입니다22222\n");
            fileStream.write("겆\n");
            fileStream.write("돐\n");

            fileStream.close();
        },
            function (e) {
                console.log("Error " + e.message);
            }, "UTF-8");

        fileResult.readAsText(
            function (str) {
                console.log("The file content:\n" + str);
                oldAPIResult = str;
            },
            function (e) {
                console.log("Error " + e.message);
            },
            "UTF-8");
    },
        function (e) {
            console.log("Error:" + e + " Create a file.");
            tizen.filesystem.resolve(dirPath, (dir) => { newFile = dir.createFile(fileName); });
            writeKoreanOldAPI(fileName);
        }, "rw");

})("test")

creates file with size of 302 bytes and content:
한글 확인 파일입니다
한글111 확인 파일입니다
한글22222 확인 파일입니다
한글 확인 파일입니다
한글 확인111 파일입니다
한글 확인22222 파일입니다
한글 확인 파일입니다
한글 확인 파일입니다111
한글 확인 파일입니다22222



Change-Id: I8ff3c158ed2b284e1cdeaa93c339952fef6915b0

3 years ago[Filesystem] Add support for ISO-8859-1 23/247923/2
Jakub Skowron [Tue, 23 Jan 2018 12:19:10 +0000 (13:19 +0100)]
[Filesystem] Add support for ISO-8859-1

Latin-1 encoding in FileReadString and FileWriteString

Change-Id: I2cd7942481619989891c3019d3f7d4325b962892
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
3 years ago[NBS] Add validation of instance to prevent crash 57/247857/1
Piotr Kosko [Thu, 5 Nov 2020 11:20:21 +0000 (12:20 +0100)]
[NBS] Add validation of instance to prevent crash

[Bug] In case of destroying instance before the operation:
* requestRouteToHost
* releaseRouteToHost
is finished, invalidated instance was used in code.

[Reproduction] In my case it was execution of below code max 10 times:
function crashApplicationWithNBS() {
    try {
        tizen.networkbearerselection.releaseRouteToHost(
            "CELLULAR", "www.onet.pl", addRouteAndReload, addRouteAndReload);
    } catch (e) {
        addRouteAndReload();
    }
}

function addRouteAndReload() {
    var statuscb =
    {
        onsuccess: function () {
            console.log("onsuccess func is called");
        },
        ondisconnected: function () {
            console.log("ondisconnected func is called");
        }
    };
    function ecb(e) {
        console.log("error callback is called: " + e.message + ": " + e.code);
    }
    setTimeout(() => {
        try {
            tizen.networkbearerselection.requestRouteToHost(
                "CELLULAR", "www.onet.pl", statuscb, ecb)
        } catch (e) { console.log(e) }
    }, 500);
    setTimeout(() => { location.href = "index.html"; }, 490);
}

[Verification]
* Crash does not occur. Crash situation is only signalled
with log:
DoAndPostMessage(264) > Trying to post message to non-existing instance: [0xb8cb1730], ignoring
* Success and error callbacks are properly triggered

Change-Id: I6adac13a8a99dbc114102bbd2ffced6bf012cfce

3 years agoMerge "[Systeminfo] Refactor for getCapability" into tizen
Piotr Kosko [Tue, 17 Nov 2020 07:15:06 +0000 (07:15 +0000)]
Merge "[Systeminfo] Refactor for getCapability" into tizen

3 years ago[Systeminfo] Refactor for getCapability 16/247416/5
Piotr Kosko [Tue, 10 Nov 2020 13:26:25 +0000 (14:26 +0100)]
[Systeminfo] Refactor for getCapability

The goal of this change is to avoid some strange error logs when 'trying' to gather
each type in the pipeline one after another. Now the type is checked first, then the value
is gathered.

[Verification] Code compiles without errors.
TCT passrate 100%.
Below calls behaviour didn't change (all capabilities listed in Web API documentation):

var caps = [
    'http://tizen.org/feature/content.scanning.others',
    'http://tizen.org/feature/datasync',
    'http://tizen.org/feature/download',
    'http://tizen.org/feature/network.telephony',
    'http://tizen.org/feature/network.wifi',
    'http://tizen.org/feature/systemsetting',
    'http://tizen.org/feature/systemsetting.home_screen',
    'http://tizen.org/feature/systemsetting.lock_screen',
    'http://tizen.org/feature/systemsetting.incoming_call',
    'http://tizen.org/feature/systemsetting.notification_email',
    'http://tizen.org/feature/network.bluetooth.audio.media',
    'http://tizen.org/feature/network.telephony',
    'http://tizen.org/feature/network.telephony.mms',
    'http://tizen.org/feature/battery',
    'http://tizen.org/feature/camera',
    'http://tizen.org/feature/camera.back',
    'http://tizen.org/feature/camera.back.flash',
    'http://tizen.org/feature/camera.front',
    'http://tizen.org/feature/camera.front.flash',
    'http://tizen.org/feature/database.encryption',
    'http://tizen.org/feature/fmradio',
    'http://tizen.org/feature/humanactivitymonitor',
    'http://tizen.org/feature/graphics.acceleration',
    'http://tizen.org/feature/led',
    'http://tizen.org/feature/input.keyboard',
    'http://tizen.org/feature/input.keyboard.layout',
    'http://tizen.org/feature/input.rotating_bezel',
    'http://tizen.org/feature/security.tee',
    'http://tizen.org/feature/location',
    'http://tizen.org/feature/location.batch',
    'http://tizen.org/feature/location.gps',
    'http://tizen.org/feature/location.wps',
    'http://tizen.org/feature/multimedia.transcoder',
    'http://tizen.org/feature/microphone',
    'http://tizen.org/feature/multi_point_touch.pinch_zoom',
    'http://tizen.org/feature/multi_point_touch.point_count',
    'http://tizen.org/feature/network.bluetooth',
    'http://tizen.org/feature/network.bluetooth.audio.call',
    'http://tizen.org/feature/network.bluetooth.audio.media',
    'http://tizen.org/feature/network.bluetooth.health',
    'http://tizen.org/feature/network.bluetooth.hid',
    'http://tizen.org/feature/network.bluetooth.le',
    'http://tizen.org/feature/network.bluetooth.opp',
    'http://tizen.org/feature/network.ethernet',
    'http://tizen.org/feature/network.internet',
    'http://tizen.org/feature/network.nfc',
    'http://tizen.org/feature/network.nfc.card_emulation',
    'http://tizen.org/feature/network.nfc.card_emulation.hce',
    'http://tizen.org/feature/network.nfc.p2p',
    'http://tizen.org/feature/network.nfc.reserved_push',
    'http://tizen.org/feature/network.nfc.tag',
    'http://tizen.org/feature/network.push',
    'http://tizen.org/feature/network.secure_element',
    'http://tizen.org/feature/network.telephony',
    'http://tizen.org/feature/network.telephony.mms',
    'http://tizen.org/feature/network.wifi',
    'http://tizen.org/feature/network.wifi.direct',
    'http://tizen.org/feature/opengles',
    'http://tizen.org/feature/opengles.texture_format',
    'http://tizen.org/feature/opengles.texture_format.3dc',
    'http://tizen.org/feature/opengles.texture_format.atc',
    'http://tizen.org/feature/opengles.texture_format.etc',
    'http://tizen.org/feature/opengles.texture_format.ptc',
    'http://tizen.org/feature/opengles.texture_format.pvrtc',
    'http://tizen.org/feature/opengles.texture_format.utc',
    'http://tizen.org/feature/opengles.version.1_1',
    'http://tizen.org/feature/opengles.version.2_0',
    'http://tizen.org/feature/platform.core.api.version',
    'http://tizen.org/feature/platform.core.cpu.arch',
    'http://tizen.org/feature/platform.core.cpu.arch.armv6',
    'http://tizen.org/feature/platform.core.cpu.arch.armv7',
    'http://tizen.org/feature/platform.core.cpu.arch.x86',
    'http://tizen.org/feature/platform.core.cpu.frequency',
    'http://tizen.org/feature/platform.core.fpu.arch',
    'http://tizen.org/feature/platform.core.fpu.arch.sse2',
    'http://tizen.org/feature/platform.core.fpu.arch.sse3',
    'http://tizen.org/feature/platform.core.fpu.arch.ssse3',
    'http://tizen.org/feature/platform.core.fpu.arch.vfpv2',
    'http://tizen.org/feature/platform.core.fpu.arch.vfpv3',
    'http://tizen.org/feature/platform.native.api.version',
    'http://tizen.org/feature/platform.native.osp_compatible',
    'http://tizen.org/feature/platform.version',
    'http://tizen.org/feature/platform.web.api.version',
    'http://tizen.org/feature/platform.version.name',
    'http://tizen.org/feature/profile',
    'http://tizen.org/feature/screen',
    'http://tizen.org/feature/screen.auto_rotation',
    'http://tizen.org/feature/screen.bpp',
    'http://tizen.org/feature/screen.coordinate_system.size.large',
    'http://tizen.org/feature/screen.coordinate_system.size.normal',
    'http://tizen.org/feature/screen.dpi',
    'http://tizen.org/feature/screen.height',
    'http://tizen.org/feature/screen.output.hdmi',
    'http://tizen.org/feature/screen.output.rca',
    'http://tizen.org/feature/screen.shape.circle',
    'http://tizen.org/feature/screen.shape.rectangle',
    'http://tizen.org/feature/screen.size.all',
    'http://tizen.org/feature/screen.size.large',
    'http://tizen.org/feature/screen.size.normal',
    'http://tizen.org/feature/screen.size.normal.240.400',
    'http://tizen.org/feature/screen.size.normal.320.320',
    'http://tizen.org/feature/screen.size.normal.320.480',
    'http://tizen.org/feature/screen.size.normal.360.360',
    'http://tizen.org/feature/screen.size.normal.360.480',
    'http://tizen.org/feature/screen.size.normal.480.800',
    'http://tizen.org/feature/screen.size.normal.540.960',
    'http://tizen.org/feature/screen.size.normal.600.1024',
    'http://tizen.org/feature/screen.size.normal.720.1280',
    'http://tizen.org/feature/screen.size.normal.1080.1920',
    'http://tizen.org/feature/screen.width',
    'http://tizen.org/feature/sensor.accelerometer',
    'http://tizen.org/feature/sensor.accelerometer.wakeup',
    'http://tizen.org/feature/sensor.activity_recognition',
    'http://tizen.org/feature/sensor.barometer',
    'http://tizen.org/feature/sensor.barometer.wakeup',
    'http://tizen.org/feature/sensor.gesture_recognition',
    'http://tizen.org/feature/sensor.gravity',
    'http://tizen.org/feature/sensor.gyroscope',
    'http://tizen.org/feature/sensor.gyroscope_rotation_vector',
    'http://tizen.org/feature/sensor.gyroscope.wakeup',
    'http://tizen.org/feature/sensor.heart_rate_monitor',
    'http://tizen.org/feature/sensor.heart_rate_monitor.led_green',
    'http://tizen.org/feature/sensor.heart_rate_monitor.led_ir',
    'http://tizen.org/feature/sensor.heart_rate_monitor.led_red',
    'http://tizen.org/feature/sensor.humidity',
    'http://tizen.org/feature/sensor.linear_acceleration',
    'http://tizen.org/feature/sensor.magnetometer',
    'http://tizen.org/feature/sensor.magnetometer.wakeup',
    'http://tizen.org/feature/sensor.pedometer',
    'http://tizen.org/feature/sensor.photometer',
    'http://tizen.org/feature/sensor.photometer.wakeup',
    'http://tizen.org/feature/sensor.proximity',
    'http://tizen.org/feature/sensor.proximity.wakeup',
    'http://tizen.org/feature/sensor.rotation_vector',
    'http://tizen.org/feature/sensor.sleep_monitor',
    'http://tizen.org/feature/sensor.temperature',
    'http://tizen.org/feature/sensor.tiltmeter',
    'http://tizen.org/feature/sensor.tiltmeter.wakeup',
    'http://tizen.org/feature/sensor.ultraviolet',
    'http://tizen.org/feature/sensor.wrist_up',
    'http://tizen.org/feature/shell.appwidget',
    'http://tizen.org/feature/sip.voip',
    'http://tizen.org/feature/speech.recognition',
    'http://tizen.org/feature/speech.synthesis',
    'http://tizen.org/feature/usb.accessory',
    'http://tizen.org/feature/usb.host',
    'http://tizen.org/feature/web.service',
    'http://tizen.org/feature/vision.face_recognition',
    'http://tizen.org/feature/vision.image_recognition',
    'http://tizen.org/feature/vision.qrcode_generation',
    'http://tizen.org/feature/vision.qrcode_recognition'
];

for (var i in caps) {
    try {
        console.log(
            'Value of ' + caps[i] + ': ' + tizen.systeminfo.getCapability(caps[i])
        );
    } catch (e) {
        console.log('Exception for ' + caps[i] + ': ' + e);
    }
}

Change-Id: Ia154396e3ec19dcb8b30f1c3b4f90a37bdd05738

3 years agoMerge "[Archive] Changing handling of Zip Path Traversal Vulnerability" into tizen
Piotr Kosko [Thu, 12 Nov 2020 13:22:01 +0000 (13:22 +0000)]
Merge "[Archive] Changing handling of Zip Path Traversal Vulnerability" into tizen

3 years ago[Archive] Changing handling of Zip Path Traversal Vulnerability 68/246868/4
Arkadiusz Pietraszek [Wed, 4 Nov 2020 18:20:42 +0000 (19:20 +0100)]
[Archive] Changing handling of Zip Path Traversal Vulnerability

This commit introduces verification of destination of extracted elements.
Before this commit ".." occurrence in archive entry resulted in
exception.

[Verification]
Manual test in developer console with prepared archive file shows
correct exception for ArchiveFile::extractAll and
ArchiveFileEntry::extract methods on TM1 and TW2.
tct-archive-tizen-tests pass rate: 100% on TM1 and TW2.

Change-Id: I823ff3d161bf1897fe98b6746cc0a1f60c874543
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
4 years agoMerge "[Bluetooth] Prevent accessing inappropriate memory areas" into tizen
Piotr Kosko [Tue, 10 Nov 2020 10:26:46 +0000 (10:26 +0000)]
Merge "[Bluetooth] Prevent accessing inappropriate memory areas" into tizen

4 years ago[NBS] Add validation of instance to prevent crash 79/246979/5
Piotr Kosko [Thu, 5 Nov 2020 11:20:21 +0000 (12:20 +0100)]
[NBS] Add validation of instance to prevent crash

[Bug] In case of destroying instance before the operation:
* requestRouteToHost
* releaseRouteToHost
is finished, invalidated instance was used in code.

[Reproduction] In my case it was execution of below code max 10 times:
function crashApplicationWithNBS() {
    try {
        tizen.networkbearerselection.releaseRouteToHost(
            "CELLULAR", "www.onet.pl", addRouteAndReload, addRouteAndReload);
    } catch (e) {
        addRouteAndReload();
    }
}

function addRouteAndReload() {
    var statuscb =
    {
        onsuccess: function () {
            console.log("onsuccess func is called");
        },
        ondisconnected: function () {
            console.log("ondisconnected func is called");
        }
    };
    function ecb(e) {
        console.log("error callback is called: " + e.message + ": " + e.code);
    }
    setTimeout(() => {
        try {
            tizen.networkbearerselection.requestRouteToHost(
                "CELLULAR", "www.onet.pl", statuscb, ecb)
        } catch (e) { console.log(e) }
    }, 500);
    setTimeout(() => { location.href = "index.html"; }, 490);
}

[Verification]
* Crash does not occur. Crash situation is only signalled
with log:
DoAndPostMessage(264) > Trying to post message to non-existing instance: [0xb8cb1730], ignoring
* Success and error callbacks are properly triggered

Change-Id: I6adac13a8a99dbc114102bbd2ffced6bf012cfce

4 years ago[Bluetooth] Prevent accessing inappropriate memory areas 88/246188/10
Pawel Wasowski [Wed, 21 Oct 2020 23:13:27 +0000 (01:13 +0200)]
[Bluetooth] Prevent accessing inappropriate memory areas

This commit prevents from accessing inappropriate memory areas,
leading to crashes.

The first crash scenario:
1. connect to a remote GATT server:
device.connect(<callbacks>) // "device" was passed as an argument to
BluetoothLEAdapter::startScan() callback
2. save one of the services to a variable:
var service = device.getService(<a UUID>);
3. disconnect from the server:
device.disconnect(<callbacks>)
4. connect to the same GATT server again:
device.connect(<callbacks>); // "device" represents the same
device as in the 1st step
5. get the same service as before:
var service_new = device.getService(<the same UUID as in 2.>)
6. access one of the "service"'s members:
service.services
7. The app has crashed

The second crash scenario has not been observed, but we anticipate that
crashes could happen if the old code were run on 64-bit CPUs
(XWALK-2106).
The old code has stored bt_gatt_h (typedef for just void*) values
from C++ in the JS layer, as "double" variables. On 32-bit architectures,
a conversion of a pointer to double (from C++ to JS) and from double to
a pointer (from JS back to C++) gives us the same pointer.
On 64-bit systems, a pointer may be greater than the greatest integer,
guaranteed to have a double representation (Number.MAX_SAFE_INTEGER
in JS) and using a memory address, casted back from double may lead to
a crash or another unpredictable behavior.

[Verification]
tct-bluetooth-tizen-tests:
        auto: 100% pass rate
        manual Bluetooth04_BLE_wearable: 100% pass rate
When the first crash scenario has been followed in ChromeDev Tools, no
crash has happened.

Change-Id: I52dead1398b2d0aaf21c34c68f6bbcb04ebd3dba
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch 'tizen_5.5' into tizen 54/246854/1 accepted/tizen/6.0/unified/20201109.024725 accepted/tizen/unified/20201109.123531 submit/tizen/20201104.133613 submit/tizen_6.0/20201105.091219
Piotr Kosko [Wed, 4 Nov 2020 11:38:51 +0000 (12:38 +0100)]
Merge branch 'tizen_5.5' into tizen

Change-Id: I8a11ece18424a2f71dac69b4ec9cf586bd20723f

4 years ago[version] 2.68 37/246837/1 accepted/tizen_5.5_unified accepted/tizen/5.5/unified/20201109.020201 submit/tizen_5.5/20201104.133647
Piotr Kosko [Wed, 4 Nov 2020 11:36:44 +0000 (12:36 +0100)]
[version] 2.68

Change-Id: Ic8c9c7cb091cc178e9ba51914e561ba9a61d9cab

4 years agoMerge "[Application] Add check for user_data availability in AppControl callback...
Piotr Kosko [Wed, 4 Nov 2020 11:12:36 +0000 (11:12 +0000)]
Merge "[Application] Add check for user_data availability in AppControl callback" into tizen

4 years ago[Application] Add check for user_data availability in AppControl callback 32/246832/1
Rafal Walczyna [Fri, 9 Oct 2020 11:52:55 +0000 (13:52 +0200)]
[Application] Add check for user_data availability in AppControl callback

Sometimes result_callback from app-control fires after
ApplicationInstance destructor.

[verification] Build successful

Change-Id: If60467db9e97573aedc4b888dfbe68f5e16390fc
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge changes I2573a59c,If524bc4f into tizen
Piotr Kosko [Mon, 26 Oct 2020 12:53:23 +0000 (12:53 +0000)]
Merge changes I2573a59c,If524bc4f into tizen

* changes:
  [Datacontrol] Prevent possible race conditions
  [datacontrol] Fix a few issues

4 years ago[Datacontrol] Prevent possible race conditions 51/246051/2
Pawel Wasowski [Wed, 21 Oct 2020 03:15:01 +0000 (05:15 +0200)]
[Datacontrol] Prevent possible race conditions

DataconstrolInstance::reply_map is accessed in callbacks
that can run in threads other than that, which runs API calls.
This commit adds a mutex and proper locks to prevent race
conditions.

[Verification] tct-datacontrol-tizen-tests: 100% pass rate

Change-Id: I2573a59c36af3e12a0d5e77598b170192d24f225
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[datacontrol] Fix a few issues 14/245914/3
Pawel Wasowski [Fri, 16 Oct 2020 22:02:05 +0000 (00:02 +0200)]
[datacontrol] Fix a few issues

This commit:
- adds freeing of the result passed to MAPGetResponseCallback
TODO: after fixing this problem, the app crashes. It was reported to
native developers and we need to wait for their answer, which will tell
us, if the result should be freed or not
- removes unused DatacontrolInstance::DataControlManagerGetConsumer
method
- adds handling errors of bundle_create() and bundle_add_str()
- adds the code destroying handles created in
DatacontrolInstance::Create{MAP, SQL}Handle() methods in case of
failures
- adds missing "const" and/or "&" in one of the functions to unify the
code style in the module
- fixes a grammar issue of one log message

[Verification] tct-datacontrol-tizen-tests: 100% pass rate

Change-Id: If524bc4f733762658a07993e39b8eaa9fe59d56d
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Application] Add check for user_data availability in AppControl callback 61/245461/10
Rafal Walczyna [Fri, 9 Oct 2020 11:52:55 +0000 (13:52 +0200)]
[Application] Add check for user_data availability in AppControl callback

Sometimes result_callback from app-control fires after
ApplicationInstance destructor.

[verification] Build successful

Change-Id: If60467db9e97573aedc4b888dfbe68f5e16390fc
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge "[datacontrol] Fix synchronisation issue" into tizen accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.122119 accepted/tizen/6.0/unified/hotfix/20201103.004423 accepted/tizen/6.0/unified/hotfix/20201103.051525 accepted/tizen/unified/20201020.101858 submit/tizen/20201020.095518 submit/tizen_6.0/20201029.205102 submit/tizen_6.0_hotfix/20201102.192502 submit/tizen_6.0_hotfix/20201103.114802 tizen_6.0.m2_release
Piotr Kosko [Tue, 20 Oct 2020 07:52:36 +0000 (07:52 +0000)]
Merge "[datacontrol] Fix synchronisation issue" into tizen

4 years ago[Utils] Remove invalid line 40/245940/1
Rafal Walczyna [Tue, 20 Oct 2020 07:43:27 +0000 (09:43 +0200)]
[Utils] Remove invalid line

Line occurred due to merge issue. It caused LightWeightWeb engine to fail.

Change-Id: I78ed5b083cfa007c2e396464b9a50ad6398f3bcc
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[datacontrol] Fix synchronisation issue 87/245687/4
k2.nagaraju [Wed, 14 Oct 2020 07:58:38 +0000 (13:28 +0530)]
[datacontrol] Fix synchronisation issue

k2.nagaraju:
In |RunMAPDataControlJob| updating the |IdMap| value and same value is
used in callback function |MAPAddResponseCallback| for any request id is
added. But before |RunMAPDataControlJob| updating value of |IdMap|,
getting |MAPAddResponseCallback| which is causing the failure with
|Invalid context|. Handled this scenario.

p.wasowski2:
Changed k2.nagaraju's commit a little to conform with the coding used in
the datacontrol module implementation and Web API.

[Verification] No synchronization issues in several runs of WebService2.wgt
app, attached to the related XWALK-2183 task (before, the problem,
signalled by "Invalid context" dlog entry, was reproducible on every run).
tct-datacontrol-tizen-tests: 100% pass rate

Signed-off-by: k2.nagaraju <k2.nagaraju@samsung.com>
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Change-Id: I247aaff45071331255528a62ffc5d8afa4b8e8af

4 years ago[Mediacontroller] Added refreshing the list of handles 94/245294/1 accepted/tizen/5.5/unified/20201103.003327 submit/tizen_5.5/20201026.095948
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 3 Sep 2020 08:35:44 +0000 (10:35 +0200)]
[Mediacontroller] Added refreshing the list of handles

[Bug] If native application (e.g. service) adds the playlist,
web api is able to gather it, but cannot perform any actions on it,
because web API stores only handles to playlists created by itself.

[Solution] Added functionality of refreshing handles always when gathering
a playlists handles using native API

[Verification] Code compiles without errors.

Change-Id: I9bb757f50c3bc4167b0a97c923d49a1ccbbe0195

4 years ago[Mediacontroller] Added refreshing the list of handles 23/243123/12 accepted/tizen/unified/20201007.090611 submit/tizen/20201006.121826
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 3 Sep 2020 08:35:44 +0000 (10:35 +0200)]
[Mediacontroller] Added refreshing the list of handles

[Bug] If native application (e.g. service) adds the playlist,
web api is able to gather it, but cannot perform any actions on it,
because web API stores only handles to playlists created by itself.

[Solution] Added functionality of refreshing handles always when gathering
a playlists handles using native API

[Verification] Code compiles without errors.

Change-Id: I9bb757f50c3bc4167b0a97c923d49a1ccbbe0195

4 years ago[Bluetooth][bugfix] Call success callbacks in registerService() 40/245140/1 submit/tizen/20201005.050422
Pawel Wasowski [Fri, 2 Oct 2020 16:28:27 +0000 (18:28 +0200)]
[Bluetooth][bugfix] Call success callbacks in registerService()

registerService() used to call successCallback only when registered
service had at least 1 component with read/write value request callback.
Now, the function will call successCallback even, if the service
has no components with such read/write value request calbacks.

[Verification] registerService() calls successCallback when no
read/write value request callbacks are registered

Change-Id: I4f4af260179fb21ac785dc1ccb0f5dab6d986496
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch tizen_5.5 into tizen 35/245135/4
Piotr Kosko [Fri, 2 Oct 2020 15:36:00 +0000 (17:36 +0200)]
Merge branch tizen_5.5 into tizen

Change-Id: I24dccce98a2419a5e75f16b446f450820bb792a7
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch 'tizen_5.0' into tizen_5.5 34/245134/3
Piotr Kosko [Fri, 2 Oct 2020 11:32:28 +0000 (13:32 +0200)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: I9a43855f32b1354ddbce403583d949e675c58073

4 years agoMerge branch 'tizen_4.0' into tizen_5.0 32/245132/1
Piotr Kosko [Fri, 2 Oct 2020 11:07:26 +0000 (13:07 +0200)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: Ic5b2736ab945e3c39cea6f32aae8d5532dd74558

4 years agoMerge branch 'tizen_3.0' into tizen_4.0 31/245131/1
Piotr Kosko [Fri, 2 Oct 2020 10:39:10 +0000 (12:39 +0200)]
Merge branch 'tizen_3.0' into tizen_4.0

Change-Id: I5424b41f13b345d9ff8b831f99b884f4a541b882

4 years ago[version] 2.45 27/245127/1
Piotr Kosko [Fri, 2 Oct 2020 10:20:21 +0000 (12:20 +0200)]
[version] 2.45

Change-Id: Ib116dd26b482abb5892e894f280141787f978435

4 years ago[Common] Fixed possible memory leak 26/245126/1
Piotr Kosko [Fri, 2 Oct 2020 10:19:32 +0000 (12:19 +0200)]
[Common] Fixed possible memory leak

[verification] Code compiles without errors

Change-Id: Ib8c7843461a575fd05d3b28e4db1fab35cc08ccb

4 years ago[version] 2.75 07/245107/1
Piotr Kosko [Fri, 2 Oct 2020 07:11:47 +0000 (09:11 +0200)]
[version] 2.75

Change-Id: Iadceec85547a133bfac39c77a6737714ea54a779

4 years ago[Bluetooth] Fixed code formatting 06/245106/1
Piotr Kosko [Fri, 2 Oct 2020 06:42:31 +0000 (08:42 +0200)]
[Bluetooth] Fixed code formatting

Change-Id: I2770d3735b9d606c5dd64fec877070b85942025c

4 years ago[Common] Applied some modifications from vd_fork 05/245105/1
Piotr Kosko [Fri, 2 Oct 2020 06:36:28 +0000 (08:36 +0200)]
[Common] Applied some modifications from vd_fork

* deprecation warninig mechanism
* systeminfo string keys

Change-Id: Iaaf87a0ab4e8a9b1d37628c21b5b6e339e81f982

4 years agoMerge "[Bluetooth] Add callbacks registering to GATTServer::registerService" into... accepted/tizen/unified/20200923.142546 submit/tizen/20200923.101308
Piotr Kosko [Wed, 23 Sep 2020 09:18:58 +0000 (09:18 +0000)]
Merge "[Bluetooth] Add callbacks registering to GATTServer::registerService" into tizen

4 years ago[Bluetooth] Add callbacks registering to GATTServer::registerService 48/244548/7
Rafal Walczyna [Mon, 21 Sep 2020 09:44:22 +0000 (11:44 +0200)]
[Bluetooth] Add callbacks registering to GATTServer::registerService

Register BluetoothGATT{Characteristic, Descriptor}::{read, write}ValueRequestCallbacks
in BluetoothGATTServer::registerService()

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263
[TASK] https://code.sec.samsung.net/jira/browse/XWALK-2166

[Verification] Tested in Chrome developer console

Change-Id: Iee9a9b03627c5fb3d2b3c7941b128c4483953535
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge branch 'tizen_5.5' into tizen 00/244700/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 08:37:15 +0000 (10:37 +0200)]
Merge branch 'tizen_5.5' into tizen

Change-Id: I8883a87450ef33eb55f363ce3841dc8a9861657e

4 years agoMerge branch 'tizen_5.0' into tizen_5.5 99/244699/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 08:27:57 +0000 (10:27 +0200)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: Ie3cfe5484b05a717edc31754efab8cf54faef126

4 years agoMerge branch 'tizen_4.0' into tizen_5.0 98/244698/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 08:26:55 +0000 (10:26 +0200)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: I2d5d3c4758a7181f8b66dce90a67485083866ed0

4 years ago[version] 2.44 95/244695/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 07:38:14 +0000 (09:38 +0200)]
[version] 2.44

Change-Id: I0caaa6af3791ad65fa165c45dfe37e5e01239b1b

4 years ago[Humanactivitymonitor] Fixed wrong behaviour of isGestureSupported() 96/244696/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 07:32:14 +0000 (09:32 +0200)]
[Humanactivitymonitor] Fixed wrong behaviour of  isGestureSupported()

https://code.sec.samsung.net/jira/browse/XWALK-2175

Implementation should not throw NotSupportedError, but return true/false

[Verification] Code compiles without errors.

Change-Id: Ia19893338f9b573a29639b667b3b0b52c6584554

4 years ago[Bluetooth] Prevent crash in BLE advertising 26/244626/1
Pawel Wasowski [Wed, 16 Sep 2020 18:02:29 +0000 (20:02 +0200)]
[Bluetooth] Prevent crash in BLE advertising

bt_advertiser_h pointer was freed twice in some cases, which lead to
crashes. Setting it to a nullptr after the first destruction fixes the
problem.

[Verification] Tested crashing scenario in Chrome DevTools Console and
no crashes occurred with the change.
tct-tizen-bluetooth-tests: 100 % pass rate (auto; manual were not run,
because they don't test BluetoothLEAdapter APIs)

Change-Id: Ie0d3de744075a4c08e5266fed274e98a0d9567b8
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Stop server after unregistering last service 70/244470/3
Rafal Walczyna [Fri, 18 Sep 2020 13:10:28 +0000 (15:10 +0200)]
[Bluetooth] Stop server after unregistering last service

GATTServer has to be stopped in case of last service unregistration.

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263
[TASK] https://code.sec.samsung.net/jira/browse/XWALK-2163

[Verification] Build successful. Tested in Chrome Console.
               Server stops when last service is unregistered.

Change-Id: I756bf9d944937e03f7e808c929e31140f4145add
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoImplement BluetoothGATTServer::unregisterAllServices() 74/244474/4
Dawid Juszczak [Fri, 18 Sep 2020 15:09:15 +0000 (17:09 +0200)]
Implement BluetoothGATTServer::unregisterAllServices()

[ACR]
https://code.sec.samsung.net/jira/browse/TWDAPI-263

[Verification]
Tested manually on chrome console

Change-Id: Ice5bfbd3fa4a8da75119db6b8e47849ca4259c26
Signed-off-by: Dawid Juszczak <d.juszczak@samsung.com>
4 years ago[Bluetooth] Reregister read/write value request callbacks on server start 81/244281/6
Pawel Wasowski [Wed, 16 Sep 2020 04:04:54 +0000 (06:04 +0200)]
[Bluetooth] Reregister read/write value request callbacks on server start

This commit implements reregistering read/write value callbacks,
that were once registered before a BluetoothGATTServer::stop() call.

[Verification] Tested in Chrome DevTools, callbacks are reregistered
after restarting the server

Change-Id: If67ee9ccf56b1aaac65a6c830b0b24ddf6e39b36
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge "[Bluetooth] Clear all GATT data after unregistering all services" into tizen
Piotr Kosko [Mon, 21 Sep 2020 08:14:55 +0000 (08:14 +0000)]
Merge "[Bluetooth] Clear all GATT data after unregistering all services" into tizen

4 years ago[Bluetooth] Clear all GATT data after unregistering all services 73/244473/3
Pawel Wasowski [Wed, 16 Sep 2020 10:03:50 +0000 (12:03 +0200)]
[Bluetooth] Clear all GATT data after unregistering all services

This commit clears_id->gatt_h and _id->callback names mappings from
BluetoothGATTServerService when the server is stopped.

[Verification] This change is tested together with the commit
implementing reregistration of read/write callbacks and works fine.

Change-Id: I4c16674f4856bb1fa74f4db74b6bbe9119f3b29f
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge "[Bluetooth] Bugfix: prevent memory leak" into tizen
Piotr Kosko [Mon, 21 Sep 2020 08:01:28 +0000 (08:01 +0000)]
Merge "[Bluetooth] Bugfix: prevent memory leak" into tizen

4 years agoMerge "[Bluetooth] Remove redundant Destroy* functions" into tizen
Piotr Kosko [Mon, 21 Sep 2020 08:01:22 +0000 (08:01 +0000)]
Merge "[Bluetooth] Remove redundant Destroy* functions" into tizen

4 years ago[Bluetooth] Bugfix: prevent memory leak 81/244481/2
Pawel Wasowski [Wed, 16 Sep 2020 14:11:26 +0000 (16:11 +0200)]
[Bluetooth] Bugfix: prevent memory leak

In the previous implementation if a service was successfully created,
but its registration failed, the resources associated with its handle
were not released.
Such a situation has occurred when Bluetooth was disabled and
BluetoothGATTServer::registerService() was called.
This commit adds the missing line that destroys the handle.

[Verification] The code compiles.
Tested in chrome console - server is successfully created and reports
errors in case of disabled bluetooth adapter. No crash or other issues observed.

Change-Id: I85741e51638abd6b5443d7f7ce5d84e9279fc498
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Remove redundant Destroy* functions 80/244480/3
Pawel Wasowski [Wed, 16 Sep 2020 14:03:51 +0000 (16:03 +0200)]
[Bluetooth] Remove redundant Destroy* functions

Destroy* functions from BluetoothGATTServer class were removed, because
they internally destroyed nested GATT objects.
Such behavior is safe, but redundant, because the native methods already
destroy nested objects.
Their usages were replaced by their counterparts from
BluetoothGATTServerService class.

[Verification] The code compiles. Tested in chrome console together with
https://review.tizen.org/gerrit/#/c/platform/core/api/webapi-plugins/+/244481/
No issues observed.

Change-Id: Ied428687fd4467fe9418afa9f87446c3a9b5b147
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch 'tizen_5.0' into tizen_5.5 69/244469/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 18 Sep 2020 12:55:00 +0000 (14:55 +0200)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: Id032af991b0670d09d5ff35aa4c142669cd26959