diff options
author | 2025-02-10 13:02:35 -0800 | |
---|---|---|
committer | 2025-02-10 13:02:35 -0800 | |
commit | 289ca076a2774e88e3e228f75a0f08ba38e63f24 (patch) | |
tree | 485c86b21234c9912391ccec2ba9eb4d7f2be0f5 | |
parent | d2656a9c8e32f7117519c10764689bc280d5336e (diff) | |
parent | 052e551b92e8d3b8658f77746a344576476b7d13 (diff) |
Merge "[appops] Migrate native IAppOpsCallback to aidl" into main
-rw-r--r-- | core/java/com/android/internal/app/IAppOpsCallback.aidl | 23 | ||||
-rw-r--r-- | services/incremental/IncrementalService.cpp | 4 | ||||
-rw-r--r-- | services/incremental/IncrementalService.h | 7 | ||||
-rw-r--r-- | services/incremental/ServiceWrappers.h | 3 | ||||
-rw-r--r-- | services/incremental/test/IncrementalServiceTest.cpp | 2 |
5 files changed, 10 insertions, 29 deletions
diff --git a/core/java/com/android/internal/app/IAppOpsCallback.aidl b/core/java/com/android/internal/app/IAppOpsCallback.aidl deleted file mode 100644 index 3a9525c03161..000000000000 --- a/core/java/com/android/internal/app/IAppOpsCallback.aidl +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.app; - -// This interface is also used by native code, so must -// be kept in sync with frameworks/native/libs/permission/include/binder/IAppOpsCallback.h -oneway interface IAppOpsCallback { - void opChanged(int op, int uid, String packageName, String persistentDeviceId); -} diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp index dae481a3c215..36947a2a6d62 100644 --- a/services/incremental/IncrementalService.cpp +++ b/services/incremental/IncrementalService.cpp @@ -3198,8 +3198,10 @@ void IncrementalService::DataLoaderStub::onDump(int fd) { dprintf(fd, " }\n"); } -void IncrementalService::AppOpsListener::opChanged(int32_t, const String16&) { +binder::Status IncrementalService::AppOpsListener::opChanged(int32_t, int32_t, + const String16&, const String16&) { incrementalService.onAppOpChanged(packageName); + return binder::Status::ok(); } binder::Status IncrementalService::IncrementalServiceConnector::setStorageParams( diff --git a/services/incremental/IncrementalService.h b/services/incremental/IncrementalService.h index b81e1b1b071c..4ee1a70dc34c 100644 --- a/services/incremental/IncrementalService.h +++ b/services/incremental/IncrementalService.h @@ -26,7 +26,7 @@ #include <android/os/incremental/BnStorageLoadingProgressListener.h> #include <android/os/incremental/PerUidReadTimeouts.h> #include <android/os/incremental/StorageHealthCheckParams.h> -#include <binder/IAppOpsCallback.h> +#include <binder/AppOpsManager.h> #include <binder/PersistableBundle.h> #include <utils/String16.h> #include <utils/StrongPointer.h> @@ -200,11 +200,12 @@ public: void getMetrics(int32_t storageId, android::os::PersistableBundle* _aidl_return); - class AppOpsListener : public android::BnAppOpsCallback { + class AppOpsListener : public com::android::internal::app::BnAppOpsCallback { public: AppOpsListener(IncrementalService& incrementalService, std::string packageName) : incrementalService(incrementalService), packageName(std::move(packageName)) {} - void opChanged(int32_t op, const String16& packageName) final; + binder::Status opChanged(int32_t op, int32_t uid, const String16& packageName, + const String16& persistentDeviceId) final; private: IncrementalService& incrementalService; diff --git a/services/incremental/ServiceWrappers.h b/services/incremental/ServiceWrappers.h index 39e2ee324e0c..36a5b7f4a75d 100644 --- a/services/incremental/ServiceWrappers.h +++ b/services/incremental/ServiceWrappers.h @@ -23,7 +23,7 @@ #include <android/content/pm/IDataLoader.h> #include <android/content/pm/IDataLoaderStatusListener.h> #include <android/os/incremental/PerUidReadTimeouts.h> -#include <binder/IAppOpsCallback.h> +#include <binder/AppOpsManager.h> #include <binder/IServiceManager.h> #include <binder/Status.h> #include <incfs.h> @@ -133,6 +133,7 @@ public: class AppOpsManagerWrapper { public: + using IAppOpsCallback = ::com::android::internal::app::IAppOpsCallback; virtual ~AppOpsManagerWrapper() = default; virtual binder::Status checkPermission(const char* permission, const char* operation, const char* package) const = 0; diff --git a/services/incremental/test/IncrementalServiceTest.cpp b/services/incremental/test/IncrementalServiceTest.cpp index d9d3d62e92e2..73849a3e0e00 100644 --- a/services/incremental/test/IncrementalServiceTest.cpp +++ b/services/incremental/test/IncrementalServiceTest.cpp @@ -1678,7 +1678,7 @@ TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsSuccessAndPermissionChang {}, {})); ASSERT_GE(mDataLoader->setStorageParams(true), 0); ASSERT_NE(nullptr, mAppOpsManager->mStoredCallback.get()); - mAppOpsManager->mStoredCallback->opChanged(0, {}); + mAppOpsManager->mStoredCallback->opChanged(0, 0, {}, {}); } TEST_F(IncrementalServiceTest, testSetIncFsMountOptionsCheckPermissionFails) { |