|
24 | 24 | #include <binder/IResultReceiver.h> |
25 | 25 | #include <binder/Parcel.h> |
26 | 26 | #include <binder/PermissionCache.h> |
| 27 | +#include <com_android_frameworks_gpuservice_flags.h> |
27 | 28 | #include <cutils/properties.h> |
| 29 | +#include <cutils/multiuser.h> |
28 | 30 | #include <gpumem/GpuMem.h> |
29 | 31 | #include <gpuwork/GpuWork.h> |
30 | 32 | #include <gpustats/GpuStats.h> |
|
38 | 40 | #include <thread> |
39 | 41 | #include <memory> |
40 | 42 |
|
| 43 | +namespace gpuservice_flags = com::android::frameworks::gpuservice::flags; |
| 44 | + |
41 | 45 | namespace android { |
42 | 46 |
|
43 | 47 | using base::StringAppendF; |
@@ -113,11 +117,22 @@ void GpuService::toggleAngleAsSystemDriver(bool enabled) { |
113 | 117 |
|
114 | 118 | // only system_server with the ACCESS_GPU_SERVICE permission is allowed to set |
115 | 119 | // persist.graphics.egl |
116 | | - if (uid != AID_SYSTEM || |
117 | | - !PermissionCache::checkPermission(sAccessGpuServicePermission, pid, uid)) { |
118 | | - ALOGE("Permission Denial: can't set persist.graphics.egl from setAngleAsSystemDriver() " |
| 120 | + if (gpuservice_flags::multiuser_permission_check()) { |
| 121 | + // retrieve the appid of Settings app on multiuser builds |
| 122 | + const int multiuserappid = multiuser_get_app_id(uid); |
| 123 | + if (multiuserappid != AID_SYSTEM || |
| 124 | + !PermissionCache::checkPermission(sAccessGpuServicePermission, pid, uid)) { |
| 125 | + ALOGE("Permission Denial: can't set persist.graphics.egl from setAngleAsSystemDriver() " |
| 126 | + "pid=%d, uid=%d\n, multiuserappid=%d", pid, uid, multiuserappid); |
| 127 | + return; |
| 128 | + } |
| 129 | + } else { |
| 130 | + if (uid != AID_SYSTEM || |
| 131 | + !PermissionCache::checkPermission(sAccessGpuServicePermission, pid, uid)) { |
| 132 | + ALOGE("Permission Denial: can't set persist.graphics.egl from setAngleAsSystemDriver() " |
119 | 133 | "pid=%d, uid=%d\n", pid, uid); |
120 | | - return; |
| 134 | + return; |
| 135 | + } |
121 | 136 | } |
122 | 137 |
|
123 | 138 | std::lock_guard<std::mutex> lock(mLock); |
|
0 commit comments