Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 289ca076 authored by Atneya Nair's avatar Atneya Nair Committed by Android (Google) Code Review
Browse files

Merge "[appops] Migrate native IAppOpsCallback to aidl" into main

parents d2656a9c 052e551b
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
/*
 * 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);
}
+3 −1
Original line number Diff line number Diff line
@@ -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(
+4 −3
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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) {