From edb7b4c992cf8265530047f3b17a2dce78be8a53 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 1 Apr 2021 23:15:24 +0000 Subject: libbinder: move media resource monitor This is only used by one service, so we can avoid paying the cost for it in all users of libbinder (saving private dirty memory). Bug: 183654927 Test: N/A Change-Id: Idf59c7092e5d8b0bbd3153bff84cef7d1589e73f --- libs/binder/Android.bp | 1 - libs/binder/IMediaResourceMonitor.cpp | 63 ---------------------- libs/binder/include/binder/IMediaResourceMonitor.h | 59 -------------------- 3 files changed, 123 deletions(-) delete mode 100644 libs/binder/IMediaResourceMonitor.cpp delete mode 100644 libs/binder/include/binder/IMediaResourceMonitor.h (limited to 'libs') diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp index 728a8c4376..cdc90fb4e2 100644 --- a/libs/binder/Android.bp +++ b/libs/binder/Android.bp @@ -65,7 +65,6 @@ libbinder_device_interface_sources = [ "IActivityManager.cpp", "IAppOpsCallback.cpp", "IAppOpsService.cpp", - "IMediaResourceMonitor.cpp", "IPermissionController.cpp", "IProcessInfoService.cpp", "IUidObserver.cpp", diff --git a/libs/binder/IMediaResourceMonitor.cpp b/libs/binder/IMediaResourceMonitor.cpp deleted file mode 100644 index f5fa817b5e..0000000000 --- a/libs/binder/IMediaResourceMonitor.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 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. - */ - -#include -#include -#include -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class BpMediaResourceMonitor : public BpInterface { -public: - explicit BpMediaResourceMonitor(const sp& impl) - : BpInterface(impl) {} - - virtual void notifyResourceGranted(/*in*/ int32_t pid, /*in*/ const int32_t type) - { - Parcel data, reply; - data.writeInterfaceToken(IMediaResourceMonitor::getInterfaceDescriptor()); - data.writeInt32(pid); - data.writeInt32(type); - remote()->transact(NOTIFY_RESOURCE_GRANTED, data, &reply, IBinder::FLAG_ONEWAY); - } -}; - -IMPLEMENT_META_INTERFACE(MediaResourceMonitor, "android.media.IMediaResourceMonitor") - -// ---------------------------------------------------------------------- - -// NOLINTNEXTLINE(google-default-arguments) -status_t BnMediaResourceMonitor::onTransact( uint32_t code, const Parcel& data, Parcel* reply, - uint32_t flags) { - switch(code) { - case NOTIFY_RESOURCE_GRANTED: { - CHECK_INTERFACE(IMediaResourceMonitor, data, reply); - int32_t pid = data.readInt32(); - const int32_t type = data.readInt32(); - notifyResourceGranted(/*in*/ pid, /*in*/ type); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -// ---------------------------------------------------------------------- - -} // namespace android diff --git a/libs/binder/include/binder/IMediaResourceMonitor.h b/libs/binder/include/binder/IMediaResourceMonitor.h deleted file mode 100644 index f92d557932..0000000000 --- a/libs/binder/include/binder/IMediaResourceMonitor.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2016 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. - */ - -#pragma once - -#ifndef __ANDROID_VNDK__ - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class IMediaResourceMonitor : public IInterface { -public: - DECLARE_META_INTERFACE(MediaResourceMonitor) - - // Values should be in sync with Intent.EXTRA_MEDIA_RESOURCE_TYPE_XXX. - enum { - TYPE_VIDEO_CODEC = 0, - TYPE_AUDIO_CODEC = 1, - }; - - virtual void notifyResourceGranted(/*in*/ int32_t pid, /*in*/ const int32_t type) = 0; - - enum { - NOTIFY_RESOURCE_GRANTED = IBinder::FIRST_CALL_TRANSACTION, - }; -}; - -// ---------------------------------------------------------------------- - -class BnMediaResourceMonitor : public BnInterface { -public: - // NOLINTNEXTLINE(google-default-arguments) - virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------- - -} // namespace android - -#else // __ANDROID_VNDK__ -#error "This header is not visible to vendors" -#endif // __ANDROID_VNDK__ -- cgit v1.2.3-59-g8ed1b