summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-29 00:24:54 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-29 00:24:54 +0000
commitff125935b6b0434b8576f59d0e382c7b7e3f166c (patch)
treecdb52d34d3ea1b2550e3dedb69fc200ee2b99d3c
parent82e536db737c7c079132060bc8932b6368761153 (diff)
parent0d45c3ba7faa950af7185faa77206f8c0bc4937e (diff)
downloadhwservicemanager-android14-qpr2-s3-release.tar.gz
Change-Id: Ic892bfc4fe4fa912878f8b3f9ae51c8ada5a033d
-rw-r--r--hwservicemanager.rc3
-rw-r--r--service.cpp13
2 files changed, 16 insertions, 0 deletions
diff --git a/hwservicemanager.rc b/hwservicemanager.rc
index 7ad492b..ce4db63 100644
--- a/hwservicemanager.rc
+++ b/hwservicemanager.rc
@@ -10,3 +10,6 @@ service hwservicemanager /system/system_ext/bin/hwservicemanager
task_profiles ServiceCapacityLow HighPerformance
class animation
shutdown critical
+
+on property:hwservicemanager.disabled=true
+ stop hwservicemanager
diff --git a/service.cpp b/service.cpp
index 3fc1391..3766bc5 100644
--- a/service.cpp
+++ b/service.cpp
@@ -26,6 +26,7 @@
#include <cutils/properties.h>
#include <hidl/HidlBinderSupport.h>
#include <hidl/HidlTransportSupport.h>
+#include <hidl/ServiceManagement.h>
#include <hidl/Status.h>
#include <hwbinder/IPCThreadState.h>
#include <hwbinder/ProcessState.h>
@@ -145,6 +146,18 @@ int main() {
// TODO(b/36424585): make fatal
ProcessState::self()->setCallRestriction(ProcessState::CallRestriction::ERROR_IF_NOT_ONEWAY);
+ if (!android::hardware::isHidlSupported()) {
+ ALOGI("HIDL is not supported on this device so hwservicemanager is not needed");
+ int rc = property_set("hwservicemanager.disabled", "true");
+ if (rc) {
+ LOG_ALWAYS_FATAL("Failed to set \"hwservicemanager.disabled\" (error %d).\"", rc);
+ }
+ // wait here for init to see the proprty and shut us down
+ while (true) {
+ ALOGW("Waiting on init to shut this process down.");
+ sleep(10);
+ }
+ }
sp<ServiceManager> manager = new ServiceManager();
setRequestingSid(manager, true);