diff options
| author | Changyeon Jo <changyeon@google.com> | 2020-02-28 13:23:42 -0800 |
|---|---|---|
| committer | Changyeon Jo <changyeon@google.com> | 2020-02-28 15:18:51 -0800 |
| commit | f73eb94d94cf94dc028b8af71871349bb180ae34 (patch) | |
| tree | cbfe83ba7b86dc108cf08215d226f9783773f1fe /evs | |
| parent | 139aa95b2f47bd2dae9916472e92a526e2e9a6dc (diff) | |
| download | platform_packages_services_Car-f73eb94d94cf94dc028b8af71871349bb180ae34.tar.gz platform_packages_services_Car-f73eb94d94cf94dc028b8af71871349bb180ae34.tar.bz2 platform_packages_services_Car-f73eb94d94cf94dc028b8af71871349bb180ae34.zip | |
Allow root and system users to use EVS service
This change updates checkPermission() in EVS manager to allow a system
user to use EVS service. A root user is only allowed in userdebug and
eng builds.
Fix: 150010044
Test: m -j and launch evs_app as root and system users
Change-Id: Ib04407db3f014229ffc578748d44b268865396ea
Diffstat (limited to 'evs')
| -rw-r--r-- | evs/manager/1.1/Android.bp | 8 | ||||
| -rw-r--r-- | evs/manager/1.1/Enumerator.cpp | 13 |
2 files changed, 17 insertions, 4 deletions
diff --git a/evs/manager/1.1/Android.bp b/evs/manager/1.1/Android.bp index 41ccce781..4a627153c 100644 --- a/evs/manager/1.1/Android.bp +++ b/evs/manager/1.1/Android.bp @@ -63,4 +63,12 @@ cc_binary { include_dirs: [ "system/core/libsync", ], + + product_variables: { + debuggable: { + cflags: [ + "-DEVS_ALLOW_AID_ROOT", + ] + } + } } diff --git a/evs/manager/1.1/Enumerator.cpp b/evs/manager/1.1/Enumerator.cpp index 5c368cfc2..90d05702a 100644 --- a/evs/manager/1.1/Enumerator.cpp +++ b/evs/manager/1.1/Enumerator.cpp @@ -42,10 +42,15 @@ bool Enumerator::init(const char* hardwareServiceName) { bool Enumerator::checkPermission() { hardware::IPCThreadState *ipc = hardware::IPCThreadState::self(); - if (AID_AUTOMOTIVE_EVS != ipc->getCallingUid() && - AID_ROOT != ipc->getCallingUid()) { - - ALOGE("EVS access denied?: pid = %d, uid = %d", ipc->getCallingPid(), ipc->getCallingUid()); + const auto userId = ipc->getCallingUid() / AID_USER_OFFSET; + const auto appId = ipc->getCallingUid() % AID_USER_OFFSET; +#ifdef EVS_ALLOW_AID_ROOT + if (AID_AUTOMOTIVE_EVS != appId && AID_ROOT != appId && AID_SYSTEM != appId) { +#else + if (AID_AUTOMOTIVE_EVS != appId && AID_SYSTEM != appId) { +#endif + ALOGE("EVS access denied?: pid = %d, userId = %d, appId = %d", + ipc->getCallingPid(), userId, appId); return false; } |
