diff options
| author | 2020-03-05 19:35:28 +0000 | |
|---|---|---|
| committer | 2020-03-05 19:35:28 +0000 | |
| commit | 1d8853e492db3a0fb38dd178fa52f186474db8ae (patch) | |
| tree | 87ee345c1ced1769e59dc48e7b577264f5768135 | |
| parent | 987f74abd8a755ccb8f554b90fea620a5655376c (diff) | |
| parent | 1e219c147e9b6ab34058613424a3c86b69b5e6dc (diff) | |
libbinder: move AppOpManager globals into function am: 1e219c147e
Change-Id: Ib3133637d9622e31cc8f309c65c58f0be0ab4d1a
| -rw-r--r-- | libs/binder/AppOpsManager.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp index 4ab144bdf1..b344b32ed4 100644 --- a/libs/binder/AppOpsManager.cpp +++ b/libs/binder/AppOpsManager.cpp @@ -43,11 +43,10 @@ const int APP_OPS_MANAGER_UNAVAILABLE_MODE = AppOpsManager::MODE_IGNORED; } // namespace -static String16 _appops("appops"); -static pthread_mutex_t gClientIdMutex = PTHREAD_MUTEX_INITIALIZER; -static sp<IBinder> gClientId; - static const sp<IBinder>& getClientId() { + static pthread_mutex_t gClientIdMutex = PTHREAD_MUTEX_INITIALIZER; + static sp<IBinder> gClientId; + pthread_mutex_lock(&gClientIdMutex); if (gClientId == nullptr) { gClientId = new BBinder(); @@ -72,6 +71,7 @@ sp<IAppOpsService> AppOpsManager::getService() { return NULL; } #else sp<IAppOpsService> AppOpsManager::getService() { + static String16 _appops("appops"); std::lock_guard<Mutex> scoped_lock(mLock); int64_t startTime = 0; |