Introduce vendor.qti.hardware.servicetracker@1.0 HAL

This Interface aims to receive Android Services related
information and maintain records.

Change-Id: Ie038d7d37beb0bf75c14ae85f37d8512d0990a42
diff --git a/Android.bp b/Android.bp
index 4dfd4c8..f8c0d60 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,3 +20,8 @@
     name: "vendor.display",
     path: "vendor/qcom/opensource/interfaces/display",
 }
+
+hidl_package_root {
+    name: "vendor.qti.hardware.servicetracker",
+    path: "vendor/qcom/opensource/interfaces/servicetracker",
+}
diff --git a/servicetracker/1.0/IServicetracker.hal b/servicetracker/1.0/IServicetracker.hal
new file mode 100644
index 0000000..9560e01
--- /dev/null
+++ b/servicetracker/1.0/IServicetracker.hal
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2019 The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*    * Redistributions of source code must retain the above copyright
+*      notice, this list of conditions and the following disclaimer.
+*    * Redistributions in binary form must reproduce the above
+*      copyright notice, this list of conditions and the following
+*      disclaimer in the documentation and/or other materials provided
+*      with the distribution.
+*    * Neither the name of The Linux Foundation. nor the names of its
+*      contributors may be used to endorse or promote products derived
+*      from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package vendor.qti.hardware.servicetracker@1.0;
+
+/**
+*Interface that collects all the updated information related to
+*Client and Service and share the needed information with
+*other components.
+*/
+interface IServicetracker {
+    /**
+    *Collect the information related to service that is just started
+    *@param serviceData contains details of the service,@param clientData
+    *contains the details of client which has started the service
+    */
+    oneway startService(ServiceData serviceData);
+
+    /**
+    *Collect and update  the information for the service which is just bound to
+    *@param clientData
+    */
+    oneway bindService(ServiceData serviceData, ClientData clientData);
+
+    /**
+    *Update the bind information of sevice,client pair specified
+    *by @param serviceData and @param clientData
+    */
+    oneway unbindService(ServiceData serviceData, ClientData clientData);
+
+    /**
+    *Update the service information when service specified by
+    *@param serviceData has been destroyed
+    */
+    oneway destroyService(ServiceData serviceData);
+
+    /**
+    *Update the service and client information when process
+    *specified by @param pid got killed
+    */
+    oneway killProcess(int32_t pid);
+
+    /**
+    *Return all the details related to Client specified by @param
+    *clientName
+    */
+    getclientInfo(string clientName) generates (Status status, ClientRecord client);
+
+    /**
+    *Return all the details related to Service specified by @param
+    *serviceName
+    */
+    getserviceInfo(string serviceName) generates (Status status, ServiceRecord service);
+
+    /**
+    *Return list of clients associated with the service specified by
+    *@param serviceName
+    */
+    getServiceConnections(string serviceName) generates (Status status, vec<ServiceConnection> conn);
+
+    /**
+    *Return the list of services associated with the client
+    *specified by @param clientName
+    */
+    getClientConnections(string clientName) generates (Status status, vec<ClientConnection> conn);
+
+    /**
+    *Return the pid of the process specified by @param processName
+    */
+    getPid(string processName) generates (Status status, int32_t pid);
+
+    /**
+    *Return the pid of the services listed in @param serviceList
+    */
+    getPids(vec<string> serviceList) generates (Status status, vec<int32_t> pidList);
+
+    /**
+    *Return whether a service specified by @param serviceName is
+    *B-Service or not
+    */
+    isServiceB(string serviceName) generates (Status status, bool serviceB);
+
+    /**
+    *generate the list of b services running in system
+    */
+    getServiceBCount() generates (Status status, vec<ServiceRecord> bServiceList, int32_t count);
+};
+
+
+
diff --git a/servicetracker/1.0/types.hal b/servicetracker/1.0/types.hal
new file mode 100644
index 0000000..ce4dc9f
--- /dev/null
+++ b/servicetracker/1.0/types.hal
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2019 The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*    * Redistributions of source code must retain the above copyright
+*      notice, this list of conditions and the following disclaimer.
+*    * Redistributions in binary form must reproduce the above
+*      copyright notice, this list of conditions and the following
+*      disclaimer in the documentation and/or other materials provided
+*      with the distribution.
+*    * Neither the name of The Linux Foundation. nor the names of its
+*      contributors may be used to endorse or promote products derived
+*      from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package vendor.qti.hardware.servicetracker@1.0;
+
+/**
+*Enum Values indicating the result of operation
+*/
+enum Status : int32_t {
+    /** No errors. */
+    SUCCESS,
+    /**
+    *the component for which the query is made
+    * is not yet available
+    */
+    ERROR_NOT_AVAILABLE,
+    /** the arguments passed are invalid*/
+    ERROR_INVALID_ARGS,
+    /**
+    *the information asked for the componenent
+    *is not supported
+    */
+    ERROR_NOT_SUPPORTED,
+    ERROR_UNKNOWN
+};
+
+/**
+*Client information recieved by AMS
+*/
+struct ClientData {
+    string processName;
+    int32_t pid;
+};
+
+/**
+*Service information recieved by AMS
+*/
+struct ServiceData {
+    string packageName;
+    string processName;
+    int32_t pid;
+	double lastActivity;
+    bool serviceB;
+};
+
+/**
+*structure to define client to service connection
+*/
+struct ClientConnection {
+    string serviceName;
+    int32_t servicePid;
+    int32_t count;
+};
+
+
+/**
+*structure to define service to client connection
+*/
+struct ServiceConnection {
+    string clientName;
+    int32_t clientPid;
+    int32_t count;
+};
+
+/**
+*Client information
+*/
+struct ClientRecord {
+    string processName;
+    int32_t pid;
+    vec<ClientConnection> conn;
+};
+
+/**
+*Service information
+*/
+struct ServiceRecord {
+    string packageName;
+    string processName;
+    int32_t pid;
+    bool serviceB;
+	double lastActivity;
+    vec<ServiceConnection> conn;
+};
+