diff options
-rw-r--r-- | libs/binder/AppOpsManager.cpp | 7 | ||||
-rw-r--r-- | libs/binder/IAppOpsService.cpp | 14 | ||||
-rw-r--r-- | libs/binder/include/binder/AppOpsManager.h | 2 | ||||
-rw-r--r-- | libs/binder/include/binder/IAppOpsService.h | 5 |
4 files changed, 28 insertions, 0 deletions
diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp index 48b218e78b..e2af01c161 100644 --- a/libs/binder/AppOpsManager.cpp +++ b/libs/binder/AppOpsManager.cpp @@ -193,6 +193,13 @@ int32_t AppOpsManager::permissionToOpCode(const String16& permission) { return -1; } +void AppOpsManager::setCameraAudioRestriction(int32_t mode) { + sp<IAppOpsService> service = getService(); + if (service != nullptr) { + service->setCameraAudioRestriction(mode); + } +} + #endif // __ANDROID_VNDK__ bool AppOpsManager::shouldCollectNotes(int32_t opcode) { diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp index 8840990824..b6360cbffd 100644 --- a/libs/binder/IAppOpsService.cpp +++ b/libs/binder/IAppOpsService.cpp @@ -138,6 +138,13 @@ public: return reply.readInt32(); } + virtual void setCameraAudioRestriction(int32_t mode) { + Parcel data, reply; + data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); + data.writeInt32(mode); + remote()->transact(SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION, data, &reply); + } + #endif virtual void noteAsyncOp(const String16& callingPackageName, int32_t uid, const String16& packageName, int32_t opCode, const String16& message) { @@ -274,6 +281,13 @@ status_t BnAppOpsService::onTransact( reply->writeInt32(res); return NO_ERROR; } break; + case SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION: { + CHECK_INTERFACE(IAppOpsService, data, reply); + const int32_t mode = data.readInt32(); + setCameraAudioRestriction(mode); + reply->writeNoException(); + return NO_ERROR; + } break; #endif // __ANDROID_VNDK__ case NOTE_ASYNC_OP_TRANSACTION: { CHECK_INTERFACE(IAppOpsService, data, reply); diff --git a/libs/binder/include/binder/AppOpsManager.h b/libs/binder/include/binder/AppOpsManager.h index 7a99396eef..dff4d49596 100644 --- a/libs/binder/include/binder/AppOpsManager.h +++ b/libs/binder/include/binder/AppOpsManager.h @@ -144,9 +144,11 @@ public: const sp<IAppOpsCallback>& callback); void stopWatchingMode(const sp<IAppOpsCallback>& callback); int32_t permissionToOpCode(const String16& permission); + void setCameraAudioRestriction(int32_t mode); #endif // __ANDROID_VNDK__ void noteAsyncOp(const String16& callingPackageName, int32_t uid, const String16& packageName, int32_t opCode, const String16& message); + private: Mutex mLock; sp<IAppOpsService> mService; diff --git a/libs/binder/include/binder/IAppOpsService.h b/libs/binder/include/binder/IAppOpsService.h index 9d02370015..009ef6c7a7 100644 --- a/libs/binder/include/binder/IAppOpsService.h +++ b/libs/binder/include/binder/IAppOpsService.h @@ -46,6 +46,7 @@ public: 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; + virtual void setCameraAudioRestriction(int32_t mode) = 0; #endif // __ANDROID_VNDK__ virtual void noteAsyncOp(const String16& callingPackageName, int32_t uid, const String16& packageName, int32_t opCode, const String16& message) = 0; @@ -65,6 +66,10 @@ public: #endif // __ANDROID_VNDK__ NOTE_ASYNC_OP_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, +#ifndef __ANDROID_VNDK__ + SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+11, +#endif // __ANDROID_VNDK__ + }; enum { |