Loading services/incremental/IncrementalService.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -2318,12 +2318,12 @@ void IncrementalService::registerAppOpsCallback(const std::string& packageName) if (cb) { return; } cb = new AppOpsListener(*this, packageName); cb = new AppOpsListener(*this, packageName, AppOpsManager::OP_GET_USAGE_STATS); listener = cb; } mAppOpsManager->startWatchingMode(AppOpsManager::OP_GET_USAGE_STATS, String16(packageName.c_str()), listener); mAppOpsManager->startWatchingMode(AppOpsManager::OP_NONE, String16(packageName.c_str()), listener); } bool IncrementalService::unregisterAppOpsCallback(const std::string& packageName) { Loading Loading @@ -3198,9 +3198,13 @@ void IncrementalService::DataLoaderStub::onDump(int fd) { dprintf(fd, " }\n"); } binder::Status IncrementalService::AppOpsListener::opChanged(int32_t, int32_t, binder::Status IncrementalService::AppOpsListener::opChanged(int32_t changedOp, int32_t, const String16&, const String16&) { // The listener will notify for any AppOp change for the given package. // Confirm it's the one we're interested in. if (changedOp == op) { incrementalService.onAppOpChanged(packageName); } return binder::Status::ok(); } Loading services/incremental/IncrementalService.h +5 −2 Original line number Diff line number Diff line Loading @@ -202,14 +202,17 @@ public: class AppOpsListener : public com::android::internal::app::BnAppOpsCallback { public: AppOpsListener(IncrementalService& incrementalService, std::string packageName) : incrementalService(incrementalService), packageName(std::move(packageName)) {} AppOpsListener(IncrementalService& incrementalService, std::string packageName, int32_t op) : incrementalService(incrementalService), packageName(std::move(packageName)), op(op) {} binder::Status opChanged(int32_t op, int32_t uid, const String16& packageName, const String16& persistentDeviceId) final; private: IncrementalService& incrementalService; const std::string packageName; const int32_t op; }; class IncrementalServiceConnector : public os::incremental::BnIncrementalServiceConnector { Loading services/incremental/test/IncrementalServiceTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1678,7 +1678,7 @@ TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsSuccessAndPermissionChang {}, {})); ASSERT_GE(mDataLoader->setStorageParams(true), 0); ASSERT_NE(nullptr, mAppOpsManager->mStoredCallback.get()); mAppOpsManager->mStoredCallback->opChanged(0, 0, {}, {}); mAppOpsManager->mStoredCallback->opChanged(AppOpsManager::OP_GET_USAGE_STATS, 0, {}, {}); } TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsCheckPermissionFails) { Loading Loading
services/incremental/IncrementalService.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -2318,12 +2318,12 @@ void IncrementalService::registerAppOpsCallback(const std::string& packageName) if (cb) { return; } cb = new AppOpsListener(*this, packageName); cb = new AppOpsListener(*this, packageName, AppOpsManager::OP_GET_USAGE_STATS); listener = cb; } mAppOpsManager->startWatchingMode(AppOpsManager::OP_GET_USAGE_STATS, String16(packageName.c_str()), listener); mAppOpsManager->startWatchingMode(AppOpsManager::OP_NONE, String16(packageName.c_str()), listener); } bool IncrementalService::unregisterAppOpsCallback(const std::string& packageName) { Loading Loading @@ -3198,9 +3198,13 @@ void IncrementalService::DataLoaderStub::onDump(int fd) { dprintf(fd, " }\n"); } binder::Status IncrementalService::AppOpsListener::opChanged(int32_t, int32_t, binder::Status IncrementalService::AppOpsListener::opChanged(int32_t changedOp, int32_t, const String16&, const String16&) { // The listener will notify for any AppOp change for the given package. // Confirm it's the one we're interested in. if (changedOp == op) { incrementalService.onAppOpChanged(packageName); } return binder::Status::ok(); } Loading
services/incremental/IncrementalService.h +5 −2 Original line number Diff line number Diff line Loading @@ -202,14 +202,17 @@ public: class AppOpsListener : public com::android::internal::app::BnAppOpsCallback { public: AppOpsListener(IncrementalService& incrementalService, std::string packageName) : incrementalService(incrementalService), packageName(std::move(packageName)) {} AppOpsListener(IncrementalService& incrementalService, std::string packageName, int32_t op) : incrementalService(incrementalService), packageName(std::move(packageName)), op(op) {} binder::Status opChanged(int32_t op, int32_t uid, const String16& packageName, const String16& persistentDeviceId) final; private: IncrementalService& incrementalService; const std::string packageName; const int32_t op; }; class IncrementalServiceConnector : public os::incremental::BnIncrementalServiceConnector { Loading
services/incremental/test/IncrementalServiceTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1678,7 +1678,7 @@ TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsSuccessAndPermissionChang {}, {})); ASSERT_GE(mDataLoader->setStorageParams(true), 0); ASSERT_NE(nullptr, mAppOpsManager->mStoredCallback.get()); mAppOpsManager->mStoredCallback->opChanged(0, 0, {}, {}); mAppOpsManager->mStoredCallback->opChanged(AppOpsManager::OP_GET_USAGE_STATS, 0, {}, {}); } TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsCheckPermissionFails) { Loading