1 /*
2  * Copyright 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_IRESOURCEMANAGERSERVICE_H
18 #define ANDROID_IRESOURCEMANAGERSERVICE_H
19 
20 #include <utils/Errors.h>  // for status_t
21 #include <utils/KeyedVector.h>
22 #include <utils/RefBase.h>
23 #include <utils/String8.h>
24 #include <binder/IInterface.h>
25 #include <binder/Parcel.h>
26 
27 #include <media/IResourceManagerClient.h>
28 #include <media/MediaResource.h>
29 #include <media/MediaResourcePolicy.h>
30 
31 namespace android {
32 
33 class IResourceManagerService: public IInterface
34 {
35 public:
36     DECLARE_META_INTERFACE(ResourceManagerService);
37 
38     virtual void config(const Vector<MediaResourcePolicy> &policies) = 0;
39 
40     virtual void addResource(
41             int pid,
42             int64_t clientId,
43             const sp<IResourceManagerClient> client,
44             const Vector<MediaResource> &resources) = 0;
45 
46     virtual void removeResource(int pid, int64_t clientId) = 0;
47 
48     virtual bool reclaimResource(
49             int callingPid,
50             const Vector<MediaResource> &resources) = 0;
51 };
52 
53 // ----------------------------------------------------------------------------
54 
55 class BnResourceManagerService: public BnInterface<IResourceManagerService>
56 {
57 public:
58     virtual status_t onTransact(uint32_t code,
59                                 const Parcel &data,
60                                 Parcel *reply,
61                                 uint32_t flags = 0);
62 };
63 
64 }; // namespace android
65 
66 #endif // ANDROID_IRESOURCEMANAGERSERVICE_H
67