Loading libs/binder/AppOpsManager.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -44,16 +44,16 @@ const int APP_OPS_MANAGER_UNAVAILABLE_MODE = AppOpsManager::MODE_IGNORED; } // namespace static String16 _appops("appops"); static pthread_mutex_t gTokenMutex = PTHREAD_MUTEX_INITIALIZER; static sp<IBinder> gToken; static pthread_mutex_t gClientIdMutex = PTHREAD_MUTEX_INITIALIZER; static sp<IBinder> gClientId; static const sp<IBinder>& getToken(const sp<IAppOpsService>& service) { pthread_mutex_lock(&gTokenMutex); if (gToken == nullptr || gToken->pingBinder() != NO_ERROR) { gToken = service->getToken(new BBinder()); static const sp<IBinder>& getClientId() { pthread_mutex_lock(&gClientIdMutex); if (gClientId == nullptr) { gClientId = new BBinder(); } pthread_mutex_unlock(&gTokenMutex); return gToken; pthread_mutex_unlock(&gClientIdMutex); return gClientId; } thread_local uint64_t notedAppOpsInThisBinderTransaction[2]; Loading Loading @@ -144,7 +144,7 @@ int32_t AppOpsManager::startOpNoThrow(int32_t op, int32_t uid, const String16& c const String16& message) { sp<IAppOpsService> service = getService(); int32_t mode = service != nullptr ? service->startOperation(getToken(service), op, uid, callingPackage, ? service->startOperation(getClientId(), op, uid, callingPackage, featureId, startIfModeDefault) : APP_OPS_MANAGER_UNAVAILABLE_MODE; if (mode == AppOpsManager::MODE_ALLOWED) { Loading @@ -162,7 +162,7 @@ void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPac const std::unique_ptr<String16>& callingFeatureId) { sp<IAppOpsService> service = getService(); if (service != nullptr) { service->finishOperation(getToken(service), op, uid, callingPackage, callingFeatureId); service->finishOperation(getClientId(), op, uid, callingPackage, callingFeatureId); } } Loading libs/binder/IAppOpsService.cpp +0 −18 Original line number Diff line number Diff line Loading @@ -106,16 +106,6 @@ public: remote()->transact(STOP_WATCHING_MODE_TRANSACTION, data, &reply); } virtual sp<IBinder> getToken(const sp<IBinder>& clientToken) { Parcel data, reply; data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); data.writeStrongBinder(clientToken); remote()->transact(GET_TOKEN_TRANSACTION, data, &reply); // fail on exception if (reply.readExceptionCode() != 0) return nullptr; return reply.readStrongBinder(); } virtual int32_t permissionToOpCode(const String16& permission) { Parcel data, reply; data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); Loading Loading @@ -251,14 +241,6 @@ status_t BnAppOpsService::onTransact( reply->writeNoException(); return NO_ERROR; } break; case GET_TOKEN_TRANSACTION: { CHECK_INTERFACE(IAppOpsService, data, reply); sp<IBinder> clientToken = data.readStrongBinder(); sp<IBinder> token = getToken(clientToken); reply->writeNoException(); reply->writeStrongBinder(token); return NO_ERROR; } break; case PERMISSION_TO_OP_CODE_TRANSACTION: { CHECK_INTERFACE(IAppOpsService, data, reply); String16 permission = data.readString16(); Loading libs/binder/include/binder/IAppOpsService.h +5 −7 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ public: virtual void startWatchingMode(int32_t op, const String16& packageName, const sp<IAppOpsCallback>& callback) = 0; virtual void stopWatchingMode(const sp<IAppOpsCallback>& callback) = 0; virtual sp<IBinder> getToken(const sp<IBinder>& clientToken) = 0; virtual int32_t permissionToOpCode(const String16& permission) = 0; virtual int32_t checkAudioOperation(int32_t code, int32_t usage,int32_t uid, const String16& packageName) = 0; Loading @@ -62,12 +61,11 @@ public: FINISH_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+3, START_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+4, STOP_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+5, GET_TOKEN_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+6, PERMISSION_TO_OP_CODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, CHECK_AUDIO_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+8, NOTE_ASYNC_OP_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+11, PERMISSION_TO_OP_CODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+6, CHECK_AUDIO_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, NOTE_ASYNC_OP_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+8, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, }; enum { Loading Loading
libs/binder/AppOpsManager.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -44,16 +44,16 @@ const int APP_OPS_MANAGER_UNAVAILABLE_MODE = AppOpsManager::MODE_IGNORED; } // namespace static String16 _appops("appops"); static pthread_mutex_t gTokenMutex = PTHREAD_MUTEX_INITIALIZER; static sp<IBinder> gToken; static pthread_mutex_t gClientIdMutex = PTHREAD_MUTEX_INITIALIZER; static sp<IBinder> gClientId; static const sp<IBinder>& getToken(const sp<IAppOpsService>& service) { pthread_mutex_lock(&gTokenMutex); if (gToken == nullptr || gToken->pingBinder() != NO_ERROR) { gToken = service->getToken(new BBinder()); static const sp<IBinder>& getClientId() { pthread_mutex_lock(&gClientIdMutex); if (gClientId == nullptr) { gClientId = new BBinder(); } pthread_mutex_unlock(&gTokenMutex); return gToken; pthread_mutex_unlock(&gClientIdMutex); return gClientId; } thread_local uint64_t notedAppOpsInThisBinderTransaction[2]; Loading Loading @@ -144,7 +144,7 @@ int32_t AppOpsManager::startOpNoThrow(int32_t op, int32_t uid, const String16& c const String16& message) { sp<IAppOpsService> service = getService(); int32_t mode = service != nullptr ? service->startOperation(getToken(service), op, uid, callingPackage, ? service->startOperation(getClientId(), op, uid, callingPackage, featureId, startIfModeDefault) : APP_OPS_MANAGER_UNAVAILABLE_MODE; if (mode == AppOpsManager::MODE_ALLOWED) { Loading @@ -162,7 +162,7 @@ void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPac const std::unique_ptr<String16>& callingFeatureId) { sp<IAppOpsService> service = getService(); if (service != nullptr) { service->finishOperation(getToken(service), op, uid, callingPackage, callingFeatureId); service->finishOperation(getClientId(), op, uid, callingPackage, callingFeatureId); } } Loading
libs/binder/IAppOpsService.cpp +0 −18 Original line number Diff line number Diff line Loading @@ -106,16 +106,6 @@ public: remote()->transact(STOP_WATCHING_MODE_TRANSACTION, data, &reply); } virtual sp<IBinder> getToken(const sp<IBinder>& clientToken) { Parcel data, reply; data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); data.writeStrongBinder(clientToken); remote()->transact(GET_TOKEN_TRANSACTION, data, &reply); // fail on exception if (reply.readExceptionCode() != 0) return nullptr; return reply.readStrongBinder(); } virtual int32_t permissionToOpCode(const String16& permission) { Parcel data, reply; data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); Loading Loading @@ -251,14 +241,6 @@ status_t BnAppOpsService::onTransact( reply->writeNoException(); return NO_ERROR; } break; case GET_TOKEN_TRANSACTION: { CHECK_INTERFACE(IAppOpsService, data, reply); sp<IBinder> clientToken = data.readStrongBinder(); sp<IBinder> token = getToken(clientToken); reply->writeNoException(); reply->writeStrongBinder(token); return NO_ERROR; } break; case PERMISSION_TO_OP_CODE_TRANSACTION: { CHECK_INTERFACE(IAppOpsService, data, reply); String16 permission = data.readString16(); Loading
libs/binder/include/binder/IAppOpsService.h +5 −7 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ public: virtual void startWatchingMode(int32_t op, const String16& packageName, const sp<IAppOpsCallback>& callback) = 0; virtual void stopWatchingMode(const sp<IAppOpsCallback>& callback) = 0; virtual sp<IBinder> getToken(const sp<IBinder>& clientToken) = 0; virtual int32_t permissionToOpCode(const String16& permission) = 0; virtual int32_t checkAudioOperation(int32_t code, int32_t usage,int32_t uid, const String16& packageName) = 0; Loading @@ -62,12 +61,11 @@ public: FINISH_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+3, START_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+4, STOP_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+5, GET_TOKEN_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+6, PERMISSION_TO_OP_CODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, CHECK_AUDIO_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+8, NOTE_ASYNC_OP_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+11, PERMISSION_TO_OP_CODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+6, CHECK_AUDIO_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, NOTE_ASYNC_OP_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+8, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, }; enum { Loading