ipacm: using same-process HAL
Create same process HAL to avoid double registrations
Change-Id: I47fb46b727d0c66006f65a06586c11e4c42c3ea9
diff --git a/hal/inc/HAL.h b/hal/inc/HAL.h
index 894438f..92ec135 100644
--- a/hal/inc/HAL.h
+++ b/hal/inc/HAL.h
@@ -123,7 +123,7 @@
* Yet, a major version update, would not be backwards compatible. This means that a 2.x HAL
* could not linked into the same IPACM code base as a 1.x HAL.
*/
- static HAL* makeIPAHAL(int /* version */, IOffloadManager* /* mgr */);
+ static Return<::android::sp<HAL>> makeIPAHAL(int /* version */, IOffloadManager* /* mgr */);
/* IOffloadConfig */
Return<void> setHandles(
diff --git a/hal/src/HAL.cpp b/hal/src/HAL.cpp
index 3f1a41f..f18767a 100644
--- a/hal/src/HAL.cpp
+++ b/hal/src/HAL.cpp
@@ -62,7 +62,7 @@
/* ------------------------------ PUBLIC ------------------------------------ */
-HAL* HAL::makeIPAHAL(int version, IOffloadManager* mgr) {
+Return<::android::sp<HAL>> HAL::makeIPAHAL(int version, IOffloadManager* mgr) {
android::hardware::ProcessState::initWithMmapSize((size_t)(2 * KERNEL_PAGE));
if (DBG)
@@ -70,7 +70,7 @@
(mgr != nullptr) ? "provided" : "null");
if (nullptr == mgr) return NULL;
else if (version != 1) return NULL;
- HAL* ret = new HAL(mgr);
+ ::android::sp<HAL> ret = new HAL(mgr);
if (nullptr == ret) return NULL;
configureRpcThreadpool(1, false);
ret->registerAsSystemService("ipacm");
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index ec5de34..ca75a4a 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -121,7 +121,7 @@
#ifdef FEATURE_IPACM_HAL
IPACM_OffloadManager* OffloadMng;
- HAL *hal;
+ ::android::sp<HAL> hal;
#endif
/* start netlink socket monitor*/