platform/core/connectivity/ua-manager.git
2 years agoDead default in switch 76/258676/2
rohit singh [Mon, 24 May 2021 05:53:55 +0000 (11:23 +0530)]
Dead default in switch

Issue: The statements in the default case are never executed.

Solution: Removal of the retv statement will solve the issue.

Change-Id: I74cc0d357acbb7bc5ce986ef532f5684b3ab74fa
Signed-off-by: rohit.singh <rohit.singh@samsung.com>
3 years agoFix for __uam_manager_get_device_type 33/258233/3
rohit singh [Wed, 12 May 2021 11:52:29 +0000 (17:22 +0530)]
Fix for __uam_manager_get_device_type

Issue: Return type mismatch issue. Inside function __uam_manager_get_device_type()
enum UAM_SENSOR_BITMASK_* is used instead of UAM_TECH_TYPE-*, which was inconsistent
to the function calling __uam_manager_get_device_type().

Solution: Changed UAM_SENSOR_BITMASK_* to UAM_TECH_TYPE-*.

Change-Id: I1df188dd713379e8c594de86707bf39e05a7fec9

3 years agoModify to check privilege 69/255969/2 accepted/tizen/unified/20210331.054046 submit/tizen/20210330.060456
hyunuk.tak [Thu, 25 Mar 2021 23:37:44 +0000 (08:37 +0900)]
Modify to check privilege

Change privilege as below
userawareness, userawareness.admin
=> bluetooth, network.get, location

Add request for adding/removing sensor

Change-Id: Iedd72ba46ac0a93b1ba320f637a9b0aa464686d1
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
3 years agoModify default policy for dbus 06/255706/7 submit/tizen/20210330.042707
hyunuk.tak [Mon, 22 Mar 2021 23:59:30 +0000 (08:59 +0900)]
Modify default policy for dbus

Change-Id: I3a02f401a9c7614d42bb7919e41a1b4c89fac522
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
3 years agoFix the security configuration issue (Shell Script) 93/254193/2 accepted/tizen/unified/20210226.131923 submit/tizen/20210225.094448
DoHyun Pyun [Wed, 24 Feb 2021 23:20:16 +0000 (08:20 +0900)]
Fix the security configuration issue (Shell Script)

All command line tools in any shell script should be executed
in designated location or executed as absolute path.

Change-Id: I8f9548f7fda0db656ede895be2fd7c92e2c9161f
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
3 years agoua-daemon: Add support for product API's 92/253392/1 submit/tizen/20210210.041708
Abhay Agarwal [Tue, 9 Feb 2021 06:18:59 +0000 (11:48 +0530)]
ua-daemon: Add support for product API's

This patch adds support in ua-daemon to handle product API's.

Change-Id: Ic37f326f04bbcdd6c67734ae5ae7f48ab677afa7
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
3 years agoua-api: Add support for product API's 91/253391/1
Abhay Agarwal [Fri, 5 Feb 2021 09:14:52 +0000 (14:44 +0530)]
ua-api: Add support for product API's

This patch adds support in ua-api to handle product API's.

Change-Id: Ied7769ad1f550a81e643a7ab894625860924c5ba
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
3 years agoAdd some patches 07/250707/3 accepted/tizen/unified/20210201.055431 accepted/tizen/unified/20210203.145513 submit/tizen/20210112.005356 submit/tizen/20210131.225751 submit/tizen/20210203.045513
hyunuk.tak [Mon, 4 Jan 2021 04:19:31 +0000 (13:19 +0900)]
Add some patches

Fix circleCI script
Undefined OS type , OS updation for single device ID fix
OS_update in plugin bug fix
Fix to not to use docker image
Fix device detection failure due to payload
Change the plugin path to RO area
Fix stop detection event
Fix user absence event
Fix set service detection cycle functionality
Remove implicit call of stop_detection before start_detection
Send unique payloads to plugins in registered device list
Add scan mode functionality for start detection
Terminate ua-manager if no client is referencing it

Change-Id: I5bd6d8d421071d534991818d3e0128c5d68ce8d6
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
3 years agoAdd ifndef flag for sqlite 3.33.0 71/249071/1 accepted/tizen/unified/20201207.123247 submit/tizen/20201207.014950
Jihoon Jung [Mon, 7 Dec 2020 01:09:21 +0000 (10:09 +0900)]
Add ifndef flag for sqlite 3.33.0

Change-Id: Ib36af3e1001371d1440a1d842a6c9a0308085a40
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
3 years agoModify the package version 49/240049/3 accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix tizen_6.0 tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.120611 accepted/tizen/6.0/unified/hotfix/20201103.050049 accepted/tizen/unified/20200810.123044 submit/tizen/20200806.040127 submit/tizen/20200809.234730 submit/tizen_6.0/20201029.205103 submit/tizen_6.0_hotfix/20201102.192503 submit/tizen_6.0_hotfix/20201103.114803 tizen_6.0.m2_release
DoHyun Pyun [Mon, 3 Aug 2020 01:39:53 +0000 (10:39 +0900)]
Modify the package version

In order to distinguish the package history as tizen version,
we manage the package version from now.

Change-Id: I3d40228067053f313fa695e56c42453c0b1263d2
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
4 years agoStop scan on sensor when no monitoring application 53/225153/1 accepted/tizen/unified/20200218.145853 submit/tizen/20200218.012430
Abhay Agarwal [Mon, 17 Feb 2020 08:43:39 +0000 (14:13 +0530)]
Stop scan on sensor when no monitoring application

Issue: Presence/absence scanning on BLE/wifi plugin was not able to
stop in case only presence or only absence was started by application.

Reason: Even if only presence or only absence is started by application
ua-manager simultaneoulsy starts both presence and absence to keep their
detection cycle in sync.

Solution: Stop both presence and absence detection when stop detection
is called, if no application is monitioring on this sensor.

Change-Id: I1e54bad283932dfe3128628e98369a0070f9e623
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoua-daemon: Fix memory leak during init 34/224234/1 accepted/tizen/unified/20200210.131729 submit/tizen/20200210.035428
Abhay Agarwal [Thu, 30 Jan 2020 11:33:48 +0000 (17:03 +0530)]
ua-daemon: Fix memory leak during init

Change-Id: I2284a7de845bfbfc88bdffa6de30f0fc8700757c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoua-db: Fix negative returns 33/224233/1
Abhay Agarwal [Thu, 30 Jan 2020 06:19:48 +0000 (11:49 +0530)]
ua-db: Fix negative returns

If payload device uid length is negative, assign this length as 0

Change-Id: I2bda321b6d27df2962771d809a0459c15724aaff
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoua-daemon: Fix resource leak, possible NULL derefernce and coverity issues 32/224232/1
Abhay Agarwal [Thu, 30 Jan 2020 05:39:36 +0000 (11:09 +0530)]
ua-daemon: Fix resource leak, possible NULL derefernce and coverity issues

Change-Id: Ib94b45ee765549198c5b56f0967a78e6ac121c06
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoplugin handler: Fix resource leak because of payload 31/224231/1
Abhay Agarwal [Wed, 29 Jan 2020 05:22:23 +0000 (10:52 +0530)]
plugin handler: Fix resource leak because of payload

Change-Id: Ife96b4762153e52fc26babff1ddf6ce0a79f9f3b
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoSimultaneously start presence and absence detection 66/223266/1
Abhay Agarwal [Tue, 21 Jan 2020 05:40:44 +0000 (11:10 +0530)]
Simultaneously start presence and absence detection

Issue: when presence detection is follwed by absence detection,
       absence callback is missed in first cycle.
Solution: start both presence and absence detection

Change-Id: I353a2ecd985c86afefb322cad47283695853896c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoAdd support to report light sensor status change 18/222518/1
Abhay Agarwal [Tue, 14 Jan 2020 09:35:31 +0000 (15:05 +0530)]
Add support to report light sensor status change

This patch add support of light sensor in existing functionality
to report sensor status change to application

Change-Id: Ie237eeecc1fbf15c3ccb08b35b91ec5e597e60d3
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoFix check for db file size 17/222517/1
Abhay Agarwal [Tue, 14 Jan 2020 11:38:58 +0000 (17:08 +0530)]
Fix check for db file size

Database file should not be 0 after db creation

Change-Id: I93803f853ffd6b3afed3b18010cc556da7eb3417
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
4 years agoFix device payload update query accepted/tizen/unified/20200101.120602 submit/tizen/20191230.073018
Abhay agarwal [Fri, 27 Dec 2019 03:24:19 +0000 (08:54 +0530)]
Fix device payload update query

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoFix device service list in ua-manager for NULL payloads
Abhay agarwal [Thu, 26 Dec 2019 15:53:33 +0000 (21:23 +0530)]
Fix device service list in ua-manager for NULL payloads

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoStore payload device user data in database
Abhay agarwal [Thu, 26 Dec 2019 13:48:33 +0000 (19:18 +0530)]
Store payload device user data in database

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoSet length for payload device uid
Abhay agarwal [Thu, 26 Dec 2019 04:24:44 +0000 (09:54 +0530)]
Set length for payload device uid

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoFix payload copy functions
Abhay agarwal [Tue, 24 Dec 2019 13:34:28 +0000 (19:04 +0530)]
Fix payload copy functions

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoupdate handle device detected for payload handling
Abhay agarwal [Tue, 24 Dec 2019 09:39:00 +0000 (15:09 +0530)]
update handle device detected for payload handling

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoupdate svc_dev list while registering device to service
Abhay agarwal [Mon, 23 Dec 2019 13:45:09 +0000 (19:15 +0530)]
update svc_dev list while registering device to service

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoUpdate registered device list to plugin with payload information
Abhay agarwal [Mon, 23 Dec 2019 12:16:10 +0000 (17:46 +0530)]
Update registered device list to plugin with payload information

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoUpdate svc_dev info while adding payload to service
Abhay agarwal [Fri, 20 Dec 2019 12:49:30 +0000 (18:19 +0530)]
Update svc_dev info while adding payload to service

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd service-device-payload list in device tech
Abhay agarwal [Thu, 19 Dec 2019 12:02:50 +0000 (17:32 +0530)]
Add service-device-payload list in device tech

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoFix copy function of payload
Abhay agarwal [Wed, 18 Dec 2019 09:29:29 +0000 (14:59 +0530)]
Fix copy function of payload

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoDo not return from uam core initialization if no data in database
Abhay agarwal [Tue, 17 Dec 2019 14:24:08 +0000 (19:54 +0530)]
Do not return from uam core initialization if no data in database

- All the database tables must be checked before returning from
  uam_core_init function
- Some/All of tables of uam database may be empty and can be
  updated by application

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoUpdate core payload list from database during init
Abhay agarwal [Tue, 17 Dec 2019 12:27:35 +0000 (17:57 +0530)]
Update core payload list from database during init

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd database API to get all payloads
Abhay agarwal [Tue, 17 Dec 2019 11:22:47 +0000 (16:52 +0530)]
Add database API to get all payloads

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd API to get payloads list
Abhay agarwal [Thu, 12 Dec 2019 09:55:02 +0000 (15:25 +0530)]
Add API to get payloads list

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd database APIs to update device service payload info
Abhay agarwal [Fri, 6 Dec 2019 04:07:56 +0000 (09:37 +0530)]
Add database APIs to update device service payload info

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoFix device payload insert
Abhay agarwal [Wed, 4 Dec 2019 08:50:22 +0000 (14:20 +0530)]
Fix device payload insert

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd ua-manager core API to insert payload information to a service
Abhay agarwal [Mon, 2 Dec 2019 10:06:53 +0000 (15:36 +0530)]
Add ua-manager core API to insert payload information to a service

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd database API to insert device payload
Abhay agarwal [Fri, 29 Nov 2019 08:51:15 +0000 (14:21 +0530)]
Add database API to insert device payload

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd ua-manager core APIs to insert payload information
Abhay agarwal [Fri, 29 Nov 2019 05:52:07 +0000 (11:22 +0530)]
Add ua-manager core APIs to insert payload information

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoRemove payload from device
Abhay agarwal [Thu, 28 Nov 2019 11:35:41 +0000 (17:05 +0530)]
Remove payload from device

payload would be added to device-service instead of only being device specific

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoSeperate payload database table from device table
Abhay agarwal [Thu, 28 Nov 2019 10:48:30 +0000 (16:18 +0530)]
Seperate payload database table from device table

For a device, each service can have different payload.

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoRename duid to device_uid
Abhay agarwal [Thu, 28 Nov 2019 04:23:38 +0000 (09:53 +0530)]
Rename duid to device_uid

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoRename ble payload purpose to secondary key
Abhay agarwal [Wed, 27 Nov 2019 06:36:02 +0000 (12:06 +0530)]
Rename ble payload purpose to secondary key

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoRename ble payload service_id to primary_key
Abhay agarwal [Wed, 27 Nov 2019 06:08:41 +0000 (11:38 +0530)]
Rename ble payload service_id to primary_key

Renamed to hide SEC BLE Adv format

Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoFix crash issue accepted/tizen/unified/20191213.042448 submit/tizen/20191212.070841
saerome.kim [Thu, 12 Dec 2019 06:10:38 +0000 (15:10 +0900)]
Fix crash issue

- problem: Crash takes place when doing adding a device and detection
  simultaneously.
- Cause: timer callback tries to remove freed memory.
- Solution: Remove timer when removing an async request.

Change-Id: I24be2a3c53ee18e8f3c97be46348a05b03a0782d
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoChange UAM_ASYNC_REQUEST_TIMEOUT to 11 from 10 sec
Lokesh [Wed, 11 Dec 2019 10:19:41 +0000 (15:49 +0530)]
Change UAM_ASYNC_REQUEST_TIMEOUT to 11 from 10 sec

Problem: While adding wifi device with broadcast mac address, and device is not
discoverable, the request_list is cleaned by __uam_request_context_timeout_cb()
before plugin callback came (within 10 sec).
Solution: Plugin tries for 10 seconds, so wait for 11 seconds.

Change-Id: I2bbfc38ccfec65035ecfbb61bf30c20749ee44dd
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoRemove unnecessary error log accepted/tizen/unified/20191205.142656 submit/tizen/20191205.122156
saerome.kim [Thu, 5 Dec 2019 10:25:17 +0000 (19:25 +0900)]
Remove unnecessary error log

Change-Id: I4fa6b31e6511ccef0e3b827b939663146eb9a4bc
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix that the device is not added while detecting devices.
saerome.kim [Thu, 5 Dec 2019 09:22:22 +0000 (18:22 +0900)]
Fix that the device is not added while detecting devices.

- Problem: If adding a device while detecting the device, the first device
  detection callback is not called.
- Cause: If the broadcast MAC is used as a source filed in APR Request packet,
  can't distinguish ARP Response whether the device detected or the device added.
- Solution: Modified the device is not added while detecting devices.

Change-Id: Iad779411cecc89869b1aa77522cefd22e7106ecb
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoIncrease 'enable' method timeout
saerome.kim [Thu, 5 Dec 2019 08:35:55 +0000 (17:35 +0900)]
Increase 'enable' method timeout

- Problem: At the time of booting, failt to start ua-manager.
- Cause: It takes a long time for sensor framework to operate.
- Solution: Temporarily increase the response waiting time of the enable method
  to start ua-amanger.

Change-Id: I136d689180535ffe86431c97ad82eb00fb259632
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix the issue that MAC cannot be updated when adding a device to broadcast MAC
saerome.kim [Thu, 5 Dec 2019 05:38:06 +0000 (14:38 +0900)]
Fix the issue that MAC cannot be updated when adding a device to broadcast MAC

- Problem: The actual MAC is not applied even if the ARP response is received
  from the device added with broadcast MAC.
- Cause: MAC is managed as a unique key.
- Solution: Modified so that MAC can be changed.

Change-Id: Ic9f1b1b0a9b5694b9275302354df9e36a78d3da4
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoRevert "Add DB functionality for device users mapping"
Lokesh [Wed, 4 Dec 2019 08:49:57 +0000 (14:19 +0530)]
Revert "Add DB functionality for device users mapping"

This reverts commit 1afd2d3aeb9758f4f894c3aa917874da82d33c3b.

Change-Id: I5a76569e7190643c7dfc726dbdeca01d1cb27723

4 years agoRevert "Identify whether device is already registered and not"
Lokesh [Wed, 4 Dec 2019 08:49:12 +0000 (14:19 +0530)]
Revert "Identify whether device is already registered and not"

This reverts commit 5ac8bb7cef537a0db489b1a364c4bffbf8ca0dbf.

Change-Id: I5164eb00ff30c9006786ce963ba1810023588364

4 years agoRevert "Fix the problem that can't access the device-users table"
Lokesh [Wed, 4 Dec 2019 08:47:51 +0000 (14:17 +0530)]
Revert "Fix the problem that can't access the device-users table"

This reverts commit 798a02d0faca05dc6a7a5124c382471e43efd381.

Change-Id: Iae2c03b1fa6c9826c420f9e3d9a6de07820643a4
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix memory leak
saerome.kim [Tue, 3 Dec 2019 12:29:45 +0000 (21:29 +0900)]
Fix memory leak

- Problem: Even clients app. died, ua-manager keeps dead client's
  monitor handle.
- Cause: ua-manager does not care for the dead client app.
- Solution: Remove the client's monitor handle if the client requests un-initialization.

Change-Id: I992bf5a6234675fbc3b81fad7f97b530e4019ae4
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years ago[Fix] Write service specific device last_seen in DB accepted/tizen/unified/20191201.221537 submit/tizen/20191129.113310
Lokesh [Fri, 29 Nov 2019 08:19:46 +0000 (13:49 +0530)]
[Fix] Write service specific device last_seen in DB

Issue:
On device detection, update service specific device last_seen in DB.
At time of service_add_device/user(), this last_seen must initialisze from 0,
as per jira statement(https://code.sec.samsung.net/jira/browse/TSYSCON-1948).

Change-Id: I4c7d46fc6ff43f6a09d27df671805eb5f33bfb69
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix the problem that can't access the device-users table submit/tizen/20191129.055159
saerome.kim [Fri, 29 Nov 2019 04:43:17 +0000 (13:43 +0900)]
Fix the problem that can't access the device-users table

- Problem: After DB reset, ua-manager can't create the device-users table.
- Cause: Attempt to access a table that does not exist.
- Solution: Modified the device-users table name as intended.

Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoRemove error-logging when removing un-opened DB accepted/tizen/unified/20191126.124635 submit/tizen/20191126.004258
saerome.kim [Mon, 25 Nov 2019 11:43:29 +0000 (20:43 +0900)]
Remove error-logging when removing un-opened DB

- Problem: An error is displayed while attempting to delete an unopened DB.
- Cause: vendor plugin tried to clear DB but ua-manager did not open DB file.
- Solution: If the DB is not open, the error is returned.

Change-Id: Ifc3f13cc18ab362ebd1c18910ee6a430449b0732
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoMake unclear code as clear
saerome.kim [Mon, 25 Nov 2019 11:33:14 +0000 (20:33 +0900)]
Make unclear code as clear

- Problem: The Coverity regarded that ua-manager refering freed() pointer.
- Cause: The input param and the param in the list may not be the same value.
- Solution: Clarify variable name.

Change-Id: I13597ecfcd79843e7ba7222b2282e6e5dd8b6dc3
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoIdentify whether device is already registered and not
Lokesh [Fri, 22 Nov 2019 02:04:04 +0000 (07:34 +0530)]
Identify whether device is already registered and not

Change-Id: I14be9dd70c03f3d40e2b4d4e953b5ad72c2c5c33
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoAdd DB functionality for device users mapping
Lokesh [Fri, 22 Nov 2019 02:04:04 +0000 (07:34 +0530)]
Add DB functionality for device users mapping

Change-Id: Id41e248ce14ed1f1fdb75fec2aa2680077e5855d
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix build error occurred in sensor plugins accepted/tizen/unified/20191125.135542 submit/tizen/20191122.014017
saerome.kim [Fri, 22 Nov 2019 01:31:15 +0000 (10:31 +0900)]
Fix build error occurred in sensor plugins

- Problem: Build break took place when building Light/Motion plugins.
- Cause: member variable name had been changed in uas_sensor_info_t.
- Solution: Backout the change.

Change-Id: Id8c10d798a28427451d81b16772603490f24dcd0
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoProvide pending request TRUE only for already registered but not verified device.
Nishant Chaprana [Thu, 21 Nov 2019 14:12:36 +0000 (19:42 +0530)]
Provide pending request TRUE only for already registered but not verified device.

- Problem: Pending request returns TRUE when last registered device which is not
           yet verified by plugin, even for different device.
- Cause: __uam_manager_is_request_pending() only checks for matching function
         before returning result.
- Solution: Match device_id for UAM_REQUEST_ADD_DEVICE before returning result.

Change-Id: Ie0d148f821932eb195547c47939917bb7bdbba60
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
4 years agoFix handle leak when loading plugins
Nishant Chaprana [Thu, 21 Nov 2019 14:04:41 +0000 (19:34 +0530)]
Fix handle leak when loading plugins

- Problem: dlopen() returned handle was leaking when loading plugins in loop.
- Cause: dlcose() not called when plugin add operation fails.
- Solution: Call dlcose() when plugin add operation fails.

Change-Id: Id3c1d9a42fb2ef8b9b9e5b64393c40f6e771d9fc
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
4 years agoFix crash issue
saerome.kim [Thu, 21 Nov 2019 08:33:14 +0000 (17:33 +0900)]
Fix crash issue

- Problem: A crash may occur in a multi-client environment.
- Cause: A crash may occur if a request is deleted in the middle while
  processing the async request included in the list.
- Solution: Modified so that the list is not broken by deleting the request
  while processing the request.

Change-Id: Ic51e4571ea10d7922b429d2712b8a3ed4dccc512
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoUpdate a missing column for device-services table
saerome.kim [Thu, 21 Nov 2019 08:29:56 +0000 (17:29 +0900)]
Update a missing column for device-services table

Change-Id: I1f9b7864cc44bb37e63c51dc713e7c0c38d07194
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoChange the last seen that has never been added or detected by the service to 0
saerome.kim [Thu, 21 Nov 2019 04:39:37 +0000 (13:39 +0900)]
Change the last seen that has never been added or detected by the service to 0

- Problem: The last_seen information may not be 0 even if the service is not executed.
- Cause: We are adding the last_seen info regardless the service.
- Solution: The device information added to the service is initialized to 0.

Change-Id: I14249599db420b25e47098c83eaa17ed1d65182e
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix the problem that can't add a device from next time once add_device_failed.
saerome.kim [Thu, 21 Nov 2019 04:39:37 +0000 (13:39 +0900)]
Fix the problem that can't add a device from next time once add_device_failed.

- Problem: Once add_device failed, we can't add the device anymore.
- Cause: The request stored in the internal queue is not deleted.
- Solution: If the request is not processed for a certain period of time,
  remove the request from the queue

Change-Id: I14990e3854d599ca3adfed491f64bb215e94d232
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoModify to store last seen information of device added by service in DB
saerome.kim [Wed, 20 Nov 2019 11:10:56 +0000 (20:10 +0900)]
Modify to store last seen information of device added by service in DB

- Problem: Once a client app restarts, the previous last seen information is 0.
- Cause: As a requirement, last seen information of service-specific device
  should be stored in DB
- Solution: Save the last seen information to the DB.

Change-Id: Ifd1e41c0c822b2274262d3aea6c723e192945822
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoReduce calls to _uam_get_timestamp() accepted/tizen/unified/20191119.133204 submit/tizen/20191119.082254
Lokesh [Tue, 19 Nov 2019 05:36:17 +0000 (11:06 +0530)]
Reduce calls to _uam_get_timestamp()

Instead use the value stored in tech->timestamp

Change-Id: I1017043c45a0fd53cd2f962c6168a1e7a902c7d2
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoSupport multiple timestamp for each service
Lokesh [Mon, 18 Nov 2019 14:00:04 +0000 (19:30 +0530)]
Support multiple timestamp for each service

Change-Id: I67acdcfa5e4ba8a6d8de68f7e37dfcd4f58adf01
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix memory leak
saerome.kim [Mon, 18 Nov 2019 04:13:03 +0000 (13:13 +0900)]
Fix memory leak

- Problem: heap is increasing a bit by bit.
- Cause: BT_MAC is not freed.
- Solution: make BT_MAC free.

Change-Id: I0f118ba74c2e62c81561080751338a4925044b2a
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoChange the timestamp value to use the monotonic timer accepted/tizen/unified/20191115.125601 submit/tizen/20191115.102151
saerome.kim [Thu, 14 Nov 2019 09:59:11 +0000 (18:59 +0900)]
Change the timestamp value to use the monotonic timer

- Problem: real-time timestamp causes various problems.
- Cause: If the time zone is changed or the system time is initialized,
  the wrong timestamp may be generated.
- Solution:
  1. Change to use the monotonic timer when creating a timestamp.
  2. Add new plugin API that enables the BLE plugin can save real-time
  timestamp.

Change-Id: I2508ecdb15977f6278fb2eeec89dc5caba77537f
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoChange the timestamp value to use the monotonic timer
saerome.kim [Thu, 14 Nov 2019 09:59:11 +0000 (18:59 +0900)]
Change the timestamp value to use the monotonic timer

- Problem: real-time timestamp causes various problems.
- Cause: If the time zone is changed or the system time is initialized,
  the wrong timestamp may be generated.
- Solution:
  1. Change to use the monotonic timer when creating a timestamp.
  2. Add new plugin API that enables the BLE plugin can save real-time
  timestamp.

Change-Id: I24c1dbbec39417f6f13ec87dfff8c3239572722c
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoChange position of _uam_pm_stop_detection()
Lokesh [Thu, 14 Nov 2019 11:28:00 +0000 (16:58 +0530)]
Change position of _uam_pm_stop_detection()

Do _uam_pm_stop_detection() for both presence and absence together,
so that motion plugin sends detection_stopped event.

Change-Id: I9fb0e1696c16cb59eb0c3c7f910101844364b5ec
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoStart continuous detection only on sensors present in monitor
Abhay agarwal [Mon, 11 Nov 2019 06:10:05 +0000 (11:40 +0530)]
Start continuous detection only on sensors present in monitor

Instead of always starting continuous detection, start only when particular
environmental sensor is being detected by atleast one application.

Change-Id: I0e4baac40074fcd7b1cedf139dfe1e773b1c7049
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoIn detection_stopped event, consider when no environmental sensors exist
Lokesh [Mon, 11 Nov 2019 01:43:55 +0000 (07:13 +0530)]
In detection_stopped event, consider when no environmental sensors exist

1/ If there is no environmental sensor, send UAM_DETECTION_CYCLE_END only once.
2/ First update service->remaining_time, then start various detections.
3/ Environmental sensors may send detection_stopped before start_detection of
connectivity sensor, which results in multiple detection stopped events to CAPI
within a detection window.

Change-Id: I1c149fe8be8f3f86bf053ac8167df765948df72e
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoDetection stopped event updated with detection cycle mid/end
Lokesh [Wed, 6 Nov 2019 10:12:39 +0000 (15:42 +0530)]
Detection stopped event updated with detection cycle mid/end

Every one minute we receive environmental presence/absence and detection
stopped calls. Earlier _uam_core_handle_detection_stopped() sends
detection_stopped_event which then called __ua_user_state_clean() and
cleaned recorded WIFI/BLE data in CAPI. Hence it cannot be used for
next one minute cycles of environmental sensors.

Change-Id: Ibad4cbf5e05840b31a593984a0f00f1ca4b72ae9
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix first detection stopped callback due to motion sensor
Lokesh [Thu, 7 Nov 2019 08:40:25 +0000 (14:10 +0530)]
Fix first detection stopped callback due to motion sensor

_uam_core_handle_detection_stopped() should work only if detection has been
started on that sensor previously.

Change-Id: I32b04ed63bc108606a59c0d64066cf9efa42ad52
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix memory leak
saerome.kim [Thu, 14 Nov 2019 03:37:49 +0000 (12:37 +0900)]
Fix memory leak

- Problem: during aging test, heap is increasing bit by bit.
- Cause: when updating the device list, the BLE payload is not freed.
- Solution: release BLE payload after updating the device list.

Change-Id: I2019643888883ca1c53ea16d9565e178ab6ec28f
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoAdd functionality that allow changing user's name accepted/tizen/unified/20191111.152608 submit/tizen/20191111.122616
saerome.kim [Mon, 11 Nov 2019 10:34:35 +0000 (19:34 +0900)]
Add functionality that allow changing user's name

- Problem: Users want to change their name.
- Cause: it is not supported to change the user name once user information
  added to ua-manager DB.
- Solution: Make the user can change his name even user-information added.

Change-Id: I54901e5c24da13239e8cce7d35063d15ed6ca975
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix crash issue on sensor status change event
Abhay agarwal [Mon, 11 Nov 2019 07:40:05 +0000 (13:10 +0530)]
Fix crash issue on sensor status change event

ua-manager crash was observed with sensor status change event
Destination: [(null)], event: [UNKNOWN ERROR], signal: [SensorStatusChanged]

Change-Id: I04610425e6019c51d3bd083ee59084a706e93eff
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoAdd the compiler flag required for performing GTest
saerome.kim [Fri, 8 Nov 2019 09:46:19 +0000 (18:46 +0900)]
Add the compiler flag required for performing GTest

Change-Id: I3d3b21e4f0dc34e351dd060d4aeff5a72fbee575
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFixed the problem where enabler method fails
saerome.kim [Fri, 8 Nov 2019 08:52:10 +0000 (17:52 +0900)]
Fixed the problem where enabler method fails

- Problem: The net.uamd.enabler method call fails.
- Cause: Invoke the 'enable' method to an object is not registered in
  dbus system.
- Solution: Remove 'enabler' interface and combine 'enabler' to
  '/net/uamd' interface

Change-Id: Ia40394ceb7d83a4305b0c0ab953ea6ffc423f9df
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoApply secure option
saerome.kim [Fri, 8 Nov 2019 08:44:37 +0000 (17:44 +0900)]
Apply secure option

- Problem: There is no FORTIFY option.
- Cause: Unlike the SSP that catches the stack BOF, a protection technique is
  needed to catch the BOF that occurs in a general memory buffer.
- Solution: apply FORTIFY and stack-canar options.

Change-Id: I1c1d45f1edfb0e017bdd8a3a3c1f42469f324220
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix the problem of not removing the device added to the default user or service
saerome.kim [Fri, 8 Nov 2019 06:19:09 +0000 (15:19 +0900)]
Fix the problem of not removing the device added to the default user or service

- Problem: can't remove a device from default-user.
- Cause: A device can be added to a default user or a default service,
  but can not be deleted.
- Solution: Deleting the default user checker.

Change-Id: I7bcce4fd4ac45e411e1be19fb793cf1532d366f7
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoCountermeasure if time() returns -1
saerome.kim [Fri, 8 Nov 2019 06:02:23 +0000 (15:02 +0900)]
Countermeasure if time() returns -1

- Problem: timestamp value may contain abnormal value.
- Cause: time() can retuern -1.
- Solution: We agreed to set the timestamp to 0 when time() returns -1.

Change-Id: I8d6189212589d28f09bac75b6075d7652415f4c7
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoSet default values for payload
Lokesh [Tue, 5 Nov 2019 08:55:43 +0000 (14:25 +0530)]
Set default values for payload

Change-Id: I2d863d2c0ff566bab6a5910613adc6912adddc38
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoImprove error handling by returning error code
Abhay agarwal [Mon, 4 Nov 2019 15:28:37 +0000 (20:58 +0530)]
Improve error handling by returning error code

Change-Id: Idb6b9e9f2076972a0a4d4a2dedd173d7badfbc48
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoRemove duplicate code to copy device
Abhay agarwal [Mon, 4 Nov 2019 05:35:20 +0000 (11:05 +0530)]
Remove duplicate code to copy device

Change-Id: Idb87db47775d437a19d9c18f4321de6e41870f4f
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoReturn error code while handling devices
Abhay agarwal [Mon, 4 Nov 2019 04:38:29 +0000 (10:08 +0530)]
Return error code while handling devices

- Improve error handling by returning error code

Change-Id: I6d0da4c9a819345b808aaa913c2fa31e00f431a4
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoModify DB transactions to return when fail
Abhay agarwal [Thu, 31 Oct 2019 06:16:07 +0000 (11:46 +0530)]
Modify DB transactions to return when fail

- Problem: If the transaction fails, more queries are being run on database
to insert/update/delete data from it without starting the transaction.
- Solution: Rollback and return from the function when transaction fails.

Change-Id: I086e56cae6a4964925fd8ee63b486469fe052314
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoFix the problem that can't add a device to a user
saerome.kim [Fri, 1 Nov 2019 01:10:13 +0000 (10:10 +0900)]
Fix the problem that can't add a device to a user

- Problem: Once user_id exceeded 0xFFFF then can't add a device to the
  user anymore.
- Cause: ua-manager is managing user_id as a maximun 16-bit unsigned
  integer.
- Solution: change user_id type to 32-bit integer.

Change-Id: I31cdf1fe7bc7ed580091f81fd50f48882f715cbe
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix NULL dereferencing
Lokesh [Thu, 31 Oct 2019 09:29:40 +0000 (14:59 +0530)]
Fix NULL dereferencing

Check null dereferencing while reading payload variables from device database.

Change-Id: Icd52bf9ebe27c6380b3974635f9dce524f94c837
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix memcpy's size parameter
Lokesh [Thu, 31 Oct 2019 07:43:48 +0000 (13:13 +0530)]
Fix memcpy's size parameter

Change-Id: Ie61b3d2aa18a1967d7b833d322584fdbf933ff65
Signed-off-by: Lokesh <l.kasana@samsung.com>
4 years agoFix the problem that the device can not be added to default_user accepted/tizen/unified/20191101.042011 submit/tizen/20191030.083316
saerome.kim [Wed, 30 Oct 2019 01:54:48 +0000 (10:54 +0900)]
Fix the problem that the device can not be added to default_user

- Problem: Unable to add device to default_user.
- Cause: ua-manager regards default_user's ID is always 1.
  However, If ua-manager has a problem occurred while accessing user-db,
  so all user information is deleted. In this case the user id of the default user
  is added to a value that is not 1.
- Solution: Deletes the hard-coded default user ID is 1.

Change-Id: I0d79364107aa7416c5b64b9481d2edc83801fbc4
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix the problem that DB cannot be deleted if DB is not initialized.
saerome.kim [Mon, 28 Oct 2019 12:33:16 +0000 (21:33 +0900)]
Fix the problem that DB cannot be deleted if DB is not initialized.

- Problem: During factory reset, vendor-plugin can't initialize the DB.
- Cause: The DB was not opened before the DB initialization.
- Solution: Delete the DB when reset_cb() is called.

Change-Id: I65394d0c4ab9b9719cbe3f9f63f1ef82d243a583
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoAdd supoort for database transactions submit/tizen/20191024.123502
Abhay agarwal [Thu, 24 Oct 2019 07:58:13 +0000 (13:28 +0530)]
Add supoort for database transactions

Change-Id: I5b1d1d07ad15385d4186647694f4f3bbbeb3aad0
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
4 years agoModify ua-manager to support the vendor-plugin
saerome.kim [Wed, 23 Oct 2019 12:31:58 +0000 (21:31 +0900)]
Modify ua-manager to support the vendor-plugin

- Problem: we decided to remove the power-plugin.
- Cause: Recently, we decided to remove the power plugin and use the
  power-plugin.
- Solution: Modify ua-manager to support the vendor-plugin instead of
  the power plugin.

Change-Id: I3b726d46282fd6dfd437f7121a6209020ea4251d
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoModify to add the sensor status to sensor information
saerome.kim [Tue, 22 Oct 2019 07:24:41 +0000 (16:24 +0900)]
Modify to add the sensor status to sensor information

Change-Id: Ifc5394bde0f83e057b006072faebd254d3500ad9
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoFix the problem that the Sensor Frameowk and UAF use different data
saerome.kim [Mon, 21 Oct 2019 11:44:26 +0000 (20:44 +0900)]
Fix the problem that the Sensor Frameowk and UAF use different data
format

- Problem: The data format of timestamp is not different from the sensor framework.
- Cause: The UAF uses 32 bit timestamp but the sensor framework uses 64
bit timestamp.
- Solution: Change timestamps in UAF with 64-bit unsigned long long.

Change-Id: I237f7201d7e7fed00858c47ca9350fcb1ad655c4
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
4 years agoAdd functionality to report instant sensor status change
saerome.kim [Mon, 21 Oct 2019 11:35:16 +0000 (20:35 +0900)]
Add functionality to report instant sensor status change

- Problem: in ABSENCE case, even the motion sensor detects ABSENCE
ua-manager reports this ABSENCE state after the detection window complete.
- Cause: If ABSENCE case, the ABSENCE can be jurged only when the
detction window complete.
- Solution: Whenever the sensor status is changed, plugin reports status
changed event immediately so that the user can recognize ABSENCE event
takes place during uncompleted ABSENCE detection window.

Change-Id: Ia5b12304976db4b89e5fa0977ea366a08361fc0e
Signed-off-by: saerome.kim <saerome.kim@samsung.com>