From 83d1c72376a9223d36ed685c3f88b40ddcb76b8f Mon Sep 17 00:00:00 2001 From: Evan Severson Date: Tue, 4 Apr 2023 14:46:06 -0700 Subject: Add AppOps overload to be able to watch foreground changes. We have never offered the native API to register mode watchers that are invoked for foregroundness changes when the raw mode is MODE_FOREGROUND. Test: Add logging to verify invocation Bug: 247768581 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:949cb3d098fd98715826fc92ea3c26a51aa2d976) Merged-In: I89af46de557fbfc31d69613367a4e26a5222430a Change-Id: I89af46de557fbfc31d69613367a4e26a5222430a --- libs/permission/AppOpsManager.cpp | 8 ++++++++ libs/permission/IAppOpsService.cpp | 11 +++++++++++ libs/permission/include/binder/AppOpsManager.h | 6 ++++++ libs/permission/include/binder/IAppOpsService.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/libs/permission/AppOpsManager.cpp b/libs/permission/AppOpsManager.cpp index baa9d75116..695927418d 100644 --- a/libs/permission/AppOpsManager.cpp +++ b/libs/permission/AppOpsManager.cpp @@ -146,6 +146,14 @@ void AppOpsManager::startWatchingMode(int32_t op, const String16& packageName, } } +void AppOpsManager::startWatchingMode(int32_t op, const String16& packageName, int32_t flags, + const sp& callback) { + sp service = getService(); + if (service != nullptr) { + service->startWatchingModeWithFlags(op, packageName, flags, callback); + } +} + void AppOpsManager::stopWatchingMode(const sp& callback) { sp service = getService(); if (service != nullptr) { diff --git a/libs/permission/IAppOpsService.cpp b/libs/permission/IAppOpsService.cpp index d59f44562e..7f235a4541 100644 --- a/libs/permission/IAppOpsService.cpp +++ b/libs/permission/IAppOpsService.cpp @@ -166,6 +166,17 @@ public: } return reply.readBool(); } + + virtual void startWatchingModeWithFlags(int32_t op, const String16& packageName, + int32_t flags, const sp& callback) { + Parcel data, reply; + data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); + data.writeInt32(op); + data.writeString16(packageName); + data.writeInt32(flags); + data.writeStrongBinder(IInterface::asBinder(callback)); + remote()->transact(START_WATCHING_MODE_WITH_FLAGS_TRANSACTION, data, &reply); + } }; IMPLEMENT_META_INTERFACE(AppOpsService, "com.android.internal.app.IAppOpsService") diff --git a/libs/permission/include/binder/AppOpsManager.h b/libs/permission/include/binder/AppOpsManager.h index abcd527966..243532bc4d 100644 --- a/libs/permission/include/binder/AppOpsManager.h +++ b/libs/permission/include/binder/AppOpsManager.h @@ -151,6 +151,10 @@ public: _NUM_OP = 117 }; + enum { + WATCH_FOREGROUND_CHANGES = 1 << 0 + }; + AppOpsManager(); int32_t checkOp(int32_t op, int32_t uid, const String16& callingPackage); @@ -174,6 +178,8 @@ public: const std::optional& attributionTag); void startWatchingMode(int32_t op, const String16& packageName, const sp& callback); + void startWatchingMode(int32_t op, const String16& packageName, int32_t flags, + const sp& callback); void stopWatchingMode(const sp& callback); int32_t permissionToOpCode(const String16& permission); void setCameraAudioRestriction(int32_t mode); diff --git a/libs/permission/include/binder/IAppOpsService.h b/libs/permission/include/binder/IAppOpsService.h index 22f056b235..918fcdbce1 100644 --- a/libs/permission/include/binder/IAppOpsService.h +++ b/libs/permission/include/binder/IAppOpsService.h @@ -52,6 +52,8 @@ public: const String16& packageName) = 0; virtual void setCameraAudioRestriction(int32_t mode) = 0; virtual bool shouldCollectNotes(int32_t opCode) = 0; + virtual void startWatchingModeWithFlags(int32_t op, const String16& packageName, + int32_t flags, const sp& callback) = 0; enum { CHECK_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, @@ -64,6 +66,7 @@ public: CHECK_AUDIO_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+8, SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, + START_WATCHING_MODE_WITH_FLAGS_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, }; enum { -- cgit v1.2.3 From 130ff33dfeb3c0702636db090399f114fde86174 Mon Sep 17 00:00:00 2001 From: Evan Severson Date: Tue, 4 Apr 2023 14:46:06 -0700 Subject: Add AppOps overload to be able to watch foreground changes. We have never offered the native API to register mode watchers that are invoked for foregroundness changes when the raw mode is MODE_FOREGROUND. Test: Add logging to verify invocation Bug: 247768581 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:949cb3d098fd98715826fc92ea3c26a51aa2d976) Merged-In: I89af46de557fbfc31d69613367a4e26a5222430a Change-Id: I89af46de557fbfc31d69613367a4e26a5222430a --- libs/permission/AppOpsManager.cpp | 8 ++++++++ libs/permission/IAppOpsService.cpp | 11 +++++++++++ libs/permission/include/binder/AppOpsManager.h | 6 ++++++ libs/permission/include/binder/IAppOpsService.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/libs/permission/AppOpsManager.cpp b/libs/permission/AppOpsManager.cpp index baa9d75116..695927418d 100644 --- a/libs/permission/AppOpsManager.cpp +++ b/libs/permission/AppOpsManager.cpp @@ -146,6 +146,14 @@ void AppOpsManager::startWatchingMode(int32_t op, const String16& packageName, } } +void AppOpsManager::startWatchingMode(int32_t op, const String16& packageName, int32_t flags, + const sp& callback) { + sp service = getService(); + if (service != nullptr) { + service->startWatchingModeWithFlags(op, packageName, flags, callback); + } +} + void AppOpsManager::stopWatchingMode(const sp& callback) { sp service = getService(); if (service != nullptr) { diff --git a/libs/permission/IAppOpsService.cpp b/libs/permission/IAppOpsService.cpp index d59f44562e..7f235a4541 100644 --- a/libs/permission/IAppOpsService.cpp +++ b/libs/permission/IAppOpsService.cpp @@ -166,6 +166,17 @@ public: } return reply.readBool(); } + + virtual void startWatchingModeWithFlags(int32_t op, const String16& packageName, + int32_t flags, const sp& callback) { + Parcel data, reply; + data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); + data.writeInt32(op); + data.writeString16(packageName); + data.writeInt32(flags); + data.writeStrongBinder(IInterface::asBinder(callback)); + remote()->transact(START_WATCHING_MODE_WITH_FLAGS_TRANSACTION, data, &reply); + } }; IMPLEMENT_META_INTERFACE(AppOpsService, "com.android.internal.app.IAppOpsService") diff --git a/libs/permission/include/binder/AppOpsManager.h b/libs/permission/include/binder/AppOpsManager.h index e3d705fa35..97b91ed523 100644 --- a/libs/permission/include/binder/AppOpsManager.h +++ b/libs/permission/include/binder/AppOpsManager.h @@ -150,6 +150,10 @@ public: _NUM_OP = 116 }; + enum { + WATCH_FOREGROUND_CHANGES = 1 << 0 + }; + AppOpsManager(); int32_t checkOp(int32_t op, int32_t uid, const String16& callingPackage); @@ -173,6 +177,8 @@ public: const std::optional& attributionTag); void startWatchingMode(int32_t op, const String16& packageName, const sp& callback); + void startWatchingMode(int32_t op, const String16& packageName, int32_t flags, + const sp& callback); void stopWatchingMode(const sp& callback); int32_t permissionToOpCode(const String16& permission); void setCameraAudioRestriction(int32_t mode); diff --git a/libs/permission/include/binder/IAppOpsService.h b/libs/permission/include/binder/IAppOpsService.h index 22f056b235..918fcdbce1 100644 --- a/libs/permission/include/binder/IAppOpsService.h +++ b/libs/permission/include/binder/IAppOpsService.h @@ -52,6 +52,8 @@ public: const String16& packageName) = 0; virtual void setCameraAudioRestriction(int32_t mode) = 0; virtual bool shouldCollectNotes(int32_t opCode) = 0; + virtual void startWatchingModeWithFlags(int32_t op, const String16& packageName, + int32_t flags, const sp& callback) = 0; enum { CHECK_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, @@ -64,6 +66,7 @@ public: CHECK_AUDIO_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, SHOULD_COLLECT_NOTES_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+8, SET_CAMERA_AUDIO_RESTRICTION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+9, + START_WATCHING_MODE_WITH_FLAGS_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+10, }; enum { -- cgit v1.2.3 From e9cb5b159c6bf1c76576845d4bacd752ce79f8e1 Mon Sep 17 00:00:00 2001 From: Vladimir Komsiyski Date: Fri, 28 Jul 2023 07:13:46 +0000 Subject: Revert "Handle runtime sensor events even if there are no real ones." This reverts commit 3b9574a68afb242d573f062ce8e0a99a452d5842. Reason for revert: potential culprit for b/291461814 Bug: 291461814 Change-Id: Ib92a05135a05978d8d4e6a938df1c6fb5b8169e2 Test: m --- services/sensorservice/SensorService.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 90d75414d6..398d60242b 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -1055,12 +1055,7 @@ bool SensorService::threadLoop() { if (count < 0) { if(count == DEAD_OBJECT && device.isReconnecting()) { device.reconnect(); - // There are no "real" events at this point, but do not skip the rest of the loop - // if there are pending runtime events. - Mutex::Autolock _l(&mLock); - if (mRuntimeSensorEventQueue.empty()) { - continue; - } + continue; } else { ALOGE("sensor poll failed (%s)", strerror(-count)); break; -- cgit v1.2.3 From a0c7cca5769008d02e0ce227feb3efd7471813a4 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 23 Aug 2023 15:18:27 -0400 Subject: Don't look through the buffer cache in protected contexts Test: manual - protected content in Netflix apk, even without blurring Without this change getOrCreateBackendTexture can return an un-Protected backend texture when a Protected one is required. This causes the Protected content draw to be dropped. Note: This CL originally landed in main as part of a broader fix for blurring protected content, but it has been discovered to fix other issues with protected content that were otherwise still visible in this branch. Bug: 242266174 Bug: 294357792 Change-Id: I9d7bab890ae8d88656e77dede962b40e926580c8 (cherry picked from commit 59f71734258e3959d2d3d8937d689b1bb88941db) Merged-In: I9d7bab890ae8d88656e77dede962b40e926580c8 --- libs/renderengine/skia/SkiaRenderEngine.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libs/renderengine/skia/SkiaRenderEngine.cpp b/libs/renderengine/skia/SkiaRenderEngine.cpp index 9e9df5216f..edf734271a 100644 --- a/libs/renderengine/skia/SkiaRenderEngine.cpp +++ b/libs/renderengine/skia/SkiaRenderEngine.cpp @@ -397,12 +397,10 @@ void SkiaRenderEngine::mapExternalTextureBuffer(const sp& buffer, } // We don't attempt to map a buffer if the buffer contains protected content. In GL this is // important because GPU resources for protected buffers are much more limited. (In Vk we - // simply match the existing behavior for protected buffers.) In Vk, we never cache any - // buffers while in a protected context, since Vk cannot share across contexts, and protected - // is less common. + // simply match the existing behavior for protected buffers.) We also never cache any + // buffers while in a protected context. const bool isProtectedBuffer = buffer->getUsage() & GRALLOC_USAGE_PROTECTED; - if (isProtectedBuffer || - (mRenderEngineType == RenderEngineType::SKIA_VK_THREADED && isProtected())) { + if (isProtectedBuffer || isProtected()) { return; } ATRACE_CALL(); @@ -467,9 +465,8 @@ void SkiaRenderEngine::unmapExternalTextureBuffer(sp&& buffer) { std::shared_ptr SkiaRenderEngine::getOrCreateBackendTexture( const sp& buffer, bool isOutputBuffer) { - // Do not lookup the buffer in the cache for protected contexts with the SkiaVk back-end - if (mRenderEngineType == RenderEngineType::SKIA_GL_THREADED || - (mRenderEngineType == RenderEngineType::SKIA_VK_THREADED && !isProtected())) { + // Do not lookup the buffer in the cache for protected contexts + if (!isProtected()) { if (const auto& it = mTextureCache.find(buffer->getId()); it != mTextureCache.end()) { return it->second; } -- cgit v1.2.3 From 77b758c59f58a05d1c0d45350796951bc778745f Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 4 Aug 2023 22:17:08 +0000 Subject: File size seal for memory mapped region When using memfd for cross process communication, we always need to seal the file size, otherwise remote process and shrink the size we memory mapped and thus crash the originate process causing a DoS Bug: 294609150 Test: Build Ignore-AOSP-First: security Change-Id: Ibc263c4f78df897e884378e3d984a188ca8772c7 Merged-In: Ibc263c4f78df897e884378e3d984a188ca8772c7 (cherry picked from commit 3d9f1e3b0a135b784b9ffa0e65d6a699c7ed1f8e) --- libs/binder/MemoryHeapBase.cpp | 4 ++-- libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp index 8fe1d2bb3d..34e747ef21 100644 --- a/libs/binder/MemoryHeapBase.cpp +++ b/libs/binder/MemoryHeapBase.cpp @@ -73,8 +73,8 @@ MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name) ALOGV("MemoryHeapBase: Attempting to force MemFD"); fd = memfd_create_region(name ? name : "MemoryHeapBase", size); if (fd < 0 || (mapfd(fd, true, size) != NO_ERROR)) return; - const int SEAL_FLAGS = ((mFlags & READ_ONLY) ? F_SEAL_FUTURE_WRITE : 0) | - ((mFlags & MEMFD_ALLOW_SEALING_FLAG) ? 0 : F_SEAL_SEAL); + const int SEAL_FLAGS = ((mFlags & READ_ONLY) ? F_SEAL_FUTURE_WRITE : 0) | F_SEAL_GROW | + F_SEAL_SHRINK | ((mFlags & MEMFD_ALLOW_SEALING_FLAG) ? 0 : F_SEAL_SEAL); if (SEAL_FLAGS && (fcntl(fd, F_ADD_SEALS, SEAL_FLAGS) == -1)) { ALOGE("MemoryHeapBase: MemFD %s sealing with flags %x failed with error %s", name, SEAL_FLAGS, strerror(errno)); diff --git a/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp b/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp index 278dd2bf81..140270f5a1 100644 --- a/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp +++ b/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp @@ -37,7 +37,8 @@ TEST(MemoryHeapBase, MemfdSealed) { ASSERT_NE(mHeap.get(), nullptr); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_SEAL); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL); + EXPECT_EQ(ftruncate(fd, 4096), -1); } TEST(MemoryHeapBase, MemfdUnsealed) { @@ -48,7 +49,8 @@ TEST(MemoryHeapBase, MemfdUnsealed) { ASSERT_NE(mHeap.get(), nullptr); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), 0); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_GROW | F_SEAL_SHRINK); + EXPECT_EQ(ftruncate(fd, 4096), -1); } TEST(MemoryHeapBase, MemfdSealedProtected) { @@ -59,7 +61,9 @@ TEST(MemoryHeapBase, MemfdSealedProtected) { ASSERT_NE(mHeap.get(), nullptr); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_SEAL | F_SEAL_FUTURE_WRITE); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), + F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL | F_SEAL_FUTURE_WRITE); + EXPECT_EQ(ftruncate(fd, 4096), -1); } TEST(MemoryHeapBase, MemfdUnsealedProtected) { @@ -71,7 +75,8 @@ TEST(MemoryHeapBase, MemfdUnsealedProtected) { ASSERT_NE(mHeap.get(), nullptr); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_FUTURE_WRITE); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_FUTURE_WRITE); + EXPECT_EQ(ftruncate(fd, 4096), -1); } #else -- cgit v1.2.3 From f2c1d9d28083fdcba53f346bba5289e72bc4be49 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 4 Aug 2023 22:17:08 +0000 Subject: File size seal for memory mapped region When using memfd for cross process communication, we always need to seal the file size, otherwise remote process and shrink the size we memory mapped and thus crash the originate process causing a DoS Bug: 294609150 Test: Build Ignore-AOSP-First: security Change-Id: Ibc263c4f78df897e884378e3d984a188ca8772c7 Merged-In: Ibc263c4f78df897e884378e3d984a188ca8772c7 (cherry picked from commit 3d9f1e3b0a135b784b9ffa0e65d6a699c7ed1f8e) --- libs/binder/MemoryHeapBase.cpp | 4 ++-- libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp index 8132d46940..0968b89eae 100644 --- a/libs/binder/MemoryHeapBase.cpp +++ b/libs/binder/MemoryHeapBase.cpp @@ -73,8 +73,8 @@ MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name) ALOGV("MemoryHeapBase: Attempting to force MemFD"); fd = memfd_create_region(name ? name : "MemoryHeapBase", size); if (fd < 0 || (mapfd(fd, true, size) != NO_ERROR)) return; - const int SEAL_FLAGS = ((mFlags & READ_ONLY) ? F_SEAL_FUTURE_WRITE : 0) | - ((mFlags & MEMFD_ALLOW_SEALING) ? 0 : F_SEAL_SEAL); + const int SEAL_FLAGS = ((mFlags & READ_ONLY) ? F_SEAL_FUTURE_WRITE : 0) | F_SEAL_GROW | + F_SEAL_SHRINK | ((mFlags & MEMFD_ALLOW_SEALING) ? 0 : F_SEAL_SEAL); if (SEAL_FLAGS && (fcntl(fd, F_ADD_SEALS, SEAL_FLAGS) == -1)) { ALOGE("MemoryHeapBase: MemFD %s sealing with flags %x failed with error %s", name, SEAL_FLAGS, strerror(errno)); diff --git a/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp b/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp index 21cb70be17..7d19fd4cff 100644 --- a/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp +++ b/libs/binder/tests/binderMemoryHeapBaseUnitTest.cpp @@ -35,7 +35,8 @@ TEST(MemoryHeapBase, MemfdSealed) { "Test mapping"); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_SEAL); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL); + EXPECT_EQ(ftruncate(fd, 4096), -1); } TEST(MemoryHeapBase, MemfdUnsealed) { @@ -45,7 +46,8 @@ TEST(MemoryHeapBase, MemfdUnsealed) { "Test mapping"); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), 0); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_GROW | F_SEAL_SHRINK); + EXPECT_EQ(ftruncate(fd, 4096), -1); } TEST(MemoryHeapBase, MemfdSealedProtected) { @@ -55,7 +57,9 @@ TEST(MemoryHeapBase, MemfdSealedProtected) { "Test mapping"); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_SEAL | F_SEAL_FUTURE_WRITE); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), + F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL | F_SEAL_FUTURE_WRITE); + EXPECT_EQ(ftruncate(fd, 4096), -1); } TEST(MemoryHeapBase, MemfdUnsealedProtected) { @@ -66,7 +70,8 @@ TEST(MemoryHeapBase, MemfdUnsealedProtected) { "Test mapping"); int fd = mHeap->getHeapID(); EXPECT_NE(fd, -1); - EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_FUTURE_WRITE); + EXPECT_EQ(fcntl(fd, F_GET_SEALS), F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_FUTURE_WRITE); + EXPECT_EQ(ftruncate(fd, 4096), -1); } #else -- cgit v1.2.3 From 538c8f7276bad38cd9db35382a6c4cda09c4d050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Thu, 28 Sep 2023 05:12:28 +0000 Subject: make it clear mGpuMemTotalMap is R/O MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: TreeHugger Signed-off-by: Maciej Żenczykowski (cherry picked from https://android-review.googlesource.com/q/commit:af8d3a709b93cb2a857ff783840b3b3f1d83d16b) Merged-In: I0484c629a02b84b59ca19b35e24a6496fbfd0990 Change-Id: I0484c629a02b84b59ca19b35e24a6496fbfd0990 --- services/gpuservice/gpumem/GpuMem.cpp | 2 +- services/gpuservice/gpumem/include/gpumem/GpuMem.h | 4 ++-- services/gpuservice/tests/unittests/TestableGpuMem.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/gpuservice/gpumem/GpuMem.cpp b/services/gpuservice/gpumem/GpuMem.cpp index dd3cc3bd86..141fe021ee 100644 --- a/services/gpuservice/gpumem/GpuMem.cpp +++ b/services/gpuservice/gpumem/GpuMem.cpp @@ -77,7 +77,7 @@ void GpuMem::initialize() { mInitialized.store(true); } -void GpuMem::setGpuMemTotalMap(bpf::BpfMap& map) { +void GpuMem::setGpuMemTotalMap(bpf::BpfMapRO& map) { mGpuMemTotalMap = std::move(map); } diff --git a/services/gpuservice/gpumem/include/gpumem/GpuMem.h b/services/gpuservice/gpumem/include/gpumem/GpuMem.h index 7588b54818..9aa74d6863 100644 --- a/services/gpuservice/gpumem/include/gpumem/GpuMem.h +++ b/services/gpuservice/gpumem/include/gpumem/GpuMem.h @@ -44,12 +44,12 @@ private: friend class TestableGpuMem; // set gpu memory total map - void setGpuMemTotalMap(bpf::BpfMap& map); + void setGpuMemTotalMap(bpf::BpfMapRO& map); // indicate whether ebpf has been initialized std::atomic mInitialized = false; // bpf map for GPU memory total data - android::bpf::BpfMap mGpuMemTotalMap; + android::bpf::BpfMapRO mGpuMemTotalMap; // gpu memory tracepoint event category static constexpr char kGpuMemTraceGroup[] = "gpu_mem"; diff --git a/services/gpuservice/tests/unittests/TestableGpuMem.h b/services/gpuservice/tests/unittests/TestableGpuMem.h index 6c8becb075..f21843fe1a 100644 --- a/services/gpuservice/tests/unittests/TestableGpuMem.h +++ b/services/gpuservice/tests/unittests/TestableGpuMem.h @@ -28,7 +28,7 @@ public: void setInitialized() { mGpuMem->mInitialized.store(true); } - void setGpuMemTotalMap(bpf::BpfMap& map) { + void setGpuMemTotalMap(bpf::BpfMapRO& map) { mGpuMem->setGpuMemTotalMap(map); } -- cgit v1.2.3